public Collectible SpawnCollectible(Reward reward) { Collectible collectible = new CollectibleReward(reward); gameControl.RoomControl.SpawnEntity(collectible); return(collectible); }
//----------------------------------------------------------------------------- // Reward Methods //----------------------------------------------------------------------------- public void SpawnReward() { if (!IsLooted) { string rewardName = Properties.GetString("reward", "rupees_1"); Reward reward = RoomControl.GameControl.RewardManager.GetReward(rewardName); CollectibleReward collectible = new CollectibleReward(reward); collectible.Collected += delegate() { Properties.Set("looted", true); }; // Spawn the reward collectible. RoomControl.SpawnEntity(collectible); collectible.SetPositionByCenter(Center); if (Properties.GetBoolean("spawn_from_ceiling", false)) { collectible.ZPosition = Center.Y + 8; collectible.Physics.HasGravity = true; collectible.Physics.CollideWithWorld = RoomControl.IsSideScrolling; } else { collectible.Physics.CollideWithWorld = false; collectible.Physics.HasGravity = false; collectible.Physics.IsDestroyedInHoles = false; collectible.Physics.IsDestroyedOutsideRoom = false; } } }
//----------------------------------------------------------------------------- // Rewards //----------------------------------------------------------------------------- public Collectible SpawnCollectibleFromBreakableTile(Reward reward, Point2I position) { Collectible collectible = new CollectibleReward(reward); gameControl.RoomControl.SpawnEntity(collectible); collectible.Position = position; collectible.Physics.ZVelocity = 1.5f; return(collectible); }