Пример #1
0
        private GameObject m_CanvasGameObject;               // Used to disable the world space UI during the Starting and Ending phases of each round.


        public void Setup()
        {
            // Get references to the components.
            //agent = m_Instance.GetComponent<NavMeshAgent>();
            m_Movement         = m_Instance.GetComponent <TankMovement> ();
            m_Shooting         = m_Instance.GetComponent <TankShooting> ();
            m_CanvasGameObject = m_Instance.GetComponentInChildren <Canvas> ().gameObject;

            // Set the player numbers to be consistent across the scripts.
            m_Movement.player = isPlayer;
            m_Shooting.player = isPlayer;
            m_Shooting.SetCanvas(isPlayer);
            // Create a string using the correct color that says 'PLAYER 1' etc based on the tank's color and the player's number.
            m_ColoredPlayerText = "<color=#" + ColorUtility.ToHtmlStringRGB(m_PlayerColor) + ">PLAYER " + m_PlayerNumber + "</color>";

            // Get all of the renderers of the tank.
            MeshRenderer[] renderers = m_Instance.GetComponentsInChildren <MeshRenderer> ();
            m_Movement.tankColor = m_PlayerColor;
            m_Movement.tankID    = m_PlayerNumber;
            // Go through all the renderers...
            for (int i = 0; i < renderers.Length; i++)
            {
                // ... set their material color to the color specific to this tank.
                renderers[i].material.color = m_PlayerColor;
            }
            m_SpawnPoint = RandomPointNavMesh(Vector3.zero);
        }
Пример #2
0
 public void TooglePlayer(bool val)
 {
     isPlayer          = val;
     m_Movement.player = val;
     m_Shooting.player = val;
     m_Movement.ResetBehaviour();
     m_Shooting.SetCanvas(isPlayer);
 }