Esempio n. 1
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();
        }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        CameraOffset = new Vector3(0, 15.0f, -2.0f);


        // Set camera's strategy to Idle
        SetCameraType(new Unity_CameraControl.Lerp());
        CameraPresetData presetData = CameraManager.GetInstance().GetCameraPresetPosition("CameraPreset_Lobby");

        CameraManager.GetInstance().LerpTo(presetData.CameraPos, presetData.CameraTarget);
    }
Esempio n. 3
0
    public CameraPresetData GetCameraPresetPosition(string name)
    {
        CameraPresetData presetData = new CameraPresetData();

        for (int i = 0; i < CameraPresets.Length; i++)
        {
            if (CameraPresets[i] == null)
            {
                Debug.LogError("Camera Preset Array has a null element");
                continue;
            }
            if( CameraPresets[i].transform.name == name)
            {
                presetData.CameraPos = CameraPresets[i].transform;
                presetData.CameraTarget = CameraPresets[i].GetChild(0);
            }
        }

        return presetData;
    }
Esempio n. 4
0
    public CameraPresetData GetCameraPresetPosition(string name)
    {
        CameraPresetData presetData = new CameraPresetData();

        for (int i = 0; i < CameraPresets.Length; i++)
        {
            if (CameraPresets[i] == null)
            {
                Debug.LogError("Camera Preset Array has a null element");
                continue;
            }
            if (CameraPresets[i].transform.name == name)
            {
                presetData.CameraPos    = CameraPresets[i].transform;
                presetData.CameraTarget = CameraPresets[i].GetChild(0);
            }
        }

        return(presetData);
    }
Esempio n. 5
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().AddPlayerCondition_All(typeof(Condition_Frozen));
            // 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();
        }