Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        mInput = this.gameObject.AddComponent<SInput>();
        InputReceiver inputRecObj = MainRoleModel.AddComponent<InputReceiver>();
        SMovableObject moveObj = MainRoleModel.AddComponent<SMovableObject>();
        inputRecObj.MovableObject = moveObj;
        mInput.InputReceiver = inputRecObj;

        //Camera init
        gameObject.AddComponent<SCameraMgr>();
    }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        mInput = this.gameObject.AddComponent <SInput>();
        InputReceiver  inputRecObj = MainRoleModel.AddComponent <InputReceiver>();
        SMovableObject moveObj     = MainRoleModel.AddComponent <SMovableObject>();

        inputRecObj.MovableObject = moveObj;
        mInput.InputReceiver      = inputRecObj;

        //Camera init
        gameObject.AddComponent <SCameraMgr>();
    }
Ejemplo n.º 3
0
        private void SetMicConfig()
        {
            if (_DeviceNr < 0)
            {
                return;
            }
            SInput input = _devices[_DeviceNr].Inputs[_InputNr];

            input.PlayerChannel1 = SelectSlides[htSelectSlides(SelectSlideRecordChannel1)].Selection;
            input.PlayerChannel2 = SelectSlides[htSelectSlides(SelectSlideRecordChannel2)].Selection;
            _devices[_DeviceNr].Inputs[_InputNr] = input;
        }
Ejemplo n.º 4
0
    public void ManualUpdate()
    {
        if (!photonView.isMine)
        {
            return;
        }

        _input = new SInput()
        {
            movementDirection   = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical")),
            aimTarget           = GetAimTarget(),
            mousePosition       = Input.mousePosition,
            weaponTriggerPulled = Input.GetMouseButton(0),
            reloadWeapon        = Input.GetKeyDown(KeyCode.R),
            pickUpWeapon        = Input.GetKeyDown(KeyCode.E),
            dropWeapon          = Input.GetKeyDown(KeyCode.G)
        };
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        mInput = this.gameObject.AddComponent<SInput>();
        InputReceiver inputRecObj = MainRoleModel.AddComponent<InputReceiver>();
        SMovableObject moveObj = MainRoleModel.AddComponent<SMovableObject>();
        inputRecObj.MovableObject = moveObj;
        mInput.InputReceiver = inputRecObj;

        //Camera init
        gameObject.AddComponent<SCameraMgr>();

        //Dungeon init
        GameObject go = Instantiate(DungeonMgrPrefab) as GameObject;
        Common.changGOParent(go, gameObject);

        moveObj.MoveTo(DungeonMgr.Instance.CurRoomPos());

        //MainGameData init
        MainGameData.MainRole = moveObj;
    }
Ejemplo n.º 6
0
    // Use this for initialization
    void Start()
    {
        mInput = this.gameObject.AddComponent <SInput>();
        InputReceiver  inputRecObj = MainRoleModel.AddComponent <InputReceiver>();
        SMovableObject moveObj     = MainRoleModel.AddComponent <SMovableObject>();

        inputRecObj.MovableObject = moveObj;
        mInput.InputReceiver      = inputRecObj;

        //Camera init
        gameObject.AddComponent <SCameraMgr>();

        //Dungeon init
        GameObject go = Instantiate(DungeonMgrPrefab) as GameObject;

        Common.changGOParent(go, gameObject);

        moveObj.MoveTo(DungeonMgr.Instance.CurRoomPos());

        //MainGameData init
        MainGameData.MainRole = moveObj;
    }
Ejemplo n.º 7
0
        public static SRecordDevice[] RecordGetDevices()
        {
            SRecordDevice[] devices = _Record.RecordDevices();

            if (devices != null)
            {
                for (int dev = 0; dev < devices.Length; dev++)
                {
                    for (int inp = 0; inp < devices[dev].Inputs.Count; inp++)
                    {
                        SInput input = devices[dev].Inputs[inp];

                        input.PlayerChannel1 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 1);
                        input.PlayerChannel2 = GetPlayerFromMicConfig(devices[dev].Name, devices[dev].Driver, input.Name, 2);

                        devices[dev].Inputs[inp] = input;
                    }
                }
                return(devices);
            }

            return(null);
        }
Ejemplo n.º 8
0
        public void Update()
        {
            var keyMod = SInput.GetMod();

            if (SInput.HasOnlyKeyDown(keyMod, App.Config.mainKey))
            {
                lock (App.Config.UILock) {
                    // should be visible this time?
                    if (!Config.IsVisible)
                    {
                        if (!App.Config.UI.masterToolbarVisibility)
                        {
                            App.Config.UI.masterToolbarVisibility = true;
                            UIView.Show(true);
                        }
                        SetVisible(true);
                    }
                    else
                    {
                        SetVisible(false);
                    }
                }
            }
        }
Ejemplo n.º 9
0
    public void FixedUpdateController()
    {
        #region Jump
        if (isFly != null)
        {
            if ((bool)isFly?.Invoke())
            {
                Debug.Log("jump");
                isFly    -= SInput.InputJump;
                isGround += SController.IsGround;
                SController.Jump(_extraJump, _jumpForce, _rb);

                SetLastState();
                StateMachine.SetState(State.JUMP, _animate);
            }
        }

        if (isGround != null)
        {
            if (!(bool)isGround?.Invoke(_groundChek, _checkRadius, _whatIsGround))
            {
                _isJump = true; //Ждем достаточной высоты для активации чека
            }
            else if (_isJump)
            {
                Debug.Log("ground");
                isGround -= SController.IsGround;
                isFly    += SInput.InputJump;

                StateMachine.SetState(_lastState, _animate);
                _isJump = false;
            }
        }

        if (isFly != null && isGround != null) //костыль на баг
        {
            isGround -= SController.IsGround;
            Debug.Log("error");
        }
        #endregion

        #region Move
        if (checInput != null) //Вводные перемещения
        {
            if (checInput?.Invoke() != 0 && isMove == null)
            {
                isMove += SController.Move;
                goFlip += SController.Flip;

                StateMachine.SetState(State.MOVE, _animate);
                SetLastState();
            }
            else if (checInput?.Invoke() == 0 && isMove != null)
            {
                isMove?.Invoke(0, _speed, _rb); //Костыль на отпись, сохраняется текущее значение, изменить контроллер
                isMove -= SController.Move;
                goFlip -= SController.Flip;

                StateMachine.SetState(State.IDLE, _animate);
                SetLastState();
            }
        }

        if (isMove != null)
        {
            if (!_isAttack)
            {
                isMove?.Invoke(SInput.InputControll(), _speed, _rb);
                if (goFlip != null)
                {
                    goFlip?.Invoke(_rb, _enemyGFX);
                }
            }
            else
            {
                isMove?.Invoke(0, _speed, _rb);
            }
        }
        #endregion

        #region Attack
        if (isAttack != null) //костыль на фикс проверки
        {
            if (isAttack?.Invoke() == 1)
            {
                SController.AttackCollision(_colliderAttack[0], true);

                if (!_isAttack)
                {
                    SetLastState();
                }
                StateMachine.SetState(State.ATTACK, _animate);

                isFly     -= SInput.InputJump;
                checInput -= SInput.InputControll;
                if (isMove != null)
                {
                    isMove?.Invoke(0, _speed, _rb);
                }


                _isAttack = true;
            }

            if (!_colliderAttack[0].active && _isAttack)
            {
                StateMachine.SetState(_lastState, _animate);
                SetLastState();
                _isAttack = false;

                isFly     += SInput.InputJump;
                checInput += SInput.InputControll;
            }
        }
        #endregion



        if (isFly == null && checInput == null && isAttack == null) //Костыль на нулевое состояние
        {
            StateMachine.SetState(State.IDLE, _animate);
        }
    }