コード例 #1
0
ファイル: TankView.cs プロジェクト: outscal/BattleGame
 public void TakeDamage(float damage)
 {
     enemies_killed++;
     Debug.Log("Damage Caused: " + damage);
     Destroy(gameObject);
     tankController.ApplyDamage(damage);
 }
コード例 #2
0
    private void OnCollisionEnter(Collision col)
    {
        TankController tank = col.collider.GetComponentInParent <TankController>();

        if (tank != null && tank != Owner)
        {
            tank.ApplyDamage(Damage);
        }

        if (tank == Owner)
        {
            return;
        }

        var instance = Instantiate(deathParticles, transform.position, Quaternion.identity);

        Destroy(instance, 3f);

        Destroy(gameObject);
    }
コード例 #3
0
 public void TakeDamage(BulletType bulletType, int damage)
 {
     Debug.Log("Taking damage: " + damage + "from bullet: " + bulletType);
     tankController.ApplyDamage(bulletType, damage);
 }
コード例 #4
0
    // Update is called once per frame

    public void TakeDamage(float damage)
    {
        tankController.ApplyDamage(damage);
    }