コード例 #1
0
ファイル: BombScript.cs プロジェクト: arvindsouza/Apeocalypse
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.tag == "Player" && this.tag != "PlayerProjectile")
     {
         Destroy(gameObject);
         PlayerHealth = FindObjectOfType <ApeHealth>();
         PlayerHealth.AddDamage(damage);
     }
 }
コード例 #2
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     if (coll.tag == "Player")
     {
         player = FindObjectOfType <ApeHealth>();
         player.AddDamage(player.MaxHealth);
     }
     else if (coll.tag == "Enemy")
     {
         enemy = FindObjectOfType <EnemyHealth>();
         enemy.addDamage(enemy.maxhealth);
     }
 }
コード例 #3
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.tag == "Enemy" && this.tag != "EnemyProjectile")
        {
            //  Debug.Log(coll.tag);
            EnemyHealth enem = coll.gameObject.GetComponent <EnemyHealth>();
            enem.addDamage(damage);
        }

        if (coll.tag == "Player" && this.tag != "PlayerProjectile")
        {
            ApeHealth ape = coll.gameObject.GetComponent <ApeHealth>();
            ape.AddDamage(damage);
        }
    }
コード例 #4
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        if (coll.gameObject.layer == 8)
        {
            Debug.Log(dog.transform.localRotation.z);
            if (dog.transform.localRotation.z < 0)
            {
                dog.transform.localRotation = Quaternion.Euler(new Vector3(0, 0, 0));
            }
            else
            {
                dog.transform.localRotation = Quaternion.Euler(new Vector3(0, 180, 0));
            }
        }

        if (coll.tag == "Player")
        {
            ApeHealth ape = coll.gameObject.GetComponent <ApeHealth>();
            ape.AddDamage(damage);
        }
    }