Exemple #1
0
    private void OnTriggerEnter(Collider other)
    {
        //Check if collided with an Attributes Script
        IAttributes otherAttributes = other.GetComponent <IAttributes>();

        if (otherAttributes != null && otherAttributes.IsDead() == false)
        {
            //Damage other
            if (otherAttributes.TakeDamage(damage, true))
            {
                //If other died and is lockOn target return camera to default
                //lockOnScript.TargetDead(other.transform);

                //Recieve Power
                playerAttributes.RecivePower(powerRecivedOnHit);
            }

            //Camera Shake
            CameraShaker.Instance.ShakeOnce(1, 0.5f, 0.2f, 0.1f);

            //Slow Game for a small time on hit
            StopCoroutine("SlowTime");
            StartCoroutine("SlowTime");
        }

        if (other.gameObject.name.Equals("Fireball"))
        {
            playerAttributes.TakeDamage(damage, true);
        }
    }