示例#1
0
 public void StartCountdown(double endTime, double startTime = -1)
 {
     Debug.LogWarning("Starting countdown: " + endTime + ", " + startTime);
     m_Timer = new Local_Timer();
     Debug.LogWarning(m_Timer);
     m_Timer.StartTimer(endTime);
 }
示例#2
0
        public override void Init()
        {
            // This state lasts for 5 seconds?
            // Create a new 3 second timer taking in account for lost time ( network or after announce )
            m_Timer = new Local_Timer();
            double timeLost = PhotonNetwork.time - m_StateStartTime; // time passed between announce & actual handling
            m_Timer.StartTimer(Time.time + 6, Time.time - timeLost);


            // freeze all objects & players
            PlayerManager.GetInstance().SetPlayerFrozen_All(true,true);
            // is there a deahball?
            if(m_Owner.DeathBallInstance != null)
                m_Owner.DeathBallInstance.MovementSpeed = 0;
            
            // Camera goes back to countdown
            CameraPresetData presetData = CameraManager.GetInstance().GetCameraPresetPosition("CameraPreset_Countdown");
            CameraManager.GetInstance().LerpTo(presetData.CameraPos, presetData.CameraTarget);

            // Show scoreboard
            ScoreBoard.GetInstance().SetVisibility(true);


            m_CountdownTextBuffer = new List<string>();

            m_CountdownTextBuffer.Add("<b>Resetting</b>");
            m_CountdownTextBuffer.Add("<b>Game will reset in 1 seconds...</b>");
            m_CountdownTextBuffer.Add("<b>Game will reset in 2 seconds...</b>");
            m_CountdownTextBuffer.Add("<b>Game will reset in 3 seconds...</b>");
            m_CountdownTextBuffer.Add("<b>Game will reset in 4 seconds...</b>");


            base.Init();
        }
示例#3
0
        public override void Init()
        {
            // Create a new 3 second timer taking in account for lost time ( network or after announce )
            m_Timer = new Local_Timer();            
            double timeLost = PhotonNetwork.time - m_StateStartTime; // time passed between announce & actual handling
            m_Timer.StartTimer(Time.time + 3, Time.time - timeLost);
            

            // Create the visual timer Object, this one is just for show
            UnityEngine.Object CountDownTextObject = (GameObject)Resources.Load("CountDownText");
            GameObject newTimerObject = (GameObject)GameObject.Instantiate(CountDownTextObject, Vector3.zero, Quaternion.identity);
            newTimerObject.transform.Rotate(Vector3.right, 90f);
            newTimerObject.name = "Snackbar";
            newTimerObject.GetComponent<countdownText>().StartCountdown(Time.time + 4, Time.time);

            
            PlayerManager.GetInstance().SpawnPlayers_All();

            // Root all players

            PlayerManager.GetInstance().AddPlayerCondition_All( typeof(Condition_Rooted) );

                        // Move Camera to Countdown position
            CameraPresetData presetData = CameraManager.GetInstance().GetCameraPresetPosition("CameraPreset_Countdown");
            CameraManager.GetInstance().LerpTo(presetData.CameraPos, presetData.CameraTarget);

            // Hide scoreboard
            ScoreBoard.GetInstance().SetVisibility(false);


            #region old code
            /*
            // OLD CODE

            // Set all player positions to their respective spawn positions
            //GameObject playerList = GameObject.Find("Players");
            //GameObject spawnList = GameObject.Find("Spawners");
            //for (int i = 0; i < playerList.transform.childCount; i++)
            //{
            //    Transform playerTransform = playerList.transform.GetChild(i);

            //    Player player = playerTransform.GetComponent<Player>();
            //    Player_Movement player_movement = playerTransform.GetComponent<Player_Movement>();
            //    Transform spawnpoint = spawnList.transform.GetChild(i).transform;

            //    player.transform.position = spawnpoint.position;
            //    player_movement.enabled = false;
            //}
            */
            #endregion

            base.Init();
        }