예제 #1
0
    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);
    }
예제 #2
0
        //----------------------------------------
        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);
        }
예제 #3
0
        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
            }
        }
예제 #4
0
 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
 }
예제 #5
0
 void Start()
 {
     PauseMenuUI.SetActive(false);
     CountdownUI.SetActive(true);
     ControlsUI.SetActive(false);
     MenuCheckUI.SetActive(false);
     GameOverUI.SetActive(false);
     StartCoroutine(GameCountDown());
     GameIsPaused = false;
     gameStarted  = false;
 }
예제 #6
0
        //----------------------------------------
        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);
        }
예제 #7
0
    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);
    }
예제 #8
0
        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();
        }
예제 #9
0
    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);
                    }
                });
            }
        }
    }