Пример #1
0
    public void Init(MonsterSpawner monsterSpawner, Player enemy, MonsterStatsPanelController statsPanelController)
    {
        MonsterSpawner = monsterSpawner;
        Enemy          = enemy;
        int counter = 0;

        Monsters = new List <GameObject>();

        List <Vector3> positions = new List <Vector3>()
        {
            new Vector3(0f, -40f, 0f),
            new Vector3(30f, -30f, 0f),
            new Vector3(40f, 0f, 0f)
        };


        for (int i = 0; i < 3; i++)
        {
            GameObject monster = MonsterSpawner.Spawn(statsPanelController);
            monster.transform.SetParent(transform);
            Enemy.ChooseMonster(monster.GetComponent <MonsterController>().Monster);
            Monsters.Add(monster);

            monster.transform.localPosition = positions[counter];
            monster.transform.localScale    = new Vector3(.8f, .8f);

            counter++;
        }
    }
Пример #2
0
    private void SetMonster(Transform player)
    {
        MonsterSpawner monsterSpawner = null;

        // 스폰
        for (int i = 0; i < _monsterSpawners.Length; i++)
        {
            //조건
            monsterSpawner = _monsterSpawners[i].GetComponent <MonsterSpawner>();
            MonsterKind[] spawnKinds = monsterSpawner._SpawnKind;

            List <GameObject[]> spawnMonsters = new List <GameObject[]>();
            for (int j = 0; j < spawnKinds.Length; ++j)
            {
                MonsterKind kind = MonsterKind.NONPASS;
                switch (spawnKinds[j])
                {
                case MonsterKind.SLIME:           kind = MonsterKind.SLIME;           break;

                case MonsterKind.SKELETONWARRIOR: kind = MonsterKind.SKELETONWARRIOR; break;

                case MonsterKind.ICE_ELEMENTAL:   kind = MonsterKind.ICE_ELEMENTAL;   break;

                case MonsterKind.KINGSLIME:       kind = MonsterKind.KINGSLIME;       break;
                }
                spawnMonsters.Add(Utility.ConvertList2Array(Sort(kind)));
            }

            monsterSpawner.SetSpawnMonsters(spawnMonsters);
            monsterSpawner.Spawn(player);
        }
    }
Пример #3
0
        // ��������Ⱥϵ���еĹ���
        public virtual void SpawnMonster(IWorld world, IGrainFactory grainFactory, IChunkColumnStorage chunk, Random rand, BlockWorldPos pos)
        {
            ChunkWorldPos chunkPos = pos.ToChunkWorldPos();
            int           seed     = chunkPos.Z * 16384 + chunkPos.X;
            Random        r        = new Random(seed);

            foreach (MobType eachType in _monsterList)
            {
                if (r.Next(64) == 0)
                {
                    MonsterSpawner spawner = new MonsterSpawner(eachType, 3);
                    spawner.Spawn(world, grainFactory, chunk, rand, new BlockWorldPos(pos.X, pos.Y, pos.Z));
                }
            }
        }
Пример #4
0
    //OnState functions definition

    void OnStateMonsterPhase()
    {
        if (isFirstFrame)
        {
            foreach (Player p in Players)
            {
                p.ResetPlayers();
            }
            _ui.ChangeRightButtonText("Attack");
            _ui.ResetPlayerKeywordText();
            _ui.RefreshInMonsterPhase();
            _spawner.Spawn();
            timer = 0.0f;
        }

        if (timer >= 30.0f || Input.GetKeyDown(KeyCode.Alpha1))
        {
            Debug.Log("State changed (-->Cast)");
            nextState = State.CastPhase;
        }
    }
Пример #5
0
 protected override void _OnDeath()
 {
     _monsterSpawner.Spawn();
     base._OnDeath();
 }