Exemplo n.º 1
0
 private void OnCollisionEnter2D(Collision2D collision)
 {
     if (collision.transform.CompareTag("Player"))
     {
         PlayerHealt playerHealt = collision.transform.GetComponent <PlayerHealt>();
         playerHealt.TakeDamage(damageOnCollision);
     }
 }
Exemplo n.º 2
0
	// Use this for initialization
	void Awake () {
		//get agent
		agent = GetComponent<NavMeshAgent>();
		//find player in scene
		igralec = GameObject.Find("Igralec");
		playerHealt = igralec.GetComponent<PlayerHealt>();
		trenutniTime = timeAttack;
		attackSound = GetComponent<AudioSource>();
	}
Exemplo n.º 3
0
    private void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("il y a plus d'une instance de PlayerHealt dans la scéne");
            return;
        }

        instance = this;
    }