コード例 #1
0
ファイル: MDRMonsterInstance.cs プロジェクト: bsimser/CoM
        /**
         * Create a new monster instance of given type.
         *
         * @param monsterType The type of monster to spawn.
         *
         */
        public static MDRMonsterInstance Create(MDRMonster monsterType)
        {
            var result = new MDRMonsterInstance();

            result.MonsterType = monsterType;
            return(result);
        }
コード例 #2
0
        //--------------------------------------------------------------------------------------------------------
        // Private
        //--------------------------------------------------------------------------------------------------------

        /**
         * Places a new instance of specific monster at a random location in this area. Will return with null if no
         * spaces are avalaible in this area.
         */
        private MDRMonsterInstance placeMonster(MDRMonster monster)
        {
            if (monster == null)
            {
                return(null);
            }

            var location = getNextEmptyTile();

            if (location.Floor == -1)
            {
                return(null);
            }

            var instance = MDRMonsterInstance.Create(monster);

            CoM.State.AddMonster(instance, this, location);
            return(instance);
        }