Пример #1
0
    private void continousHitSignal()
    {
        OnEnemyHit.HitDetails hitDetails = new OnEnemyHit.HitDetails();
        hitDetails.damageAmount = damageAmount;
        hitDetails.hitPoint     = transform.position;
        hitDetails.hitSfx       = hitSoundEffect;

        OnEnemyHit oehScript = player.GetComponent <OnEnemyHit>();

        oehScript.triggerDelegate(hitDetails);
    }
Пример #2
0
    public void OnTriggerStay2D(Collider2D collision)
    {
        // Check if we collided with the player.
        if (collision.gameObject == player && stats.status != EnemyStatus.StatusType.bouncing)
        {
            rb.velocity  = Vector2.zero;
            stats.status = EnemyStatus.StatusType.bouncing;
            //Send the hit signal.
            OnEnemyHit.HitDetails hitDetails = new OnEnemyHit.HitDetails();
            hitDetails.damageAmount = damageAmount;
            hitDetails.hitPoint     = transform.position;
            hitDetails.hitSfx       = hitSoundEffect;

            OnEnemyHit oehScript = player.GetComponent <OnEnemyHit>();
            oehScript.triggerDelegate(hitDetails);
            BounceBack();
        }
    }