IEnumerator GameCountDown() //Countsdown to start of game { CountdownUI.GetComponent <Text>().text = "5"; SoundManager.PlaySound("Countdown"); yield return(new WaitForSeconds(1f)); CountdownUI.GetComponent <Text>().text = "4"; SoundManager.PlaySound("Countdown"); yield return(new WaitForSeconds(1f)); CountdownUI.GetComponent <Text>().text = "3"; SoundManager.PlaySound("Countdown"); yield return(new WaitForSeconds(1f)); CountdownUI.GetComponent <Text>().text = "2"; SoundManager.PlaySound("Countdown"); yield return(new WaitForSeconds(1f)); CountdownUI.GetComponent <Text>().text = "1"; SoundManager.PlaySound("Countdown"); yield return(new WaitForSeconds(1f)); CountdownUI.GetComponent <Text>().text = "GO!"; SoundManager.PlaySound("Start"); gameStarted = true; yield return(new WaitForSeconds(1.25f)); CountdownUI.SetActive(false); }
//---------------------------------------- private void TargetHit() { ScoreManager.IncreaseScore(targetPoints); if (timer.IsActive) { timer.UpdateCountdown(timeBonus); CountdownUI.PlayUpdateAnimation(); Notification.Instance.Show("+" + timeBonus.ToString() + "s"); } else if (ScoreManager.Score >= scoreToStartTimer) { timer.IsActive = true; Notification.Instance.Show("Timer Started!"); } player.target = null; player.IncreaseSpeed(playerSpeedIncrement); player.AttemptChangeDirection(); target.ChangePosition(); if (ScoreManager.Score % scoreToDoublePenalty == 0) { timePenalty *= 2f; Notification.Instance.Show("Time Penalty Doubled!"); } CameraShake.TriggerShake(0.1f, 0.2f); // Check if score-based achievements can be unlocked. If so, unlock the achievement! Achievements.UnlockTimedModeProgress(ScoreManager.Score); }
public override void Load() { if (!Main.dedServ) { CountdownInterface = new UserInterface(); countdownUI = new CountdownUI(); countdownUI.Activate(); // Activate calls Initialize() on the UIState if not initialized, then calls OnActivate and then calls Activate on every child element } }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); Car.LoadContent(Content); ScoreUI.LoadContent(Content); GameOverUI.LoadContent(Content); FPSUI.LoadContent(Content); CountdownUI.LoadContent(Content); TitleUI.LoadContent(Content); //TODO: probably should load ALL content here. Some content (e.g. sign models) still loaded at runtime }
void Start() { PauseMenuUI.SetActive(false); CountdownUI.SetActive(true); ControlsUI.SetActive(false); MenuCheckUI.SetActive(false); GameOverUI.SetActive(false); StartCoroutine(GameCountDown()); GameIsPaused = false; gameStarted = false; }
//---------------------------------------- private void TargetMissed() { if (timer.IsActive) { timer.UpdateCountdown(-timePenalty); CountdownUI.PlayUpdateAnimation(); Notification.Instance.Show("-" + timePenalty.ToString() + "s"); } AudioManager.PlaySfx(targetMissedAudio); CameraShake.TriggerShake(0.1f, 0.5f); }
public InGameUI() { PanelObj = UIManager.MainCanvas.transform.Find("InGameUI").gameObject; if (m_CountDown == null) { GameObject temp = GameObject.Instantiate(Resources.Load <GameObject>("CountDownUI"), PanelObj.transform); m_CountDown = temp.GetComponent <CountdownUI>(); } m_TimerPanel = PanelObj.transform.Find("TurnTimer").gameObject; m_TurnTimerText = m_TimerPanel.GetComponent <TextMeshProUGUI>(); m_WinningPanel = GameObject.Instantiate(Resources.Load <GameObject>("Winner"), PanelObj.transform); m_MainMenu = m_WinningPanel.transform.Find("MainMenu").GetComponent <Button>(); SetButtonMethod(m_MainMenu, MainMenuAction); m_NewRound = m_WinningPanel.transform.Find("NewRound").GetComponent <Button>(); SetButtonMethod(m_NewRound, NewRoundAction); m_PauseMenu = new PauseMenu(PanelObj.transform.Find("PausePanel").gameObject); }
protected override void Initialize() { base.Initialize(); Graphics = GraphicsDevice; //Initialize physics tainicom.Aether.Physics2D.Settings.MaxPolygonVertices = 16; world = new World(Vector2.Zero); debugView = new DebugView(world); debugView.AppendFlags(DebugViewFlags.DebugPanel | DebugViewFlags.PolygonPoints); debugView.LoadContent(GraphicsDevice, Content); //Create player player = new Player(Content, CarType.SPORT, world, adjustedSpeed); player.DodgeCompleteCallback = DodgeCompleted; player.CoinGetCallback = CoinGet; //Create objects environment = new EnvironmentManager(Content, world); trafficManager = new TrafficManager(Content, world); //Setup graphics Lighting.Initialize(); effect = Content.Load <Effect>("effect"); postProcessor = new PostProcessor(spriteBatch, Content.Load <Effect>("desaturate")); //Setup GUI scoreUI = new ScoreUI(); gameOverUI = new GameOverUI(); fpsUI = new FPSUI(); countdownUI = new CountdownUI(); titleUI = new TitleUI(); //Setup input InputManager.Initialize(); }
public override void Init() { base.Init(); if (Entity.buildingVO.buildingStatus == BuildingVO.BuildingStatus.Construct || Entity.buildingVO.buildingStatus == BuildingVO.BuildingStatus.Upgrade) { //TODO add construct view constructAnimationOverlay = (GameObject)ResourceManager.Instance.LoadAndCreate("Homeland/BuilderUI/BuildFenceView"); constructAnimationOverlay.GetComponent <BuildFenceView>().Init(Entity.model.tileSize); Entity.view.AddSubView(constructAnimationOverlay, new Vector3(-Entity.model.tileSize + 1.3f, 0, -Entity.model.tileSize + 1.3f)); endTime = DateTimeUtil.UnixTimestampMSToDateTime(Entity.buildingVO.endTime); if (GameWorld.Instance.worldType == WorldType.Home) { countdownUI = ((GameObject)ResourceManager.Instance.LoadAndCreate("Homeland/BuilderUI/CountdownUI")) .GetComponent <CountdownUI>(); Entity.view.AddSubView(countdownUI.gameObject, new Vector3(0, 3, 0)); countdownUI.TotalTime = DataCenter.Instance.FindEntityModelById(Entity.model.baseId).buildTime; countdownUI.LeftTime = (Entity.buildingVO.endTime - ServerTime.Instance.GetTimestamp()) / 1000; countdownUI.OnCompleteEvent += OnCountdownComplete; // 请求一个工人进行建造 //workman = IsoMap.Instance.GetWorkerHouseComponent().AskAWorkman(Entity); DelayManager.Instance.AddDelayCall(delegate() { // REMARK:这里是异步处理(可能处理的时候已经完成了 则不用请求工人了 if (Entity.buildingVO.buildingStatus == BuildingVO.BuildingStatus.Construct || Entity.buildingVO.buildingStatus == BuildingVO.BuildingStatus.Upgrade) { workman = IsoMap.Instance.GetWorkerHouseComponent().AskAWorkman(Entity); } }); } } }