示例#1
0
    private void getHurtEffect()
    {
        Vector3 effectSpawn = physics.transform.position;

        effectSpawn.y += 1;

        Instantiate(slashEffect, effectSpawn, Quaternion.Euler(new Vector3(0, 0, 0)));


        FollowCam2D camComponent = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <FollowCam2D>();

        camComponent.SendMessage("Shake", 0.2);
    }
示例#2
0
    void OnTriggerStay(Collider other)
    {
        if (other.tag == "Enemy")
        {
            bool didHit = false;
            foreach (Collider col in alreadyHit)
            {
                if (other.Equals(col))
                {
                    didHit = true;
                    break;
                }
            }
            if (!didHit)
            {
                alreadyHit.Add(other);
                Vector3 effectSpawn = other.transform.position;

                Enemy_Combat enemyCombat = other.GetComponent <Enemy_Combat>();
                if (enemyCombat != null)
                {
                    effectSpawn.y += enemyCombat.effectShift_Y;
                }

                Instantiate(slash, effectSpawn, Quaternion.Euler(new Vector3(0, 0, 0)));
                Instantiate(bloodSplat, effectSpawn, Quaternion.Euler(new Vector3(0, 0, 0)));
                other.gameObject.SendMessage("getHurt", damage);
                other.gameObject.SendMessage("knockBack");

                FollowCam2D camComponent = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <FollowCam2D>();
                camComponent.SendMessage("Shake", 0.05);

                //Destroy(gameObject,0.1f);
            }
        }

        if (other.tag == "Soul" && alreadyHit.Count == 0)
        {
            alreadyHit.Add(other);
            SoulMovement soul = other.GetComponent <SoulMovement>();
            soul.destroySoul();
        }
    }