void Awake() { weaveCount.text = ""; highScoreText.text = ""; gameOverText.text = ""; gameManager = GameObject.FindGameObjectWithTag("GameManager"); gameManagerScript = gameManager.GetComponent <GameManager>(); gameManagerScript.Load(); playAdd = GetComponent <PlayAdd>(); GameOverWindow.SetActive(false); PauseWindow.SetActive(false); DisableScoreText(); PrepareGame(); playAdd.InitializeAdd(); //Debug.Log(numberOfAllGames); hazardCount = 4;//era 3 missleCount = 5; spawnPositionx = 20; spawnPositiony = 15; gameOver = true; count = 1; UpdateScore(count); platformMove = platforma.GetComponent <PlatformMove>(); platformMove.enabled = false; platformReSize = platforma.GetComponent <PlatformReSize>(); platformReSize.enabled = false; platformMovingLeftInstantiate = GetComponent <PlatformMovingLeftInstantiate>(); playerController = player.GetComponent <PlayerController>(); playerControllerV2 = player.GetComponent <PlayerControllerV2>(); platformMovingLeftInstantiate.enabled = false; StartCoroutine(StartWaves()); pause = false; }
void Start() { hpBoss = 120; gameController = GameObject.FindGameObjectWithTag("GameController"); gameControllerScript = gameController.GetComponent <GameController>(); player = GameObject.FindGameObjectWithTag("Player"); playerControllerV2 = player.GetComponent <PlayerControllerV2>(); circleCollider2d = GetComponent <CircleCollider2D>(); DmgReceived = false; timerDmg = 0; timerAnimation = 0; playerControllerTimer = 0; enemydestroy = true; moving = false; destroyBoss = false; spriteRenderer = GetComponent <SpriteRenderer>(); nextPosition = Vector2.zero; points[0] = new Vector3(-11f, 5f, 0f); points[1] = new Vector3(0f, 5f, 0f); points[2] = new Vector3(11f, 5f, 0f); points[3] = new Vector3(-11f, 0f, 0f); points[4] = new Vector3(0f, 0f, 0f); points[5] = new Vector3(11f, 0f, 0f); blinkNumber = 0; lastPosition = 2; maxTimerDmg = 0.1f; changeImage = true; movingTimer = 0; anim = GetComponent <Animator>(); explosionCount = 0; }
/*Main Logic of DialogSystem*/ private void StartTalkCoroutine(PlayerControllerV2 pc, GameObject go) { NPC npc = go.GetComponent <NPC>(); if (npc != null) { StartCoroutine(TalkCoroutine(pc, npc)); } }
void Awake() { rb2d = GetComponent <Rigidbody2D>(); gameControllerScript = gameController.GetComponent <GameController>(); playerControllerV2 = GetComponent <PlayerControllerV2>(); playerControllerV2.enabled = false; destroy = false; jumpNumber = 0; jumpDestroy = false; faceRight = false; pause = false; resume = false; dash = false; timerDash = 0; dashSpeed = 1; timergoDown = 0; goDown = false; //timergoUp = 0; //goUp = false; }
void Start() { playerController = GetComponent <PlayerControllerV2>(); }
private void Start() { playerController = GetComponentInParent <PlayerControllerV2>(); healthbar = GetComponentInParent <HealthBar>(); }
// Start is called before the first frame update void Start() { player = FindObjectOfType <PlayerControllerV2>(); }
IEnumerator TalkCoroutine(PlayerControllerV2 pc, NPC npc) { int lineNumber = 0; ShowDialogUi(); imageCon1.SetActive(true); imageCon1.GetComponent <Image>().sprite = npc.img; imageCon2.SetActive(true); imageCon2.GetComponent <Image>().sprite = pc.img; dialog.text = npc.printDialog(lineNumber); lineNumber++; npc.oldState = npc.state; npc.state = NPC.NPC_state.STAY; while (true) { npc.ChangeState(NPC.NPC_state.STAY); //Gets "string" reference to choise when curser moves. if (npc.waitForChoise(lineNumber)) { options = npc.printDialog(lineNumber).Split(' '); for (int index = 1; index < options.Length; index++) { string[] opAndlocation = options[index].Split(':'); choices.transform.GetChild(index - 1).GetComponentInChildren <Text>().text = opAndlocation[0]; } choices.SetActive(true); choiceFlag = true; lineNumber++; } //Progress dialog if (Input.GetKeyDown(KeyCode.G)) { if (npc.printDialog(lineNumber) == null) { HideDialogUi(); pc.state = PlayerControllerV2.CharState.NORMAL; if (npc != null) { npc.ResetPosition(); pc.ResetPosition(); npc.RevertState(); } break; } //Enter choise if (choiceFlag) { for (int index = 1; index < options.Length; index++) { string[] choiceAndlocation = options[index].Split(':'); if (choiceAndlocation[0] == slection.getSelection()) { lineNumber = Int32.Parse(choiceAndlocation[1]); // linenumber-1 because .txt file is not zero index. dialog.text = npc.printDialog(lineNumber - 1); } } choiceFlag = false; choices.SetActive(false); } else { dialog.text = npc.printDialog(lineNumber); lineNumber++; } } // End dialog if (Input.GetKeyDown(KeyCode.X)) { HideDialogUi(); pc.state = PlayerControllerV2.CharState.NORMAL; if (npc != null) { npc.ResetPosition(); npc.RevertState(); } break; } yield return(null); } npc.state = npc.oldState; npc.RevertState(); }
private void Start() { player = GameObject.FindGameObjectWithTag("player").GetComponent <PlayerControllerV2>(); }