Exemplo n.º 1
0
    public void ExecuteCommand(ServiceLocator.ID id)
    {
        //------------------------------
        //Item resource consumption should be relocated to objInteractionController
        //------------------------------
        if (id == ServiceLocator.ID.p0)
        {
            Command cmd;
            _eqptMenuModel.p0EqptCommandSeq.TryGetValue(_gameModel.EqptMenuSelect_P0, out cmd);

            //foreach (int sd in _eqptMenuModel.p0EqptCommandSeq.Keys)
            //{
            //    Debug.Log(sd);
            //    Command asdasd;
            //    _eqptMenuModel.p0EqptCommandSeq.TryGetValue(sd, out asdasd);
            //    Debug.Log(asdasd.target.ToString());

            //    CommandReferences ddd;
            //    _eqptMenuModel.p0EqptCommandsActive.TryGetValue(asdasd, out ddd);
            //    Debug.Log(ddd.name);
            //    if (ddd.target != null)
            //        Debug.Log("YAAAAAAAAAAAAAAAAAAAAAAAAY NOT NULL");
            //}

            CommandReferences cRef;
            _eqptMenuModel.p0EqptCommandsActive.TryGetValue(cmd, out cRef);

            if (cmd.action == ServiceLocator.Actions.Install)
            {
                //_objIntCtrlr.StowAndInstall(_eqptMenuModel.p0eqpt, cRef.target);
                ServiceLocator.Instance.TaskManager.StartTask(new Task_InstallThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef));
            }
            else if (cmd.action == ServiceLocator.Actions.Stow)
            {
                //_objIntCtrlr.StowAndInstall(_eqptMenuModel.p0eqpt, cRef.target);
                ServiceLocator.Instance.TaskManager.StartTask(new Task_StowThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef));
            }
            else if (cmd.action == ServiceLocator.Actions.Eject)
            {
                //Debug.Log(cRef.target.name);
                //_objIntCtrlr.Eject(_eqptMenuModel.p0eqpt, cRef.target);

                ServiceLocator.Instance.TaskManager.StartTask(new Task_EjectThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef));
            }
            else if (cmd.action == ServiceLocator.Actions.Unstow)
            {
                //_objIntCtrlr.Unstow(_eqptMenuModel.p0eqpt, cRef.target);
                ServiceLocator.Instance.TaskManager.StartTask(new Task_UnstowThing(null, id, _eqptMenuModel.p0eqpt, cmd, cRef));
            }
            else if (cmd.action == ServiceLocator.Actions.Exit)
            {
                _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Free);
            }
        }

        //_gameModel.SetControlState(id, ServiceLocator.ControlStates.Free);
    }
Exemplo n.º 2
0
    public override void S_Update()
    {
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Up, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.W));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Down, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.S));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Left, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.A));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Right, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.D));

        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Use, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.Q));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Grab, ServiceLocator.InputStates.Down, Input.GetKey(KeyCode.E));


        //--------------------------------------

        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Up, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.W));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Down, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.S));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Left, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.A));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Right, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.D));

        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Use, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.Q));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Grab, ServiceLocator.InputStates.OnDown, Input.GetKeyDown(KeyCode.E));


        //--------------------------------------

        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Up, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.W));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Down, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.S));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Left, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.A));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Right, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.D));

        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Use, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.Q));
        _inputModel.SetInputStates(ServiceLocator.ID.p0, ServiceLocator.Inputs.Grab, ServiceLocator.InputStates.OnUp, Input.GetKeyUp(KeyCode.E));



        if (Input.GetKeyDown(KeyCode.J))
        {
            _gameModel.SetGameState(ServiceLocator.GameStates.Play);
        }
        if (Input.GetKeyDown(KeyCode.K))
        {
            _gameModel.SetGameState(ServiceLocator.GameStates.Cutscene);
        }
        if (Input.GetKeyDown(KeyCode.L))
        {
            _gameModel.SetGameState(ServiceLocator.GameStates.Menu);
        }


        if (Input.GetKeyDown(KeyCode.Y))
        {
            _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Disabled);
        }
        if (Input.GetKeyDown(KeyCode.U))
        {
            _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Free);
        }
        if (Input.GetKeyDown(KeyCode.I))
        {
            _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Menu_Eqpt);
        }
        if (Input.GetKeyDown(KeyCode.O))
        {
            _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Occupied);
        }
        if (Input.GetKeyDown(KeyCode.P))
        {
            _gameModel.SetControlState(ServiceLocator.ID.p0, ServiceLocator.ControlStates.Station);
        }
    }