Ejemplo n.º 1
0
        // Called every frame
        protected override void InputUpdate()
        {
            if (hudController != null)
            {
                hudController.SetPrompts("PRESS " + enterExitInput.GetInputAsString() + " TO ENTER",
                                         "PRESS " + enterExitInput.GetInputAsString() + " TO EXIT");
            }

            if (vehicleEnterExitManager.EnterableVehicles.Count > 0)
            {
                // Check for input
                if (enterExitInput.Down())
                {
                    Vehicle parent = vehicleEnterExitManager.EnterableVehicles[0].Vehicle;
                    vehicleEnterExitManager.EnterParent(0);
                    gameAgent.EnterVehicle(parent);
                }
            }
            else if (vehicleEnterExitManager.CanExitToChild())
            {
                // Check for input
                if (enterExitInput.Down())
                {
                    Vehicle child = vehicleEnterExitManager.Child.Vehicle;
                    vehicleEnterExitManager.ExitToChild();
                    gameAgent.EnterVehicle(child);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Spawn the object.
        /// </summary>
        public override void Spawn()
        {
            base.Spawn();

            Vector3 spawnPos = transform.position;

            if (warpIn)
            {
                spawnPos = transform.position - transform.forward * warpDistance;
            }

            if (usePoolManager)
            {
                pilot   = PoolManager.Instance.Get(pilotPrefabs[Random.Range(0, pilotPrefabs.Count)].gameObject, spawnPos, transform.rotation).GetComponent <GameAgent>();
                vehicle = PoolManager.Instance.Get(vehiclePrefabs[Random.Range(0, vehiclePrefabs.Count)].gameObject, spawnPos, transform.rotation).GetComponent <Vehicle>();
            }
            else
            {
                pilot   = Instantiate(pilotPrefabs[Random.Range(0, pilotPrefabs.Count)], spawnPos, transform.rotation);
                vehicle = Instantiate(vehiclePrefabs[Random.Range(0, vehiclePrefabs.Count)], spawnPos, transform.rotation);
            }

            pilot.Revive();
            vehicle.Restore();

            if (warpIn)
            {
                StartAnimation();
            }

            pilot.EnterVehicle(vehicle);
        }