Esempio n. 1
0
 // Start is called before the first frame update
 void Start()
 {
     ray              = new Ray(transform.position, Player.Instance.transform.position);
     wallLayer        = LayerMask.GetMask("Wall");
     floorTileLayer   = LayerMask.GetMask("FloorTile");
     lastHit          = new List <GameObject>();
     cameraController = GetComponent <MSCameraController>();
     cameraController.cameras[0].rotationType = MSACC_CameraType.TipoRotac.Orbital;
 }
Esempio n. 2
0
        /// <summary>
        /// Switches between controllable ships.
        /// </summary>
        private void ChangeShip()
        {
            //Keeping track of the position in the list of ships.
            if (_shipId < _shipsAvailable.Count - 1)
            {
                _shipId++;
            }
            else
            {
                _shipId = 0;
            }

            //Turning off previous selected ship.
            if (_ship != null)
            {
                _selectedShip = _ship.GetComponent <Ship>();
                _selectedShip.LightsEnable(false);
                _selectedShip.isSelected = false;
            }

            //Assigning the new selected ship.
            _ship      = _shipsAvailable[_shipId];
            _rigidbody = _ship.GetComponent <Rigidbody>();

            if (_cameraController != null)
            {
                _cameraController.enabled = false;
            }

            _cameraController         = _ship.GetComponent <MSCameraController>();
            _cameraController.enabled = true;

            _selectedShip = _ship.GetComponent <Ship>();

            _selectedShip.LightsEnable(true);
            lightsOn = true;

            //Assigning the ship's variables to local variables and updating the UI accordingly.
            AssignShipData(_selectedShip);
            UpdateUI();
        }
 // Start is called before the first frame update
 void Start()
 {
     _controller = GetComponent <MSCameraController>();
 }