3 using Microsoft.Xna.Framework;
15 private float deattachTimer;
24 [
Serialize(0.0f,
IsPropertySaveable.No, description:
"How far along the item is to being deattached. When the timer goes above DeattachDuration, the item is deattached.")]
27 get {
return deattachTimer; }
36 if (holdable ==
null) {
return; }
38 deattachTimer = Math.Max(0.0f, value);
45 else if (Math.Abs(lastSentDeattachTimer - deattachTimer) > 0.1f)
47 item.CreateServerEvent(
this);
48 lastSentDeattachTimer = deattachTimer;
64 [
Serialize(1.0f,
IsPropertySaveable.No, description:
"How much the position of the item can vary from the wall the item spawns on.")]
73 get {
return holdable !=
null && holdable.
Attached; }
81 public override void Move(Vector2 amount,
bool ignoreContacts =
false)
83 if (trigger !=
null && amount.LengthSquared() > 0.00001f)
98 if (holdable !=
null && !holdable.
Attached)
123 if (holdable ==
null)
135 private void CreateTriggerBody()
137 System.Diagnostics.Debug.Assert(trigger ==
null,
"LevelResource trigger already created!");
141 trigger =
new PhysicsBody(body.Width, body.Height, body.Radius,
144 Physics.CollisionWall,
145 Physics.CollisionNone,
146 findNewContacts:
false)
static GameSession?? GameSession
static NetworkMember NetworkMember
readonly Identifier Identifier
override Vector2? SimPosition
The base class for components holding the different functionalities of the item
Dictionary< RelatedItem.RelationType, List< RelatedItem > > RequiredItems
LevelResource(Item item, ContentXElement element)
float RandomOffsetFromWall
override void Move(Vector2 amount, bool ignoreContacts=false)
override void OnItemLoaded()
Called when all the components of the item have been loaded. Use to initialize connections between co...
override void RemoveComponentSpecific()
override void Update(float deltaTime, Camera cam)
bool SetTransform(Vector2 simPosition, float rotation, bool setPrevTransform=true)
bool SetTransformIgnoreContacts(Vector2 simPosition, float rotation, bool setPrevTransform=true)
readonly Identifier Identifier
Interface for entities that the server can send events to the clients