Example #1
0
    //Spawn a random prefab from the editor-populated list, assign it as the actice script and set _generated bool
    void SpawnEnemy()
    {
        var enemyType = Random.Range(0, _enemyDatabase.Count);
        var newEnemy  = (GameObject)Instantiate(_enemyDatabase[enemyType], transform.position, Quaternion.identity);

        _spawnScript            = newEnemy.GetComponent <EnemyWM>();
        _spawnScript._thisSpawn = gameObject.GetComponent <SpawnPoint>();
        _generated = true;
    }
Example #2
0
 void Start()
 {
     _parentScript = transform.GetComponentInParent <EnemyWM>();
 }
Example #3
0
 void Start()
 {
     _thisScript   = gameObject.GetComponent <PlayerSpotted>();
     _parentScript = transform.GetComponentInParent <EnemyWM>();
     _saveGame     = GameObject.Find("Loader").GetComponent <SaveGame>();
 }