void Start() { Error(); if (node) { spawn = node.GetComponent <spawnSoul> (); if (!spawn) { Debug.LogError("spawn (node) is null (pathFinding)"); } StartCoroutine(WaitStart()); InvokeRepeating("UpdateTarget", timeStart, timeRepeat); } enemy = GetComponent <enemyController> (); if (!enemy) { Debug.LogError("enemy (enemyController) is null (pathFinding)"); } rotate = transform.eulerAngles.z; isStart = false; path = new List <tileMap.Node> (); open = new List <tileMap.Node> (); close = new List <tileMap.Node> (); }
void Start() { Error(); if (map) { soul = map.GetComponent <spawnSoul> (); score = map.GetComponent <scoreManager> (); if (!soul) { Debug.LogError("soul (map) is null (chapterManager)"); } if (!score) { Debug.LogError("score (map) is null (chapterManager)"); } else { if (score.isExplore == 0) { TextEnabled(textStart [0]); } else { isExplore = true; } } } audioSource = GetComponent <AudioSource> (); if (!audioSource) { Debug.LogError("audioSource (AudioSource) is null (chapterManager)"); } for (int i = 0; i < isSpawnYellowSoul.Length; i++) { isSpawnYellowSoul [i] = false; } }
void Start() { Error(); if (map) { node = map.GetComponent <tileMap> (); score = map.GetComponent <scoreManager> (); spawn = map.GetComponent <spawnSoul> (); status = map.GetComponent <gameOver> (); if (!score) { Debug.LogError("score (map) is null (heroController)"); } if (!status) { Debug.LogError("status (map) is null (heroController)"); } if (!spawn) { Debug.LogError("spawn (map) is null (heroController)"); } if (!node) { Debug.LogError("node (map) is null (heroController)"); } else { ChangeNode(); } } if (teleport) { isTeleport = true; imgTeleport = teleport.GetComponent <Image> (); btnTeleport = teleport.GetComponent <Button> (); if (!imgTeleport) { Debug.LogError("imgTeleport (teleport) is null (heroController)"); } else { imgTeleport.fillAmount = 0f; } if (!btnTeleport) { Debug.LogError("btnTeleport (teleport) is null (heroController)"); } else { btnTeleport.interactable = false; } } if (explore) { if (score.isExplore == 1) { Destroy(explore); } else { imgExplore = explore.GetComponent <Image> (); if (!imgExplore) { Debug.LogError("imgExplore (explore) is null (heroController)"); } else { imgExplore.fillAmount = 1f; } } } if (scoreDisplay) { scoreDisplay.text = "0"; } anim = GetComponent <Animator> (); audioSource = GetComponent <AudioSource> (); if (!anim) { Debug.LogError("anim (Animator) is null (heroController)"); } if (!audioSource) { Debug.LogError("audioSource (AudioSource) is null (heroController)"); } isMove = false; world.x = Screen.width / 2; world.y = Screen.height / 2; speed = speedStart; rotate = transform.eulerAngles.z; maxOpenPath = node.nodeOpen.Count; if (rotate == 0f) { direct = Vector2.up; } else if (rotate == 90f) { direct = Vector2.left; } else if (rotate == 180f) { direct = Vector2.down; } else if (rotate == 270f) { direct = Vector2.right; } InvokeRepeating("TeleportReload", 0, 1f); }