Пример #1
0
    // Use this for initialization
    void Start()
    {
        if (UI_Targeting == null)
            UI_Targeting = GetComponentInChildren<TargetingUI>();

        if (UI_SpaceStation == null)
            UI_SpaceStation = GetComponentInChildren<SpaceStationUI>();

        allInterfaces.Add(UI_Targeting);
        allInterfaces.Add(UI_SpaceStation);
        foreach (UIBase uis in allInterfaces)
        {
            uis.SetManager(this);
        }
    }
    void SwitchToStation()
    {
        if (flManager == null)
            flManager = GameObject.Find("_Required").GetComponent<FleetManager>();

        cam.enabled = true;
        // If there user interface is null - get it.
        if (userInterface == null)
            userInterface = Game.uiManager.GetComponentInChildren<SpaceStationUI>();

        //TODO: Enable Mouse Orbit here.

        // Dont allow player ship to move.
        player.rigidbody.isKinematic = true;

        List<MeshCollider> meshes = new List<MeshCollider>(player.transform.root.GetComponentsInChildren<MeshCollider>());

        foreach (MeshCollider meshCol in meshes)
            meshCol.enabled = false;

        // Disables all player ship scripts
        player.DisableScripts();

        // Disables current player camera and sets position to construction area
        player.GetCurrentCamera().enabled = false;
        player.transform.position = constructionArea.position;
        //player.transform.root.parent = constructionArea.transform;
        player.transform.rotation = transform.rotation;

        // Activates the UI Camera and UI
        userInterface.EnableUI(this);
        userInterface.UICamera.gameObject.SetActive(true);
        HideAndClearUI();

        // Tells station is is entered.
        state = StationState.ENTERED;

        // Copys player data to station
        holdingPlayer = player;
        flManager.playerShips.Remove(player);
        foreach (Weapon wpn in holdingPlayer.Weapons)
        {
            wpn.Target = null;
        }
        // Populates Rig Points
        //PopulateUpgradePoints();

        // Enables Mouse Camera Movement.
        orbitView.enabled = true;
    }