Exemple #1
0
        private Monster AddMonster(Game game, Breed breed, VectorBase position)
        {
            if (ActorAt(position) != null)
            {
                throw new ApplicationException("Cannot add two actors at the same spot");
            }
            var monster = breed.Spawn(game, position);

            AddActor(monster);
            return(monster);
        }
Exemple #2
0
        public override ActionResult OnPerform()
        {
            // There's a chance the move will do nothing (except burn charge) based on
            // the monster's generation. This is to keep breeders from filling the
            // dungeon.
            if (!Rng.Instance.OneIn(Monster.Generation))
            {
                return(ActionResult.Success);
            }

            // Increase the generation on the spawner too so that its rate decreases
            // over time.
            Monster.Generation++;

            var spawned = _breed.Spawn(Game, _pos, Monster);

            Game.CurrentStage.AddActor(spawned);

            AddEvent(EventType.Spawn, spawned, ElementFactory.Instance.None, null, null, null);

            // TODO: Message?
            return(ActionResult.Success);
        }