Ejemplo n.º 1
0
 public void enter(MonsterUnit enemy)
 {
     self          = enemy;
     target        = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent <Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
Ejemplo n.º 2
0
 public void enter(MonsterUnit enemy)
 {
     self = enemy;
     target = GameObject.FindGameObjectWithTag("Player").transform;
     selfRigidbody = self.GetComponent<Rigidbody>();
     attackHandler(self.centerPoint.spawnMonsterType.name);
 }
Ejemplo n.º 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);
    }