コード例 #1
0
ファイル: EnemyDamage.cs プロジェクト: Vegasflash/VegaBot2D
    void OnTriggerEnter(Collider collider)
    {
        if (collider.gameObject.tag == "WindWalker")
        {
            healthScript.DamageHealth(enemyDmg);
        }
        if (collider.gameObject.tag == "Sage")
        {
            healthScript.DamageHealth(enemyDmg);
        }
        if (collider.gameObject.tag == "Warrior")
        {
            healthScript.DamageHealth(enemyDmg);
        }
        if (collider.gameObject.tag == "Ninja")
        {
            healthScript.DamageHealth(enemyDmg);
        }

        if (collider.gameObject.tag == "Projectile")
        {
            enemyHealth.DamageHealth(rangedPlayerDamage);
            Destroy(collider.gameObject);
        }
    }
コード例 #2
0
 void OnTriggerEnter(Collider collider)
 {
     if (collider.gameObject.tag == "WindWalker")
     {
         Debug.Log("Dealing damage");
         healthScript.DamageHealth(damage);
     }
     if (collider.gameObject.tag == "Warrior")
     {
         Debug.Log("Dealing damage");
         healthScript.DamageHealth(damage);
     }
     if (collider.gameObject.tag == "Ninja")
     {
         Debug.Log("Dealing damage");
         healthScript.DamageHealth(damage);
     }
     if (collider.gameObject.tag == "Sage")
     {
         Debug.Log("Dealing damage");
         healthScript.DamageHealth(damage);
     }
 }