Created
March 4, 2018 21:41
-
-
Save giljr/480664e225971acd951bff3567806e9f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class EnemyController : MonoBehaviour { | |
public Soldier[] Enemies; | |
// Use this for initialization | |
void Start () { | |
/* transfered to the Update() | |
* foreach (Soldier Enemy in Enemies) | |
{ | |
Enemy.Activate(); | |
}*/ | |
} | |
// Update is called once per frame | |
void Update () { | |
foreach (Soldier enemy in Enemies) | |
{ | |
//Enemy.Activate(); | |
//If not active, return, so I do not activate another one | |
if(enemy.IsActive) | |
{ | |
return; | |
} | |
} | |
//TODO: Check if the soldier are active | |
int idxSoldier = Random.Range(0, Enemies.Length); | |
Enemies[idxSoldier].Activate(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment