Ejemplo n.º 1
0
    public void ControlShip()
    {
        // if(rb == null){  rb = GetComponent<Rigidbody>();}
        playerSpecialActions.ListenToButtonPresses();

        if (playerShip.GetComponent <ViperControls>() != null)
        {
            if (lockOutWeapons <= 0)
            {
                playerShip.GetComponent <ViperControls>().WeaponSystems();
            }
            if (lockOutEngines <= 0)
            {
                playerShip.GetComponent <ViperControls>().ControlCamera(camerasphere, this.gameObject);
                playerShip.GetComponent <ViperControls>().Fly(rb);
            }
        }
        else if (playerShip.GetComponent <RaptorControls>() != null)
        {
            playerShip.GetComponent <RaptorControls>().Fly(rb);
            playerShip.GetComponent <RaptorControls>().WeaponSystems();
            playerShip.GetComponent <RaptorControls>().ControlCamera(camerasphere, this.gameObject);
        }
        else if (playerShip.GetComponent <TankControls>() != null)
        {
            playerShip.GetComponent <TankControls>().Fly(rb);
            playerShip.GetComponent <TankControls>().WeaponSystems();
            playerShip.GetComponent <TankControls>().ControlCamera(camerasphere, this.gameObject);
        }
        else if (playerShip.GetComponent <TurningShip>() != null)
        {
            playerShip.GetComponent <TurningShip>().Fly(rb);
            playerShip.GetComponent <TurningShip>().WeaponSystems();
            playerShip.GetComponent <TurningShip>().ControlCamera(camerasphere, this.gameObject);
        }
        else
        {
        }

        if (lockOutEngines > 0 || lockOutWeapons > 0)
        {
            lockOutEngines -= Time.deltaTime; lockOutWeapons -= Time.deltaTime;
        }
        if (playerStats != null)
        {
            playerStats.RechargeStamina();
        }
    }