public void SetStage(stages newStage) { switch (newStage) { case stages.floorplan: _stage = stages.floorplan; break; case stages.building: _stage = stages.building; break; case stages.textures: _stage = stages.textures; break; case stages.roofs: _stage = stages.roofs; break; case stages.export: _stage = stages.export; break; } }
// Start is called before the first frame update void Start() { //Get starting variables spriteController = GetComponent <SpriteRenderer>(); maxStages = vegetableStages.Count; //Set vegetable and vegetable parameters to first vegetable currentStage = vegetableStages[currentStageIndex]; spriteController.sprite = currentStage.image; }
//void Update() //{ // switch ((int)switch_on) // { // case 1: // { // OnFade(); // } // break; // case 2: // { // OffFade(); // } // break; // case 3: // { // StartCoroutine(Cycle()); // } // break; // default: // break; // } //} void OffFade() { _image.color = Color.Lerp(_image.color, Color.clear, fadeOffSpeed * Time.deltaTime); if (_image.color.a <= 0.01f) { _image.color = Color.clear; _image.enabled = false; switch_on = stages.Wait; } }
void OnFade() { _image.enabled = true; _image.color = Color.Lerp(_image.color, fadeColor, fadeOnSpeed * Time.deltaTime); if (_image.color.a >= 0.98f) { _image.color = fadeColor; switch_on = stages.Wait; } }
public IEnumerator Cycle() { if (!cycleWork) { cycleWork = true; bool t = true; gr.enabled = true; float time = delayOnCycle; print("one"); while (t) { _image.enabled = true; _image.color = Color.Lerp(_image.color, fadeColor, fadeOnSpeed * Time.deltaTime); if (_image.color.a >= 0.99f) { _image.color = fadeColor; t = false; } yield return(null); } print("two"); t = true; yield return(new WaitForSeconds(time)); while (t) { _image.color = Color.Lerp(_image.color, Color.clear, fadeOffSpeed * Time.deltaTime); if (_image.color.a <= 0.01f) { _image.color = Color.clear; _image.enabled = false; switch_on = stages.Wait; t = false; } yield return(null); } print("four"); cycleWork = false; gr.enabled = false; } else { yield return(null); } }
// Update is called once per frame void Update() { timer += Time.deltaTime; switch (stage) { case stages.breakBetweenWaves: if (timer > midWaveBreakTime) { enemiesSpawned = 0; stage = stages.startOfWave; timer = 0; getText(stage); } break; case stages.startOfWave: // DO SOME STARTOFWAVE STUFF if (timer > startOFWaveBreakTime) { stage = stages.spawningEnemies; timer = 0; } break; case stages.spawningEnemies: startSpawning(); break; case stages.awaitEndOfWave: if (enemiesAlive <= 0) { stage = stages.breakBetweenWaves; timer = 0; getText(stage); } break; default: Debug.Log("SpawnManager failed to update."); break; } }
private IEnumerator VegetableTimer() { //While there are more vegetable stages.... while (currentStageIndex < maxStages - 1) { //Wait for stage timer yield return(new WaitForSeconds(growTimer)); //Advance to next vegetable currentStageIndex += 1; currentStage = vegetableStages[currentStageIndex]; spriteController.sprite = currentStage.image; growTimer = currentStage.growTime; } }
public void changeStage(stages newStage) { switch (newStage) { case stages.FOREST: stage[0].SetActive(true); break; case stages.CAVE: stage[1].SetActive(true); break; case stages.SKY: stage[2].SetActive(true); break; case stages.END: stage[3].SetActive(true); break; } switch (stageSelected) { case stages.FOREST: stage[0].SetActive(false); break; case stages.CAVE: stage[1].SetActive(false); break; case stages.SKY: stage[2].SetActive(false); break; case stages.END: stage[3].SetActive(false); break; } stageSelected = newStage; }
private void getText(stages stage) { switch (stage) { case stages.breakBetweenWaves: if (waves[currentWave].endOfWaveText == "") { GameObject.Find("TextController").GetComponent <TextController>().generateText("", "Good job"); } else { int text = currentWave; if (text <= 0) { text = 1; } GameObject.Find("TextController").GetComponent <TextController>().generateText("", waves[text - 1].endOfWaveText, 60, 40); } break; case stages.startOfWave: if (waves[currentWave].startOfWaveText == "") { GameObject.Find("TextController").GetComponent <TextController>().generateText("Wave " + (currentWave + 1)); } else { GameObject.Find("TextController").GetComponent <TextController>().generateText("Wave " + (currentWave + 1), waves[currentWave].startOfWaveText, 60, 40); } break; case stages.spawningEnemies: break; case stages.awaitEndOfWave: break; default: break; } }
void Update() { if (Time.time > startTime + fadeInTime + stayTime + fadeOutTime) { state = stages.disappear; } else if (Time.time > startTime + fadeInTime + stayTime) { state = stages.fadeOut; } else if (Time.time > startTime + fadeInTime) { state = stages.stay; } else if (Time.time > startTime) { state = stages.fadeIn; } switch (state) { case stages.fadeIn: opacity = (Time.time - startTime) / fadeInTime; break; case stages.stay: opacity = 1; break; case stages.fadeOut: opacity = 1 - (Time.time - startTime - fadeInTime - stayTime) / fadeOutTime; break; case stages.disappear: Destroy(gameObject); break; } this.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, opacity); Debug.Log(state + "\n" + opacity); }
void Update() { if (canGrow && Time.time >= growTimer && (currentStageIndex < maxStages - 1)) { //Advance to next vegetable currentStageIndex += 1; currentStage = vegetableStages[currentStageIndex]; spriteController.sprite = currentStage.image; growTimer = Time.time + currentStage.growTime * growthModifier; } else if (canGrow && currentStageIndex >= maxStages - 1) { //Plant is fully grown! Spawn a pickup and delete self. Make sure pickup shares ID GameObject newPickup = Instantiate(fullyGrownItem, this.transform.position, this.transform.localRotation); newPickup.GetComponent <plantID>().ID = ID; CmdSpawnPickup(fullyGrownItem, this.transform.position, this.transform.localRotation); Destroy(this.gameObject); } }
void startSpawning() { if (enemiesSpawned == 0) { spawnAnEnemy(); timer = 0; } else if ((timer > waves[currentWave].spawnRate) && (enemiesSpawned < waves[currentWave].enemies)) { spawnAnEnemy(); timer = 0; } else if (enemiesSpawned >= waves[currentWave].enemies) { stage = stages.awaitEndOfWave; timer = 0; currentWave += 1; if (currentWave >= waves.Count) { currentWave = waves.Count - 1; } } }
private async void Process(CancellationToken token) { try { await Task.Run(() => { byte msg = 0x01, anwser = 0x0; bool abort = false; stages Stage = stages.Get_Bottles; Console.WriteLine("Next step"); for (;;) { Property.Device.Send_Data(msg, msg); anwser = Property.Device.recived_data; switch (anwser) { case 0x08: case 0x18: case 0x28: case 0x38: Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => { b_Start.Background = Brushes.Red; })); abort = true; break; case 0x01: Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => B_Second())); Stage = stages.Continues; msg = 0x31; break; case 0x06: if (Stage == stages.Fill_Bottles1) { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => A_First())); Stage = stages.Next_Bottle1; msg = 0x11; } else if (Stage == stages.Fill_Bottles2) { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => A_Second())); Stage = stages.Next_Bottle2; msg = 0x11; } else { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => A_Final())); msg = 0x11; } break; case 0x05: if (Stage == stages.Get_Bottles) { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => Ani_Init())); Stage = stages.Fill_Bottles1; msg = 0x01; } else if (Stage == stages.Next_Bottle1) { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => B_First())); Stage = stages.Fill_Bottles2; msg = 0x31; } else { Application.Current.Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(() => B_Final())); msg = 0x31; } break; } if (abort || tok) { break; } } }); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
IEnumerator EndRound() { System.DateTime d = System.DateTime.Now; if (Round < 1) { RoundEnding = 0; StartCoroutine (DisplayMessage ("Round over", 4000)); MoveTokenToCenter (); RoundEnding = 1; d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(4000)) { yield return null; } while (RoundEnding == 1) { yield return null; } if (Home == false) { FlipToken (); } PlayerHasBall = true; Discarded = false; Passing = 0; Intercepting = 0; GoalShotting = 0; GoalBlocking = 0; DeckPos = 0; PlayerHandSize = 6; AIHandSize = 6; FreeKickCardsLeft = 4; Skipped = 0; Round++; Shuffle (); AIShuffle (); StartCoroutine (DisplayMessage ("Tap to Roll Off!", 3000)); RollButton.SetActive (true); diceRollComplete = false; stage = stages.RollOff; } else { StartCoroutine (DisplayMessage ("Game over", 2000)); d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(2000)) { yield return null; } if (PlayerScore > AIScore) { StartCoroutine (DisplayMessage ("You win!", 2000)); d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(2000)) { yield return null; } } else if (PlayerScore < AIScore) { StartCoroutine (DisplayMessage ("AI wins", 2000)); d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(2000)) { yield return null; } } else { StartCoroutine (DisplayMessage ("It's a draw", 2000)); d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(2000)) { yield return null; } } StartCoroutine (DisplayMessage ("Restarting game ...", 2000)); d = System.DateTime.Now; while (System.DateTime.Now < d.AddMilliseconds(2000)) { yield return null; } Application.LoadLevel(Application.loadedLevel); } }
// sets the stage public void SetStage(stages newMap) { map = newMap; }
// sets the stage public void SetStage(int newMap) { map = (stages)newMap; }
// Use this for initialization void Start() { Hand = new string[10]; Deck = new string[1000]; AIHand = new string[10]; AIDeck = new string[1000]; Home = true; PlayerHasBall = true; Discarded = false; Passing = 0; Intercepting = 0; GoalShotting = 0; GoalBlocking = 0; DeckPos = 0; PlayerHandSize = 6; AIHandSize = 6; FreeKickCardsLeft = 4; DeckSize = PassNum + InterceptNum + GoalShotLeftNum + GoalShotRightNum + BlockLeftNum + BlockRightNum - 6; Skipped = 0; Round = 0; Shuffle(); AIShuffle(); CardText.text = ""; StartCoroutine (DisplayMessage ("Tap to Roll Off!", 3000)); RollButton.SetActive(true); stage = stages.RollOff; }
// Update is called once per frame void Update() { if (Dice1.GetComponent<Rigidbody> ().velocity == Vector3.zero && Dice2.GetComponent<Rigidbody> ().velocity == Vector3.zero && rolling == true) { ResolveDiceRoll(); HideDiceTime = Time.time + DisplayTime; } if (rolling == false && DiceShown == true & Time.time > HideDiceTime) { HideDice(); } //my tessa's stuff if (diceRollComplete && stage == stages.RollOff) { // if roll off stage diceRollComplete = false; stage = stages.CardSelect; RollButton.SetActive(false); if (Dice1Val > Dice2Val) { StartCoroutine (DisplayMessage ("You go first", 2000)); print("You go first"); playerTurn = true; StartCoroutine(CardPrompt()); } else { StartCoroutine (DisplayMessage ("Computer goes first!", 2000)); print ("Computer goes first!"); playerTurn = false; StartCoroutine(AITurn()); } } if(playerTurn && stage == stages.CardSelect) { // if player turn and stage card selection // need a delay in the message changes stage = stages.etc; } }