void onClickTutorial() { AkSoundEngine.PostEvent("Play_UI_Valide", gameObject); AkSoundEngine.PostEvent("Stop_Music", gameObject); AkSoundEngine.PostEvent("Stop_Amb", gameObject); SceneSwitcher.SwitchScene("cinematic"); }
private void OnCollisionEnter2D(Collision2D collision) { PlayerUnit pyu = collision.gameObject.GetComponent <PlayerUnit>(); PlayerShrink ps = collision.gameObject.GetComponent <PlayerShrink>(); if (pyu || ps) { if (tutorial) { AkSoundEngine.PostEvent("Stop_Music", gameObject); SceneSwitcher.SwitchScene("PlayScene"); } else { //ScoreManager.nbOfWins++; SceneSwitcher.SwitchScene("Win", 2f, 1f); } } }
void onClickCheckpoint() { SceneSwitcher.SwitchScene("PlayScene"); }
void onClickRetry() { ScoreManager.bossDead = true; SceneSwitcher.SwitchScene("PlayScene"); }
void onClickMenu() { SceneSwitcher.SwitchScene("Menu"); }
public void backMenu() { SceneSwitcher.SwitchScene("Menu"); }
void onClickSubmit() { AkSoundEngine.PostEvent("Stop_Music", gameObject); ScoreManager.sendScore(name.text); //Add Name from submit text field SceneSwitcher.SwitchScene("Menu"); }
void onClickMenu() { AkSoundEngine.PostEvent("Stop_Music", gameObject); SceneSwitcher.SwitchScene("Menu"); }
private void Update() { if (!inPause) { #if UNITY_EDITOR // DEBUG if (Input.GetKey(KeyCode.Keypad0)) { GameObject tmp = Instantiate(unitPrefab, new Vector2(Random.Range(cursor.position.x - 0.1f, cursor.position.x + 0.1f), Random.Range(cursor.position.y - 0.1f, cursor.position.y + 0.1f)), Quaternion.identity, transform); AddUnit(tmp); } #endif velocity.x = Input.GetAxisRaw("Horizontal"); velocity.y = Input.GetAxisRaw("Vertical"); //velocity.Normalize(); if (Input.GetButtonDown("Fire1") && units.Count > 0 && cursorSpeed != cursorShrinkSpeed && !firstFramOut) { if (units.Count > 1) { PlayerUnit unit = units[0]; units.RemoveAt(0); unit.Suicide(); ScoreManager.nbPyuShot++; } } else if (firstFramOut) { firstFramOut = false; } if (Input.GetAxisRaw("Fire2") >= 0.8f && !inShrink) { cursorSpeed = cursorShrinkSpeed; cursorRadius = cursorShrinkRadius; unitSpeed = unitShrinkSpeed; //unitRadius = unitShrinkRadius; //Second version of shrink inShrink = true; shrinkUnit = Instantiate(shrinkPrefab, cursor.position, Quaternion.identity, transform); shrinkUnit.transform.localScale = new Vector3(shrinkUnit.transform.localScale.x / 2, shrinkUnit.transform.localScale.y / 2, shrinkUnit.transform.localScale.z); sizeRatio = shrinkUnit.transform.localScale.x; } else if (Input.GetAxisRaw("Fire2") <= 0.8f && inShrink) { cursorSpeed = cursorNormalSpeed; cursorRadius = cursorNormalRadius; unitSpeed = unitNormalSpeed; unitRadius = unitNormalRadius; Destroy(shrinkUnit); //Respawn pyus and change sprite back to cursor for (int i = 0; i < ShrinkUnits; i++) { float perim = Random.Range(0f, Mathf.PI); float dist = Random.Range(0f, cursorRadius); Instantiate(unitPrefab, cursor.position + new Vector3(Mathf.Cos(perim) * dist, Mathf.Sin(perim) * dist), Quaternion.identity, transform); } GetComponentsInChildren(units); inShrink = false; ShrinkUnits = 0; } if (inShrink) { //Kill all pyus and change cursor to a bigger pyu. Vector3 minDist = new Vector3(cursor.transform.position.x - cursorShrinkRadius, cursor.transform.position.y - cursorShrinkRadius, 0); Vector3 maxDist = new Vector3(cursor.transform.position.x + cursorShrinkRadius, cursor.transform.position.y + cursorShrinkRadius, 0); //V2 for (int i = 0; i < units.Count; i++) { if (units[i].transform.position.x <= maxDist.x && units[i].transform.position.x >= minDist.x && units[i].transform.position.y <= maxDist.y && units[i].transform.position.y >= minDist.y) { if (units.Count > 1) { float sizeNow = (float)ShrinkUnits / ((float)ShrinkUnits + (float)units.Count); shrinkUnit.transform.localScale = new Vector3(sizeRatio + (sizeRatio * sizeNow), sizeRatio + (sizeRatio * sizeNow), shrinkUnit.transform.localScale.z); } else if (units.Count == 1) { shrinkUnit.transform.localScale = new Vector3(sizeRatio + sizeRatio, sizeRatio + sizeRatio, shrinkUnit.transform.localScale.z); } Destroy(units[i].gameObject); ++ShrinkUnits; } } } } if (inPause) { velocity.x = 0; velocity.y = 0; } /*********** * Pause ***********/ if (Input.GetButtonDown("Pause")) { if (inPause) { switchPause(false); } else { switchPause(true); } } velocity *= cursorSpeed; //Le nombre d'unitées est obtenable avec units.Count AkSoundEngine.SetRTPCValue("PyuNumber", (units.Count + ShrinkUnits)); rtpcValue = Vector3.Distance(bossTransform.position, cursor.transform.position); AkSoundEngine.SetRTPCValue("ElectroFilter", rtpcValue); if (units.Count == 0 && (!inShrink || !shrinkUnit)) { ScoreManager.endTime = Time.time; ScoreManager.bossDead = false; if (tutorial) { SceneSwitcher.SwitchScene("TutorialScene"); } else { AkSoundEngine.PostEvent("Stop_SFX", gameObject); AkSoundEngine.PostEvent("Stop_Music", gameObject); SceneSwitcher.SwitchScene("Lose"); } } }
private void onClickMenu() { swarm.switchPause(false); AkSoundEngine.PostEvent("Stop_SFX", gameObject); SceneSwitcher.SwitchScene("Menu"); }
void onClickScore() { AkSoundEngine.PostEvent("Play_UI_Valide", gameObject); AkSoundEngine.PostEvent("Stop_Music", gameObject); SceneSwitcher.SwitchScene("Leaderboard"); }
void onClickPlay() { AkSoundEngine.PostEvent("Stop_Music", gameObject); AkSoundEngine.PostEvent("Play_UI_Start", gameObject); SceneSwitcher.SwitchScene("PlayScene"); }