Beispiel #1
0
        //--------------------------------------------------
        // private
        //--------------------------------------------------

        //--------------------------------------------------
        // public
        //--------------------------------------------------
        public void Setup(SateliteDish _satDish)
        {
            title.text         = _satDish.name;
            instructions.text  = "press W/S or Arrow Up/Down keys to change " + _satDish.name + "'s facing direction vertically";
            instructions.text += "\npress A/D or Arrow Left/Right keys to change " + _satDish.name + "'s facing direction horizontally";
            instructions.text += "\npress ESCAPE to close this window";
            enabled            = true;
        }
Beispiel #2
0
 private void StopManageSatelite()
 {
     currentState      = State.idle;
     UI_SAT.enabled    = false;
     SCIENTIST.enabled = true;
     activeSatDish.RotateDish(0);
     activeSatDish = null;
     CAMERA.SetLookAtTarget(null);
 }
Beispiel #3
0
        public void LinkSateliteDish(SateliteDish _satDish, float _strength, float _speed)
        {
            EnableWave(_satDish.name);
            LinkedSatDish _lsd = new LinkedSatDish(_satDish);

            _lsd.signalStrengthOffset = _strength;
            _lsd.signalSpeedOffset    = _speed;
            _linkedSatDishes.Add(_lsd);
        }
Beispiel #4
0
 //--------------------------------------------------
 // public
 //--------------------------------------------------
 public bool SateliteDishIsLinked(SateliteDish _satDish)
 {
     foreach (LinkedSatDish lsd in _linkedSatDishes)
     {
         if (lsd.sateliteDish == _satDish)
         {
             return(true);
         }
     }
     return(false);
 }
Beispiel #5
0
 public void UnlinkSateliteDish(SateliteDish _satDish)
 {
     for (int a = 0; a < _linkedSatDishes.Count; ++a)
     {
         if (_linkedSatDishes[a].sateliteDish == _satDish)
         {
             _linkedSatDishes.RemoveAt(a);
             DisableWave(_satDish.name);
             break;
         }
     }
 }
Beispiel #6
0
        public void ManageSatelite(string sateliteId)
        {
            currentState      = State.manage_satelite;
            SCIENTIST.enabled = false;

            foreach (SateliteDish satDish in satDishes)
            {
                if (satDish.name.Equals(sateliteId))
                {
                    activeSatDish = satDish;
                    break;
                }
            }

            UI_SAT.Setup(activeSatDish);
            CAMERA.SetLookAtTarget(
                activeSatDish.transform,
                playerStartPos
                );
        }
Beispiel #7
0
 public MachineLink(TransmissionMachine tm, SateliteDish sat)
 {
     this.tm  = tm;
     this.sat = sat;
 }
Beispiel #8
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;
                }
            }
        }
Beispiel #9
0
 public LinkedSatDish(SateliteDish sateliteDish)
 {
     this.sateliteDish         = sateliteDish;
     this.signalStrengthOffset = 0f;
     this.signalSpeedOffset    = 0f;
 }