// Use this for initialization
    void Start()
    {
        spawner       = GameObject.Find("Road");
        SpawnerScript = spawner.GetComponent <SpawnEnemy_PLA>();
        startTime     = Time.time;
        distance      = Vector2.Distance(startPosition, targetPosition);
        GameObject gm = GameObject.Find("GameManager");

        gameManager = gm.GetComponent <GameManagerBehavior_PLA>();
    }
예제 #2
0
    IEnumerator Attack()
    {
        destroyed = true;
        SpawnerScript.EnemiesKilled = SpawnerScript.EnemiesKilled + 1;

        // AudioSource audioSource = gameObject.GetComponent<AudioSource>();
        //AudioSource.PlayClipAtPoint(audioSource.clip, transform.position);
        GameManagerBehavior_PLA gameManager = GameObject.Find("GameManager").GetComponent <GameManagerBehavior_PLA>();

        gameManager.Health -= 1;
        damageSound.Play();
        yield return(new WaitForSeconds(2));

        Destroy(gameObject);
    }
예제 #3
0
 // Use this for initialization
 void Start()
 {
     lastSpawnTime = Time.time;
     gameManager   = GameObject.Find("GameManager").GetComponent <GameManagerBehavior_PLA>();
 }
예제 #4
0
 // Use this for initialization
 void Start()
 {
     SoundPlace  = GetComponent <AudioSource>();
     gameManager = GameObject.Find("GameManager").GetComponent <GameManagerBehavior_PLA>();
 }