コード例 #1
0
        //--------------------------------------------------
        // private
        //--------------------------------------------------

        //--------------------------------------------------
        // public
        //--------------------------------------------------

        //--------------------------------------------------
        // protected
        //--------------------------------------------------
        protected void OnEnable()
        {
            if (GAME != null)
            {
                activeTm       = null;
                selectionIndex = 0;
            }
        }
コード例 #2
0
ファイル: GameController.cs プロジェクト: zhifez/gamejams
 private void StopManageTM()
 {
     currentState      = State.idle;
     UI_TM.enabled     = false;
     SCIENTIST.enabled = true;
     activeTmMachine   = null;
     CAMERA.SetLookAtTarget(null);
 }
コード例 #3
0
ファイル: UI_TmKiosk.cs プロジェクト: zhifez/gamejams
        //--------------------------------------------------
        // private
        //--------------------------------------------------

        //--------------------------------------------------
        // public
        //--------------------------------------------------
        public void Setup(TransmissionMachine _tmMachine)
        {
            title.text         = _tmMachine.name;
            instructions.text  = "press W/S or Arrow Up/Down keys to switch between an offset value to alter (arranged by linked satelite dishes)";
            instructions.text += "\npress A/D or Arrow Left/Right keys to change the offset value";
            instructions.text += "\npress ESCAPE to close this window";
            enabled            = true;
        }
コード例 #4
0
ファイル: GameController.cs プロジェクト: zhifez/gamejams
        public void ManageTM(string tmId)
        {
            currentState      = State.manage_tm;
            SCIENTIST.enabled = false;

            foreach (TransmissionMachine tm in tmMachines)
            {
                if (tm.name.Equals(tmId))
                {
                    activeTmMachine = tm;
                    break;
                }
            }

            UI_TM.Setup(activeTmMachine);
            CAMERA.SetLookAtTarget(activeTmMachine.transform);
        }
コード例 #5
0
ファイル: UI_TmKiosk.cs プロジェクト: zhifez/gamejams
        public void UpdateValues(TransmissionMachine tm)
        {
            values.text = "";
            if (tm.linkedSatDishes.Count <= 0)
            {
                values.text  = "this machine is not linked to any satelite dish";
                values.text += "\ngo to the central kiosk to link them up";
                return;
            }

            for (int a = 0; a < tm.linkedSatDishes.Count; ++a)
            {
                if (a > 0)
                {
                    values.text += "\n";
                }
                values.text += tm.linkedSatDishes[a].sateliteDish.name;

                float _valueX = tm.linkedSatDishes[a].sateliteDish.valueX;
                float _valueY = tm.linkedSatDishes[a].sateliteDish.valueY;
                values.text += " (str: " + _valueX.ToString("N2");
                values.text += ", spd: " + _valueY.ToString("N2") + ")";
                int    _index    = Mathf.FloorToInt(( float )tm.linkedSatDishIndex / 2f);
                string _selected = "";
                if (_index == a && tm.linkedSatDishIndex % 2 == 0)
                {
                    _selected += "> ";
                }
                float _valueDeci = tm.linkedSatDishes[a].signalStrengthOffset;
                values.text += "\n  " + _selected + "signal strength offset: " + _valueDeci.ToString("N2");

                _selected = "";
                if (_index == a && tm.linkedSatDishIndex % 2 == 1)
                {
                    _selected += "> ";
                }
                _valueDeci   = tm.linkedSatDishes[a].signalSpeedOffset;
                values.text += "\n  " + _selected + "signal speed offset: " + _valueDeci.ToString("N2");
            }
        }
コード例 #6
0
ファイル: GameController.cs プロジェクト: zhifez/gamejams
 public MachineLink(TransmissionMachine tm, SateliteDish sat)
 {
     this.tm  = tm;
     this.sat = sat;
 }
コード例 #7
0
        protected void Update()
        {
            if (activeTm == null)
            {
                if (Input.GetKeyDown(KeyCode.A) ||
                    Input.GetKeyDown(KeyCode.LeftArrow))
                {
                    AudioController.Play("ui_btn_direction");
                    --selectionIndex;
                }

                if (Input.GetKeyDown(KeyCode.D) ||
                    Input.GetKeyDown(KeyCode.RightArrow))
                {
                    AudioController.Play("ui_btn_direction");
                    ++selectionIndex;
                }

                if (Input.GetKeyDown(KeyCode.S) ||
                    Input.GetKeyDown(KeyCode.DownArrow))
                {
                    AudioController.Play("ui_btn_direction");
                    activeTm       = GAME.tmMachines[selectionIndex];
                    selectionIndex = 0;
                }
            }
            else
            {
                if (Input.GetKeyDown(KeyCode.W) ||
                    Input.GetKeyDown(KeyCode.UpArrow))
                {
                    AudioController.Play("ui_btn_direction");
                    --selectionIndex;
                }

                if (Input.GetKeyDown(KeyCode.S) ||
                    Input.GetKeyDown(KeyCode.DownArrow))
                {
                    AudioController.Play("ui_btn_direction");
                    ++selectionIndex;
                }

                if (Input.GetKeyDown(KeyCode.J) ||
                    Input.GetKeyDown(KeyCode.Z))
                {
                    // link or unlink
                    AudioController.Play("ui_btn_toggle");

                    SateliteDish sd        = GAME.satDishes[selectionIndex];
                    bool         _isLinked = activeTm.SateliteDishIsLinked(sd);
                    if (_isLinked)
                    {
                        activeTm.UnlinkSateliteDish(sd);
                    }
                    else
                    {
                        activeTm.LinkSateliteDish(sd, 0f, 0f);
                    }
                }
            }

            for (int a = 0; a < GAME.tmMachines.Length; ++a)
            {
                labels[a].text = "";
                TransmissionMachine tm = GAME.tmMachines[a];
                if (!tm.gameObject.activeSelf)
                {
                    continue;
                }

                if (activeTm == tm)
                {
                    labels[a].text = "<b>" + tm.name + "</b>";
                }
                else if (activeTm == null && selectionIndex == a)
                {
                    labels[a].text = "> " + tm.name;
                }
                else
                {
                    labels[a].text += tm.name;
                }

                for (int b = 0; b < GAME.satDishes.Length; ++b)
                {
                    SateliteDish sd = GAME.satDishes[b];
                    if (!sd.enabled)
                    {
                        continue;
                    }

                    labels[a].text += "\n  ";
                    if (activeTm == tm &&
                        selectionIndex == b)
                    {
                        labels[a].text += "> ";
                    }

                    bool _isLinked = tm.SateliteDishIsLinked(sd);
                    labels[a].text += (_isLinked ? "[X] " : "[] ") + sd.name;
                }
            }
        }