Example #1
0
    public void SwapCenterRectTranCords(EStationID newStationID)
    {
        if (centerRT != rectTrans[(int)newStationID])
        {
            float         fadeTime             = 1f;
            Vector2       tempNewCords         = rectTrans[(int)newStationID].gameObject.GetComponent <DisplayBoxCords>().cords;
            Vector2       tempSchematicCords   = schematicRT.gameObject.GetComponent <DisplayBoxCords>().cords;
            RectTransform tempOldRectTransform = centerRT;

            // Camera fade out
            centerRT.GetChild(0).GetComponent <CameraTween>().FadeOut(fadeTime);
            schematicRT.GetChild(0).GetComponent <CameraTween>().FadeOut(fadeTime);
            rectTrans[(int)newStationID].GetChild(0).GetComponent <CameraTween>().FadeOut(fadeTime);

            centerRT.GetComponent <DisplayBoxCords>().cords = tempSchematicCords;
            schematicRT.gameObject.GetComponent <DisplayBoxCords>().cords = tempNewCords;
            rectTrans[(int)newStationID].gameObject.GetComponent <DisplayBoxCords>().cords = new Vector2(1, 1);
            centerRT = rectTrans[(int)newStationID];

            // Camera fade in
            tempOldRectTransform.GetChild(0).GetComponent <CameraTween>().FadeIn(fadeTime);
            schematicRT.GetChild(0).GetComponent <CameraTween>().FadeIn(fadeTime);
            //rectTrans[(int)newStationID].GetChild(0).GetComponent<CameraTween>().FadeIn();
            centerRT.GetChild(0).GetComponent <CameraTween>().FadeIn(fadeTime);
        }
    }
Example #2
0
    public void SetActiveControlScheme(EStationID newStationID)
    {
        currentlyActiveControlScheme?.SetActiveControl(false);


        //Debug.Log(stations[(int)newStationID].controlScheme);
        currentlyActiveControlScheme = stations[(int)newStationID].controlScheme;
        currentlyActiveControlScheme.SetActiveControl(true);
    }
Example #3
0
    private EStationID NextStation(EStationID currentStationID)
    {
        int currentStation = clockwiseOrderDictClockToNum[(int)currentStationID];
        int newStation     = currentStation + 1;

        //check to see if we need to loop back to the start of the enum
        if (newStation == (System.Enum.GetNames(typeof(EStationID))).Length - 1)
        {
            newStation = 1;
        }
        return((EStationID)clockwiseOrderDictNumToClock[newStation]);
    }
Example #4
0
 public void SetMainStation(EStationID newMainStationID)
 {
     if (newMainStationID == EStationID.None)
     {
         return;
     }
     else
     {
         Station oldCenterStation = currentCenterStation;
         currentCenterStation = stations[(int)newMainStationID];
         newListner.SetNewListner(oldCenterStation, currentCenterStation);
         centerDisplayController.SetMainStation(newMainStationID);
         schematicManager.SetNewActiveStation((int)newMainStationID);
         SetActiveControlScheme(newMainStationID);
     }
 }
Example #5
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Tab))
        {
            menuOpen = true;
            darkscreen.SetActive(true);
            curShowCursor    = Cursor.visible;
            Cursor.visible   = true;
            cursorLockState  = Cursor.lockState;
            Cursor.lockState = CursorLockMode.None;
            curStation       = StationManager.currentCenterStation;
            curCamScale      = stationDisplayPosAndScale.chosenCenterCamScale;
            camZoomCont.UpdateZoom((int)ECenterCamScale.Med);
        }
        else if (Input.GetKeyUp(KeyCode.Tab))
        {
            menuOpen = false;
            darkscreen.SetActive(false);
            Cursor.visible   = curShowCursor;
            Cursor.lockState = cursorLockState;
            stationManager.SetMainStation(selectedStation);
            SetUIActive(false);
            camZoomCont.UpdateZoom((int)curCamScale);
        }

        if (menuOpen)
        {
            SetUIActive(true);
            PointerEventData          = new PointerEventData(EventSystem);
            PointerEventData.position = Input.mousePosition;

            foreach (var e in elem)
            {
                e.GetComponent <Image>().enabled = true; //make sure all slices are visible first
            }

            List <RaycastResult> result = new List <RaycastResult>();
            ray.Raycast(PointerEventData, result);
            int len = result.ToArray().Length;
            if (len != 0)
            {
                var pos = result[0].screenPosition;

                if (result[0].gameObject.tag != "Finish")
                {
                    pointer.SetActive(true);
                    //center.GetComponent<Image>().overrideSprite = center_cog[0]; //revert cog wheel
                    result[0].gameObject.GetComponent <Image>().enabled = false; // "hide" the selected slice

                    float angle = -1 * Mathf.Atan2(pos.x - Screen.width / 2, pos.y - Screen.height / 2) * Mathf.Rad2Deg;

                    wheel.transform.GetChild(0).transform.rotation = Quaternion.Euler(0, 0, angle);
                    if (result[0].gameObject.GetComponent <SelectionArea>())
                    {
                        selectedStation = result[0].gameObject.GetComponent <SelectionArea>().referencesStation;
                        //stationManager.SetMainStation(result[0].gameObject.GetComponent<SelectionArea>().referencesStation);
                        //SetUIActive(false);
                    }
                }
                else
                {
                    selectedStation = curStation.stationID;
                    pointer.SetActive(false);
                    //center.GetComponent<Image>().overrideSprite = center_cog[1]; //fake selection outline
                }
            }
        }
        else if (wheel.activeSelf)
        {
            SetUIActive(false);
        }
    }
Example #6
0
 public void SetMainCam(EStationID newStationID)
 {
     activeCenterCam = cams[(int)newStationID];
     UpdateCameras();
 }
Example #7
0
    // Update is called once per frame
    void Update()
    {
        EStationID newStationID = CheckInputForStationChange();

        sm.SetMainStation(newStationID);
    }
Example #8
0
 public void SetMainStation(EStationID newStationID)
 {
     SwapCenterRectTranCords(newStationID);
 }