Beispiel #1
0
        // Update is called once per frame
        void Update()
        {
            //Debug.Log("UPdating Player Controller for player " + playerNum);
            if (SceneManager.GetActiveScene().name == GlobalTags.GAME_SCREEN)
            {
                /* if(isLocalPlayer)
                 * {
                 *   if (checkWallTimer)
                 *   {
                 *       checkWallTimer = false;
                 *       StartCoroutine(wallTimerReset());
                 *       //Debug.Log("Is Wall ready for client player? " + Cooldowns.Instance.IsWallReady[playerNum]);
                 *       Debug.Log("Phase -1: EjectWall called by: " + playerNum);
                 *       CmdEjectWall(gameObject, walls); // walls are server-controlled and spawned, so we must use a Cmd
                 *   }
                 * }*/

                if (isServer)
                {
                    if (isAI)
                    {
                        StartCoroutine(PlayerBehaviors.ejectWall(gameObject, walls));
                    }
                }
            }
        }
Beispiel #2
0
        // Update is called once per frame
        /// <summary>
        /// Checks to see if the game is over.
        /// Tells players to eject walls. ** TODO This should not be here **
        /// </summary>
        void Update()
        {
            // Do we need this if statement?  It looks like it's handled in the gameStateStart coroutine
            if (spawnPositions.Length == 0)
            {
                spawnPositions = GameObject.FindGameObjectsWithTag(GlobalTags.SPAWN_POSITION);
            }


            gameOver = checkIfAllPlayersDead();
            if (gameOver)
            {
                // end the game after so many seconds.
            }

            if (isServer && gameReady)
            {
                //let's spawn walls for all players
                for (int i = 0; i < players.Count; i++)
                {
                    if (players[i].GetComponent <Rigidbody>().velocity.magnitude > 0 && players[i].GetComponent <Controllers.PlayerController>().isAlive)    // TODO only a temporary check.  we need better sync method for after vehicles are ready.
                    {
                        StartCoroutine(PlayerBehaviors.ejectWall(players[i], walls));
                    }
                }
            }
        }
Beispiel #3
0
 void CmdEjectWall(GameObject gameObject, GameObject walls)
 {
     Debug.Log("Phase 0  : EjectWall called by: " + playerNum);
     StartCoroutine(PlayerBehaviors.ejectWall(gameObject, walls));
 }