Пример #1
0
        public MonsterMoveController[] CreateMonsters(World world, MapLevelDetails map)
        {
            MonsterPosition monster1      = new MonsterPosition(map, world);
            MonsterStats    statsMonster1 = new MonsterStats("rabbit");

            monster1.MoveTo(151, statsMonster1);
            MonsterPosition monster2      = new MonsterPosition(map, world);
            MonsterStats    statsMonster2 = new MonsterStats("rabbit");

            monster2.MoveTo(152, statsMonster2);
            MonsterPosition monster3      = new MonsterPosition(map, world);
            MonsterStats    statsMonster3 = new MonsterStats("rabbit");

            monster3.MoveTo(177, statsMonster3);
            MonsterPosition monster4      = new MonsterPosition(map, world);
            MonsterStats    statsMonster4 = new MonsterStats("cat");

            monster4.MoveTo(60, statsMonster4);
            MonsterPosition monster5      = new MonsterPosition(map, world);
            MonsterStats    statsMonster5 = new MonsterStats("cat");

            monster5.MoveTo(36, statsMonster5);
            MonsterPosition monster6      = new MonsterPosition(map, world);
            MonsterStats    statsMonster6 = new MonsterStats("cat");

            monster6.MoveTo(37, statsMonster6);
            MonsterMoveController[] monsters = new MonsterMoveController[6];
            monsters[0] = new MonsterMoveController(monster1, statsMonster1);
            monsters[1] = new MonsterMoveController(monster2, statsMonster2);
            monsters[2] = new MonsterMoveController(monster3, statsMonster3);
            monsters[3] = new MonsterMoveController(monster4, statsMonster4);
            monsters[4] = new MonsterMoveController(monster5, statsMonster5);
            monsters[5] = new MonsterMoveController(monster6, statsMonster6);
            return(monsters);
        }
    public IEnumerator MoveOneByOne(List <Monster.Simbol> simbol, MonsterMoveController.Color color)
    {
        for (int k = 0; k < simbol.Count; k++)
        {
            //Debug.Log("Simbol : " + simbol[k] + "   Color : " + color);

            for (int i = 0; i < monsters.Count; i++)
            {
                if (monsters[i].simbol == simbol[k])
                {
                    //Debug.Log(monsters[i] + " is move Start");

                    MonsterMoveController moveCtrl = monsters[i].GetComponent <MonsterMoveController>();

                    // 카메라 focus 몬스터에게 이동
                    MaincameraController.instance.ChangeTarget(monsters[i].gameObject);

                    IEnumerator coroutine = moveCtrl.MoveEachType(color);
                    yield return(StartCoroutine(coroutine));

                    MaincameraController.instance.ChangeTarget(FindObjectOfType <Character>().gameObject);
                    Debug.Log(monsters[i] + " is move finished");
                }
            }
        }
        yield return(null);
    }
        public void MoveTo(int movement)
        {
            DirectionChecker checker = new DirectionChecker(_world);

            if (checker.CanPlayerMoveInDirection(Map.Map[NumberOfArrayPlayerIsIn + movement]))
            {
                Changed = true;
                OldNumberOfArrayPlayerIsIn = NumberOfArrayPlayerIsIn;
                NumberOfArrayPlayerIsIn   += movement;
                MonsterMoveController[] monsters;
                if (_world.Has <MonsterMoveController[]>())
                {
                    monsters = _world.Get <MonsterMoveController[]>();
                }
                else
                {
                    monsters = new MonsterMoveController[1];
                }

                if (monsters.Length > 1)
                {
                    foreach (var monster in monsters)
                    {
                        if (monster.MonsterPosition.NumberOfArrayMonsterIsIn == NumberOfArrayPlayerIsIn)
                        {
                            _world.LinesTypedInMessageBox++;
                            MoveMessages message = new MoveMessages(_world);
                            message.MonstersInRoomMessage(monster.MonsterStats.Name);
                        }
                    }
                }
            }
        }