private void Start() { FightState = BossFightState.Stage1; BossSide = BossSide.Right; QualitySettings.vSyncCount = 0; Application.targetFrameRate = 75; }
private void Update() { BossSide = bossSide; // for static field - this is the worst way to do it. if (boss.life > 600) { FightState = BossFightState.Stage1; try{ Patricio.ds4.SetLightBarColor(Color.green); }catch {} } if (boss.life < 600 && boss.life > 300) { FightState = BossFightState.Stage2; try{ DualShockGamepad.current.SetLightBarColor(Color.blue); }catch {} } if (boss.life < 300) { FightState = BossFightState.Stage3; try{ DualShockGamepad.current.SetLightBarColor(Color.red); }catch {} } }
private void SetState(BossFightState newState) { Debug.Log("Entering state " + newState); switch (newState) { case BossFightState.CINEMATIC: //hide buttons buttonsPanel.transform.localPosition = new Vector3(buttonsPanel.transform.localPosition.x, buttonsPanel.transform.localPosition.y - 200, buttonsPanel.transform.localPosition.z); //show cinematic bars foreach (Image bar in CinematicBars) { Go.to(bar, 1.0f, new GoTweenConfig() .colorProp("color", new Vector4(1.0f, 1.0f, 1.0f, 1.0f)) .setEaseType(GoEaseType.SineOut) ); } //hide health bars HealthBarsPanel.transform.localPosition = new Vector3(HealthBarsPanel.transform.localPosition.x, HealthBarsPanel.transform.localPosition.y + 250, HealthBarsPanel.transform.localPosition.x); //play ambient sound AudioSource audioSource = Camera.main.GetComponent <AudioSource>(); audioSource.loop = false; audioSource.clip = BossIntro; audioSource.PlayDelayed(3.0f); //start cinematic bossFightCinematic = new GameObject("bossfightCinematic").AddComponent <BossFightCinematic>(); bossFightCinematic.BossRoar = BossRoar; bossFightCinematic.Begin(glorten.GetChar(), bossIA.GetChar()); break; case BossFightState.PLAYING: //hide cinematic bars foreach (Image bar in CinematicBars) { Go.to(bar, 1.0f, new GoTweenConfig() .colorProp("color", new Vector4(1.0f, 1.0f, 1.0f, 0.0f)) .setEaseType(GoEaseType.SineOut)); } //show buttons Go.to(buttonsPanel.transform, 1.0f, new GoTweenConfig() .localPosition(new Vector3(0.0f, 200.0f, 0.0f), true) .setEaseType(GoEaseType.SineOut) .setDelay(0.5f)); //show health bars Go.to(HealthBarsPanel.transform, 1.0f, new GoTweenConfig() .localPosition(new Vector3(0.0f, -250.0f, 0.0f), true) .setEaseType(GoEaseType.SineOut) .setDelay(0.5f)); DestroyImmediate(bossFightCinematic.gameObject); //play loop sound AudioSource audioSource2 = Camera.main.GetComponent <AudioSource>(); audioSource2.loop = true; audioSource2.clip = BossLoop; audioSource2.Play(); //is player turn! yay! glorten.YourTurn(true); isPlayerTurn = true; break; case BossFightState.END: //end playing if (glorten.GetChar().health <= 0) { Invoke("ShowGameOverScreen", 2.0f); } else if (bossIA.GetChar().health <= 0) { Invoke("ShowVictoryScreen", 7.0f); } break; } this.currentState = newState; }