Exemple #1
0
 // Start is called before the first frame update
 void Start()
 {
     ninja           = GameObject.FindGameObjectWithTag("ninja");
     cameraShake     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>();;
     anim            = ninja.GetComponent <Animator>();
     ninjaCont       = ninja.GetComponent <ninjaControl>();
     loadSceneScript = GameObject.FindGameObjectWithTag("loadScene").GetComponent <loadScenes>();
 }
Exemple #2
0
    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "ninja")
        {
            CameraShake  cameraShake     = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <CameraShake>();;
            Animator     anim            = col.GetComponent <Animator>();
            ninjaControl ninjaCont       = col.GetComponent <ninjaControl>();
            loadScenes   loadSceneScript = GameObject.FindGameObjectWithTag("loadScene").GetComponent <loadScenes>();

            ninjaCont.alive           = false;
            cameraShake.shakeDuration = 1;
            anim.SetInteger("animstate", 6);
            loadSceneScript.LoadSameLevel();
        }

        if (col.tag == "shuraken")
        {
            Destroy(col.gameObject);
            takeDammage(1);
        }
    }