示例#1
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (gameObject.name == "HitCollider" && other.gameObject.CompareTag("Player"))
        {
            PlayerMovement_v2 playerControl = other.GetComponent <PlayerMovement_v2>();

            playerControl.SpawnHitEffect();
            playerControl.isInInvincible = true;
            playerControl.hitAudio.Play();
            playerControl.playerHealth -= 1f;
        }
    }
示例#2
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            PlayerMovement_v2 playerControl = other.GetComponent <PlayerMovement_v2>();

            playerControl.SpawnHitEffect();
            playerControl.hitAudio.Play();
            playerControl.GetComponent <BoxCollider2D>().enabled = false;
            playerControl.isInInvincible = true;
            playerControl.playerHealth  -= 1;
            Destroy(gameObject);
        }
    }
示例#3
0
 public void SetDirection(Vector3 _direction, PlayerMovement_v2 incomingScript)
 {
     direction      = _direction;
     playerMovement = incomingScript;
 }