protected override IEnumerator Init() { NetworkClient nc = CustomNetworkManager.AddPlayer(); if (nc != null) { TerrainController tc = GameObject.FindObjectOfType <TerrainController>(); if (tc != null) { yield return(tc.GenerateTerrain(LoadingPanel.OnProgress)); } tc.CreateLight(); if (Parent != null) { Parent.Activate <GameState_Play>(); } } else { nc.Disconnect(); CustomNetworkManager.Stop(); Deactivate <GameState_AddPlayer>(); } yield return(base.Init()); }
public void Activate() { if (Parent.Screen.ActiveWorkspace != Parent) { Parent.Activate(Gtk.Global.CurrentEventTime); } if (Parent.IsVirtual) { Parent.Screen.MoveViewport(Area.X, Area.Y); } }
protected override IEnumerator Init() { GUIContainer.LoadingPanel.gameObject.SetActive(true); if (CustomNetworkManager.RunServer() != null) { TerrainController tc = GameObject.FindObjectOfType <TerrainController>(); yield return(tc.GenerateTerrain(LoadingPanel.OnProgress)); tc.CreateLight(); } if (Parent != null) { Parent.Activate <GameState_Play>(); } yield return(base.Init()); }
void Start() { ProInput.Init(); //Obj load obstacles = AllOfClass.PickAllOf <Obstacle>(); flames = AllOfClass.PickAllOf <Parent>(); //setups SetupFlames(); firstFlame.Activate(); gameStart = false; particlesHappy.SetActive(false); //Camera setup ogCamCharComparison = character.transform.localPosition - mainCamContainer.transform.localPosition; homeReminder.SetActive(false); winReminder.SetActive(false); //init charState = CharacterState.IDLE; // CHANGE FOR OP ManageAnimations(); StartCoroutine("GameInit"); }
private void onExitClick() { Parent.Activate <MenuState>(); GameEngine.Clear(); }
private void onNoClick() { Parent.Activate <GameState>(); }
private void OnActivate(object parameters) { Parent.Activate(this); }
private void OnSelectButtonClick() { Parent.Activate <GameLoadingState>(); }
private void onFinish() { Parent.Activate <GameState>(); }
private void onExitClick() { Parent.Activate <ExitGameState>(); }
private void OnDone() { Parent.Activate <GameStateFinish>(); }
private void Flames() { bool anyHitsCollisionOrButton = false; bool happy = false; int parentNum = flames.Count; for (int i = 0; i < parentNum; i++) { Parent flameObj = flames[i]; Transform obsTrans = flameObj.transform; Vector3 obsPos = flameObj.flamePivot.transform.localPosition; Vector3 obsScale = obsTrans.localScale; float obsX = obsPos.x; float obsZ = obsPos.z; float obsWidthHalf = obsScale.x * .5f + CHAR_SIZE.x * .5f; float obsDepthHalf = obsScale.z * .5f + CHAR_SIZE.z * .5f; bool inFlameZone = (charX > obsX - obsWidthHalf && charX <obsX + obsWidthHalf && charZ> obsZ - obsDepthHalf && charZ < obsZ + obsDepthHalf); switch (flameObj.state) { case FlameState.OFF: flameObj.timer = 0; flameObj.lifeSpanTimer = 0; float possibilities = FLAME_POSSIBILITY_Z1; switch (difficulty) { case 1: possibilities = FLAME_POSSIBILITY_Z1; break; case 2: possibilities = FLAME_POSSIBILITY_Z2; break; case 3: possibilities = FLAME_POSSIBILITY_Z3; break; case 4: possibilities = FLAME_POSSIBILITY_Z4; break; case 5: possibilities = FLAME_POSSIBILITY_Z4; break; default: possibilities = 999999999999999; break; } if (gameStart) { if (Mathf.RoundToInt(UnityEngine.Random.value * possibilities) == 0) { flameObj.Activate(); } } break; //light active states case FlameState.LIGHT_DOWN: case FlameState.FIRE_ON: if (gameStart) { flameObj.lifeSpanTimer += deltaTimer; if (flameObj.lifeSpanTimer > LIGHT_LIMIT_LIFESPAN - LIGHT_SHINE_DOWN) { float perc = (1 - (flameObj.lifeSpanTimer - (LIGHT_LIMIT_LIFESPAN - LIGHT_SHINE_DOWN)) / LIGHT_SHINE_DOWN) * LIGHT_ALPHA_LIMIT; flameObj.shine.color = new Vector4(perc, perc, perc, 1); } if (flameObj.lifeSpanTimer > LIGHT_LIMIT_LIFESPAN) { if (flameObj.state != FlameState.FIRE_ON) { flameObj.ResetFlame(); flameObj.state = FlameState.OFF; } } } break; case FlameState.CUTSCENE_ACTIVE: break; case FlameState.OH_NO: break; } switch (flameObj.state) { case FlameState.LIGHT_DOWN: flameObj.timer += deltaTimer; if (inFlameZone && flameObj.timer > LIGHT_TIME_SECONDS - LIGHT_BONUS_TIME) { flameObj.timer = LIGHT_TIME_SECONDS - LIGHT_BONUS_TIME; } if (flameObj.timer > LIGHT_TIME_SECONDS) { //if not winned if (difficulty == 5 && killCount > WIN_QUOTA) { } else { flameObj.state = FlameState.FIRE_ON; flameObj.flame.actualFlame = FLAME_SHOWS_UP_ALPHA; ShakeCam(CAM_SHAKE_TIME, true); gameStart = true; } } float shinePerc = flameObj.timer; if (shinePerc > LIGHT_ALPHA_LIMIT) { shinePerc = LIGHT_ALPHA_LIMIT; } if (flameObj.lifeSpanTimer <= LIGHT_LIMIT_LIFESPAN - LIGHT_SHINE_DOWN) { flameObj.shine.color = new Vector4(shinePerc, shinePerc, shinePerc, 1); } if (inFlameZone) { happy = true; } break; case FlameState.FIRE_ON: flameObj.flame.percentage += deltaTimer * FLAME_SPEED; if (inFlameZone) { anyHitsCollisionOrButton = true; if (hitActionButton) { if (ifHitPending) { ifHitPending = false; ShakeCam(CAM_SHAKE_TIME); flameObj.flame.percentage -= FLAME_HIT; flameObj.flame.actualFlame += FLAME_EFFECT_HIT; if (flameObj.flame.percentage < 0) { flameObj.state = FlameState.LIGHT_DOWN; flameObj.timer = LIGHT_TIME_SECONDS - LIGHT_BONUS_TIME; KilledOne(); } } } } if (flameObj.flame.percentage > 1) { flameObj.flame.percentage = 1; flameObj.state = FlameState.OH_NO; SceneManager.LoadScene("Game_over"); flameObj.flame.actualFlame = 100; ShakeCam(CAM_SHAKE_TIME_DEATH); } if (flameObj.flame.percentage < 0) { flameObj.active = false; } break; case FlameState.OH_NO: break; case FlameState.CUTSCENE_ACTIVE: break; } flameObj.flame.ShowFlames(deltaTimer); } if (hitActionButton) { anyHitsCollisionOrButton = true; ifHitPending = false; } if (!hitActionButton) { ifHitPending = true; } if (happy) { particlesHappy.SetActive(true); } else { particlesHappy.SetActive(false); } }