// 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>(); }
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); }
// Use this for initialization void Start() { lastSpawnTime = Time.time; gameManager = GameObject.Find("GameManager").GetComponent <GameManagerBehavior_PLA>(); }
// Use this for initialization void Start() { SoundPlace = GetComponent <AudioSource>(); gameManager = GameObject.Find("GameManager").GetComponent <GameManagerBehavior_PLA>(); }