/// <summary> /// Little bit artificial View functionality - just to separate Main method from program functionality. /// </summary> /// <returns></returns> public static bool RunProgram() { Console.WriteLine("Please enter distance between planets in MGLT:"); string distanceString = Console.ReadLine(); int distance = 0; bool checkInput = Int32.TryParse(distanceString, out distance); if (checkInput) { var starShips = StarShipController.GetStarShips(); foreach (var starShip in starShips) { Console.WriteLine(starShip.StarShipName + ": " + starShip.CalculateStops(distance)); } } else { Console.WriteLine("Entered value was not valid!"); } Console.WriteLine("Do you want to quit?(y/n)"); string quit = Console.ReadLine().ToLower(); if (quit.Equals("y")) { return(false); } return(true); }
/// <summary> /// UPDATE /// </summary> void Update() { // print("bossphase is " + bossPhase); /* * if (starGameManagerRef == null) * { * starGameManagerRef = StarGameManager.instance; * } */ if (starGameManagerRef != null) { if (starShipController == null) { starShipController = starGameManagerRef.starShipController; } if (starGameManagerRef.GamePaused) { return; } } if (!starGameManagerRef.BossWarningMessagePlaying && !RanGenericBossTasks) { RunAfterWarningMessage(); } if (debugSelectRandomBasherAttack) { debugSelectRandomBasherAttack = false; SelectCurrentRandomBasherAttack(); } if (DebugBasherWeaponTestOverrideMode) { BasherWeaponTesting(); } if (Garage != null) { if (phase2AlreadyActivated && !garageDestroyed) { if (!Garage.transform.parent.gameObject.activeSelf) { Destroy(Garage); garageDestroyed = true; } } } if (DisabledSubObjects.Count != 0) { List <GameObject> removeObjectList = new List <GameObject>(); foreach (GameObject picked in DisabledSubObjects) { removeObjectList.Add(picked); GameObject currentSubObject = picked; ActiveBodiesUpdater(picked); if (bossPhase == BossPhase.BossPhase3) { if (damagePanelLinks.ContainsKey(currentSubObject)) { damagePanelLinks[currentSubObject].SetActive(true); audioSource.PlayOneShot(DestroyPlowFragmentAudio); } if (AllActiveBodiesCleared) { BasherWeakpointVulnerable(); } } } foreach (GameObject picked in removeObjectList) { DisabledSubObjects.Remove(picked); } } if ((bossPhase == BossPhase.BossPhase1 && !phase2AlreadyActivated && AllActiveBodiesCleared) || Debug_killMiniTanks) { Debug_killMiniTanks = false; bossPhase = BossPhase.BossPhase2; phase2AlreadyActivated = true; AllActiveBodiesCleared = false; if (!miniTanksMovedOutOfGarage) { miniTanksMovedOutOfGarage = true; GarageDoorAnimation(false); } for (int i = 0; i < IntactPanels.Length; i++) { ActiveBodies.Add(IntactPanels[i]); } SetPlowPanelsInvulnerable(true); StartCoroutine(BossBasherAppear()); } if (bossPhase == BossPhase.BossPhase1) { if (!miniTanksMovedOutOfGarage) { if (ActiveBodies[ActiveBodies.Count - 1].transform.localPosition.z > MiniTanksBackDistance) { miniTanksMovedOutOfGarage = true; GarageDoorAnimation(false); } } for (int i = 0; i < miniTanksMoveForward.Count; i++) { miniTanksMoveForward[i].transform.Translate(0, MiniTanksDriveSpeed * Time.deltaTime, 0); } if (miniTanksMoveBackward.Count > 0) { if (miniTanksMoveBackward[miniTanksMoveBackward.Count - 1].transform.localPosition.z > MiniTanksBackDistance) { for (int i = 0; i < miniTanksMoveBackward.Count; i++) { miniTanksMoveBackward[i].transform.Translate(0, -1 * MiniTanksDriveSpeed * Time.deltaTime, 0); } } } } /* * // restore this if necessary for debug * if (phase2AlreadyActivated) * { * // this might cause trouble?? * bossPhase = BossPhase.BossPhase2; * phase2AlreadyActivated = false; * } */ if (bossPhase == BossPhase.BossPhase3) { if (!deathPulseActive) { CheckForUserTooClose(); if (UserAbove) { BasherHatchPulse(); ResetUserPositionSensors(); } else { if (UserLeft) { animator.SetTrigger(WheelsPointLeft); ResetUserPositionSensors(); } else { if (UserRight) { animator.SetTrigger(WheelsPointRight); ResetUserPositionSensors(); } } } } } if (ActivateExplodeMesh) // delete after debugging { ActivateExplodeMesh = false; BasherWeakpointVulnerable(); } } //end UPDATE