예제 #1
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.CompareTag("Player"))
        {
            Character_Behaviour playerBehaviour = col.gameObject.GetComponentInParent <Character_Behaviour>();

            float differenceX = col.bounds.center.x - GetComponent <Collider2D>().bounds.center.x;

            playerBehaviour.TakeDamage(damage, differenceX, "Ranged", playerAnimData);
        }
    }
예제 #2
0
    private void OnTriggerEnter2D(Collider2D col)
    {
        if (col.gameObject.CompareTag("Character_Reflect") && col.GetComponentInParent <Character_Behaviour>().withKnife)
        {
            bulletSpeed          = -3f;
            spriteRenderer.flipX = true;
        }

        if (col.gameObject.CompareTag("Player"))
        {
            Character_Behaviour playerBehaviour = col.gameObject.GetComponentInParent <Character_Behaviour>();

            float differenceX = col.bounds.center.x - GetComponent <Collider2D>().bounds.center.x;

            playerBehaviour.TakeDamage(damage, differenceX, "Ranged", playerAnimData);

            Destroy(this.gameObject);
        }
    }
예제 #3
0
 void Awake()
 {
     behaviour = GetComponent <Character_Behaviour>();
 }