// 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>(); }
/* public Light2D pointLight; */ // Start is called before the first frame update void Awake() { Debug.Log(PlayerPrefs.GetInt("lv" + SceneManager.GetActiveScene().buildIndex)); loadSceneScript = GameObject.FindGameObjectWithTag("loadScene").GetComponent <loadScenes>(); animator = GetComponent <Animator>(); if (light) { animator.SetBool("start", true); } }
private void Start() { FindObjectOfType <audio_manager>().stop("japanMusic"); FindObjectOfType <audio_manager>().Play("wind"); /* PlayerPrefs.DeleteAll(); */ /* change icons status */ int countScore = 0; for (int i = 2; i < buttons.Count; i++) { int score = PlayerPrefs.GetInt("lv" + i); countScore += score; Transform coinParent = buttons[i - 2].transform.GetChild(1); for (int j = 0; j < score; j++) { coinParent.transform.GetChild(j).GetComponent <Image>().color = activeColor; } } totalScore.text = "* " + countScore; for (int i = 1; i < buttons.Count; i++) { int previewLevelNum = int.Parse(buttons[i].name) - 1; int score = PlayerPrefs.GetInt("lv" + previewLevelNum); if (score > 0) { buttons[i].GetComponent <Image>().color = activeColor; buttons[i].interactable = true; } else { buttons[i].GetComponent <Image>().color = lockedColor; } } loadSceneScript = GameObject.FindGameObjectWithTag("loadScene").GetComponent <loadScenes>(); }
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); } }
// Start is called before the first frame update void Start() { loadScene = GameObject.FindGameObjectWithTag("loadScene").GetComponent <loadScenes>(); }