Ejemplo n.º 1
0
 void Awake()
 {
     inputState     = GetComponent <inputState> ();
     walkBehavior   = GetComponent <walk> ();
     animator       = GetComponent <Animator> ();
     collisionState = GetComponent <collisionState> ();
     duckBehavior   = GetComponent <duck> ();
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     _state              = new inputState();
     _controller         = GetComponent <CharacterController>();
     _velocity           = new Vector3(0.0f, 0.0f, 0.0f);
     _normalizedMovement = new Vector3(0.0f, 0.0f, 0.0f);
     _acceleration       = Parameters.acceleration;
     _maxSpeed           = Parameters.maxSpeed;
 }
 public ProcessGPIOEvents(ProcessGPIOEvents right)
 {
     m_Ident                    = right.m_Ident;
     m_GPIOInputs               = new List <GPIOObjectProcess>(right.m_GPIOInputs);
     m_GPIOOutputs              = new List <GPIOObjectProcess>(right.m_GPIOOutputs);
     m_AccessRights             = right.m_AccessRights;
     m_GPIOEnvironmentConnector = right.m_GPIOEnvironmentConnector;
     m_InputState               = right.m_InputState;
     m_FlankTicks               = right.m_FlankTicks;
 }
 public ProcessGPIOEvents(string Ident)
 {
     m_Ident                    = Ident;
     m_GPIOInputs               = new List <GPIOObjectProcess>();
     m_GPIOOutputs              = new List <GPIOObjectProcess>();
     m_AccessRights             = 0;
     m_GPIOEnvironmentConnector = null;
     m_InputState               = inputState.waitforInitFlank;
     //   m_LookFor = null;
     m_FlankTicks = 0;
 }
Ejemplo n.º 5
0
 // We initialize each input.
 void Start()
 {
     inputs = new inputState[trueInputNames.Length];
     for(int i = 0; i < trueInputNames.Length ; i += 1){
         inputState toPut = new inputState();
         toPut.type = i;
         toPut.trueInputName = trueInputNames[i];
         toPut.isActive = false;
         toPut.lastTimePressed = 0;
         inputs[i] = toPut;
     }
 }
Ejemplo n.º 6
0
        void Update()
        {
            if (input.action2 && !hitboxHolder.doingAttack)
            {
                AttackData d       = attacks.neutral;
                inputState myState = getCurrentState();
                switch (myState)
                {
                case inputState.neutral:
                    d = attacks.neutral;
                    break;

                case inputState.ftilt:
                    d = attacks.fTilt;
                    break;

                case inputState.dtilt:
                    d = attacks.dTilt;
                    break;

                case inputState.utilt:
                    d = attacks.uTilt;
                    break;

                case inputState.uair:
                    d = attacks.uAir;
                    break;

                case inputState.fair:
                    d = attacks.fAir;
                    break;

                case inputState.bair:
                    d = attacks.bAir;
                    break;

                case inputState.dair:
                    d = attacks.dAir;
                    break;

                case inputState.nair:
                    d = attacks.nAir;
                    break;
                }
                createAttack(d);
            }
        }
Ejemplo n.º 7
0
 public void Die()
 {
     //Debug.Log("Die");
     if (playerState == inputState.ragdoll)
     {
         playerState = inputState.free;
         ragdoll.Die();
     }
     headDirection.gameObject.GetComponent <Camera>().fieldOfView = 179;
     move._movState = PlayerMovement.movementState.standing;
     GetComponent <Rigidbody> ().velocity = Vector3.zero;
     move.grounded          = true;
     move.timeSinceGrounded = 0;
     if (blinkBall != null)
     {
         Destroy(blinkBall.gameObject);
     }
     transform.position = currentRespawnPoint.position;
     currentRespawnPoint.GetComponent <SpawnPoint>().RespawnFX();
 }
Ejemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     body2d     = GetComponent <Rigidbody2D> ();
     inputState = GetComponent <inputState> ();
 }
Ejemplo n.º 9
0
    // Fixed update from PlayerScript
    public virtual void UpdatePhysics()
    {
        currentCharacterState = characterState.Idle;

        physVel = Vector2.zero;

        // move left
        if(xCurrentInputState == inputState.Walk)
        {
            physVel.x = walkVel * xAcceleration;
            currentCharacterState = characterState.Walk;
        } else if(xCurrentInputState == inputState.Run){
            currentCharacterState = characterState.Run;
            physVel.x = runVel * xAcceleration;
        }

        if(detectFall())
        {
            grounded = false;
            currentCharacterState = characterState.Jump;
            _rigidbody.AddForce(-Vector3.up * fallVel);
        }
        else {
            grounded = true;
            jumps = 0;
        }

        //wall jump
        if (!grounded && detectWallSlide ()) {
            jumps = 0;
        }

        // jump (after raycasting to avoid unfortunate jump reset even before actually jumping)
        if(yCurrentInputState == inputState.Jump)
        {
            if(jumps < maxJumps)
            {
                GlobalHandlers.soundManager.PlayJump();
                jumps ++;
                if(jumps == 1)
                {
                    _rigidbody.velocity = new Vector2(physVel.x, jumpVel);
                }
                else {// Keeping it for later, no more double jump for now
                    _rigidbody.velocity = new Vector2(physVel.x, jump2Vel);
                }
            }
        }

        // actually move the player
        _rigidbody.velocity = new Vector2(physVel.x, _rigidbody.velocity.y);

        // inputstate reset once the command has been executed
        xCurrentInputState = inputState.None;
        yCurrentInputState = inputState.None;
    }
Ejemplo n.º 10
0
    public override void UpdatePlaying()
    {
        shootTimer += Time.deltaTime;
        bindings    = InputManager._instance.bindings;
        if (bindings.pauseGame.WasPressed)
        {
            Cursor.lockState  = CursorLockMode.None;
            Cursor.visible    = true;
            Globals.gameState = GameState.Paused;
        }
        if (playerState == inputState.free)
        {
            move.MovePlayer(new Vector3(bindings.move.X, 0, bindings.move.Y));

            if (bindings.fire.IsPressed && shootTimer > 0.25 && !weapon.charging)
            {
                if (CheckWallDistance())
                {
                    weapon.PrepareToFire();
                }
            }

            if (bindings.fire.WasReleased && weapon.charging)
            {
                if (CheckWallDistance())
                {
                    blinkBall       = weapon.Fire();
                    weapon.charging = false;
                }
            }

            if (bindings.blink.IsPressed)
            {
                if (blinkBall != null)
                {
                    blinkBall.SetPlayer(gameObject);
                }
                //peeking = true;
            }

            if (bindings.blink.WasReleased)
            {
                if (blinkBall != null)
                {
                    shootTimer = 0;
                    //peeking = false;
                    weapon.GetComponentInChildren <SkinnedMeshRenderer> ().enabled = true;
                    blinkBall.Teleport(gameObject);
                }
                else
                {
                    // Play an error sound or something;
                }
            }

            if (Input.GetKeyDown(KeyCode.V))
            {
                if (QualitySettings.vSyncCount != 0)
                {
                    QualitySettings.vSyncCount = 0;
                }
                else
                {
                    QualitySettings.vSyncCount = 1;
                }
            }
        }

        move.CameraMove(new Vector3(-bindings.look.Y, bindings.look.X, 0));

        if (bindings.ragdoll.WasPressed)
        {
            Debug.Log("Ragdoll toggle");
            if (playerState == inputState.free)
            {
                playerState = inputState.ragdoll;
                ragdoll.Activate();
            }
            else
            {
                playerState = inputState.free;
                ragdoll.Deactivate();
            }
        }

        if (bindings.respawn.WasPressed)
        {
            Die();
        }
    }
Ejemplo n.º 11
0
        private void MainLoop()
        {
            while (true)
            {
                Bitmap     screenshot   = Screen.CaptureWindow(OverwatchHandle);
                inputState currentstate = getState(screenshot);
                WindowRenderer.Render();
                if (currentstate != prevInputState)
                {
                    prevInputState = currentstate;
                    switch (currentstate)
                    {
                    case inputState.sessionbegin:
                        initiated = false;
                        KeyManager.SendKey(GetGameKey(gameKeys.Interact));     //This will take us to song info entering state | I ended up skipping it
                        break;

                    case inputState.inputsens:
                        KeyManager.SendBinaryInput(MakeItLeet(MouseSens.ToString()), OverwatchHandle);
                        KeyManager.SendKey(GetGameKey(gameKeys.Ultimate));
                        break;

                    case inputState.inputtype:
                        if (OWStuff.MouseSens == -60)
                        {
                            KeyManager.SendMEvent(KeyManager.mousevent.LeftClick, OverwatchHandle);
                        }
                        else
                        {
                            KeyManager.SendMEvent(KeyManager.mousevent.RightClick, OverwatchHandle);
                        }
                        break;

                    case inputState.hostage:
                        int winner = getVoteResult(screenshot);
                        //read the winner song and play it
                        if (winner == -69)
                        {
                            Console.WriteLine("Unable to recognize vote winner. You may need to update color definitions");
                            break;
                        }
                        Player.Player.Play(Player.Player.GetMusicUrl(winner));     //I think I had a stroke
                        KeyManager.SendKey(GetGameKey(gameKeys.Ultimate));
                        break;

                    case inputState.idle:
                        break;

                    case inputState.songlength:
                        if (!initiated)
                        {
                            KeyManager.SendInput(Player.Player.MusicInfo.length.ToString());
                            initiated = true;
                            Player.Player.Play(initurl);
                        }
                        else
                        {
                            KeyManager.SendInput(Player.Player.getSimilar[enteredInfoIter].length.ToString());
                            enteredInfoIter++;
                            if (enteredInfoIter == 3)
                            {
                                enteredInfoIter = 0;
                            }
                        }
                        KeyManager.SendKey(GetGameKey(gameKeys.Ultimate));
                        break;

                    case inputState.songname:
                        if (!initiated)
                        {
                            KeyManager.SendInput(Player.Player.MusicInfo.name + " | " + Player.Player.MusicInfo.artist);
                        }
                        else
                        {
                            KeyManager.SendInput(Player.Player.getSimilar[enteredInfoIter].name + "|" + Player.Player.getSimilar[enteredInfoIter].artist);     //I have no comments on my naming etiquette
                        }
                        Thread.Sleep(100);
                        KeyManager.SendKey(GetGameKey(gameKeys.Ultimate));
                        break;

                    case inputState.teleported:
                        break;

                    case inputState.unrecognized:
                        break;    //I don't know what to do with these informations
                    }
                }
                screenshot.Dispose();
                Player.Player.Tick();
                WindowRenderer.Render();
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 12
0
 public void setJumps(inputState toSet)
 {
     jump = toSet;
 }
Ejemplo n.º 13
0
 public void setJumps(inputState toSet)
 {
     jump = toSet;
 }
Ejemplo n.º 14
0
 public void setDirectionalY(inputState toSet)
 {
     directionalY = toSet;
 }
Ejemplo n.º 15
0
 public void setAttack(inputState toSet)
 {
     attack = toSet;
 }
Ejemplo n.º 16
0
 protected virtual void Awake()
 {
     inputState     = GetComponent <inputState> ();
     body2D         = GetComponent <Rigidbody2D> ();
     collisionState = GetComponent <collisionState> ();
 }
Ejemplo n.º 17
0
 public void setAttack(inputState toSet)
 {
     attack = toSet;
 }
Ejemplo n.º 18
0
    // Update is called once per frame
    public void Update()
    {
        if (networkView.isMine)
        {
            if (NetworkManager._playerPos == NetworkManager.PlayerPosition.Player1)
            {
                CamMovement._target = GameObject.FindGameObjectWithTag("Player1");
            }

            // these are false unless one of keys is pressed
            currentInputState = inputState.None;

            // keyboard input
            if (Input.GetKey (KeyCode.LeftArrow))
            {
                currentInputState = inputState.WalkLeft;
                facingDir = facing.Left;
            }
            if (Input.GetKey (KeyCode.RightArrow) && currentInputState != inputState.WalkLeft)
            {
                currentInputState = inputState.WalkRight;
                facingDir = facing.Right;
            }

            if (Input.GetKeyDown (KeyCode.UpArrow))
            {
                currentInputState = inputState.Jump;
            }

            UpdatePhysics ();
            checkIfFallen();
            manageCheckPoints();
        }
    }
Ejemplo n.º 19
0
 public void setDirectionalY(inputState toSet)
 {
     directionalY = toSet;
 }