示例#1
0
 public void enter(MonsterUnit enemy)
 {
     self          = enemy;
     target        = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent <Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
示例#2
0
文件: Attack.cs 项目: hsinpa/Erisle
 public void enter(MonsterUnit enemy)
 {
     self = enemy;
     target = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent<Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
示例#3
0
    public void CompleteGenerate(bool monsters = true)
    {
        if (monsters)
        {
            List <Transform> possiblePositions = new List <Transform>(monsterPositions);
            int monsterCount = Random.Range(minMonsters, maxMonsters + 1);
            for (int i = 0; i < monsterCount && i < monsterPositions.Length; i++)
            {
                int       index = Random.Range(0, possiblePositions.Count);
                Transform t     = possiblePositions[index];
                possiblePositions.RemoveAt(index);

                MonsterUnit prefab = monsterPrefabs[Random.Range(0, monsterPrefabs.Length)];
                MonsterUnit unit   = Instantiate(prefab, t.position, t.rotation);
                unit.GetComponent <UnitMovementController>().Enable();
                unit.transform.parent = t;
                spawnedMonsters.Add(unit);
            }
        }
        GetComponentInChildren <NavMeshLink>(true).gameObject.SetActive(true);
    }