Exemplo n.º 1
0
        /// <summary>
        /// Init player, must be called before 'Start'
        /// </summary>
        public void Init()
        {
            MainCamera = GetComponentInChildren <Camera>();


            // player must be faced to world forward
            transform.forward = Vector3.forward;


            // init vehicle
            Vehicle = GetComponentInChildren <PlayerVehicle>(true);
            Debug.Assert(Vehicle != null, "There must be a 'PlayerVehicle' as child object", this);

            Vehicle.Init(this);
            steeringWheel = Vehicle.SteeringWheel;

            // init weapons
            weaponsController = GetComponentInChildren <WeaponsController>();
            weaponsController.SetOwner(this);

            SignToEvents();
        }