public Trap(Sprite sprite, Vector2 position, Attributes attributes, WeaponData weaponData, PartyMember setter, Battle battle) : base(attributes) { if (attributes == null) throw new Exception("Attributes cannot be null"); if (setter == null) throw new Exception("PartyMember setter cannot be null"); if (battle == null) throw new Exception("Battle cannot be null"); this.setter = setter; this.battle = battle; Data = weaponData; entity = new Entity(sprite, position); entity.RenderShadow = true; entity.UpdateExtensions.Add(new UpdateExtension((updateExtension, delta) => Update(delta))); Scene.AddEntity(entity); }
public Projectile(Sprite sprite, Vector2 position, bool facingRight, PartyMember actor, PartyMember target, float speed, Action<Projectile> collisionCallback) : base(sprite, position) { if (actor == null) throw new Exception("PartyMember actor cannot be null"); if (target == null) throw new Exception("PartyMember target cannot be null"); if (collisionCallback == null) throw new Exception("Action<Projectile> collisionCallback cannot be null"); this.actor = actor; this.target = target; this.collisionCallback = collisionCallback; Vector2 directionVector = target.BattleEntity.GetCenter() - GetCenter(); distance = directionVector.Length(); directionVector.Normalize(); Velocity = speed * directionVector; Rotation = (facingRight ? 0.0f : MathHelper.Pi) + (float)Math.Atan2(directionVector.Y, directionVector.X); collided = false; }
public Scenery(Sprite sprite, Vector2 position) : base(sprite, position) { }