コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     Health = MaxHealth;
     rb     = GetComponent <Rigidbody2D>();
     scorer = FindObjectOfType <ScorePlayers>();
     OnDie.AddListener(() => scorer.EnemyKill(this));
 }
コード例 #2
0
    public void Die()
    {
        //LastDamagedBy.KillEnemy();

        if (GetComponent <Smash>())
        {
            GetComponent <Smash>().DoSmash();
        }
        else
        {
            Destroy(this.gameObject);
            scorer.EnemyKill(this);
        }
        OnDie.Invoke();
    }