//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public CollectibleReward(Reward reward, bool isDrop = false) { this.reward = reward; this.showMessage = !reward.OnlyShowMessageInChest; this.hasDuration = reward.HasDuration; this.isCollectibleWithItems = reward.IsCollectibleWithItems; this.isDrop = isDrop; // Physics. Physics.CollisionBox = new Rectangle2I(-4, -9, 8, 8); Physics.SoftCollisionBox = new Rectangle2I(-5, -9, 9, 8); EnablePhysics( PhysicsFlags.Bounces | PhysicsFlags.HasGravity | PhysicsFlags.CollideRoomEdge | PhysicsFlags.CollideWorld | PhysicsFlags.HalfSolidPassable | PhysicsFlags.DestroyedInHoles); soundBounce = reward.BounceSound; // Graphics. centerOffset = new Point2I(0, -5); Graphics.DrawOffset = new Point2I(-8, -13); Graphics.RipplesDrawOffset = new Point2I(0, 1); Graphics.IsGrassEffectVisible = true; Graphics.IsRipplesEffectVisible = true; }
//----------------------------------------------------------------------------- // Rewards //----------------------------------------------------------------------------- public Collectible SpawnCollectibleFromBreakableTile(Reward reward, Point2I position) { Collectible collectible = new Collectible(reward); gameControl.RoomControl.SpawnEntity(collectible); collectible.Position = position; collectible.Physics.ZVelocity = 1.5f; return collectible; }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public RoomStateReward(Reward reward) { this.updateRoom = false; this.animateRoom = true; this.reward = reward; this.chestPosition = Point2I.Zero; this.useChest = false; this.timer = 0; this.animationPlayer = new AnimationPlayer(); }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Collectible(Reward reward) { EnablePhysics(PhysicsFlags.Bounces | PhysicsFlags.HasGravity | PhysicsFlags.DestroyedOutsideRoom | PhysicsFlags.CollideWorld | PhysicsFlags.HalfSolidPassable | PhysicsFlags.LedgePassable | PhysicsFlags.DestroyedInHoles); this.reward = reward; this.showMessage = false; this.timer = 0; this.Graphics.DrawOffset = new Point2I(-8, -8); }
public Collectible SpawnCollectible(Reward reward) { Collectible collectible = new Collectible(reward); gameControl.RoomControl.SpawnEntity(collectible); return collectible; }
public Reward AddReward(Reward reward) { if (!rewards.ContainsKey(reward.ID)) rewards.Add(reward.ID, reward); return rewards[reward.ID]; }
public Drop(Type entityType) { this.reward = null; this.entityType = entityType; }
public Drop(Reward reward) { this.reward = reward; this.entityType = null; }
//----------------------------------------------------------------------------- // Constructor //----------------------------------------------------------------------------- public Drop() { reward = null; entityType = null; }
public RoomStateReward(Reward reward, Point2I chestPosition) : this(reward) { this.chestPosition = chestPosition; this.useChest = true; }
public void AddDrop(int odds, Reward reward) { AddDrop(odds, new Drop(reward)); }