Exemplo n.º 1
0
 public override void Update()
 {
     if (SimpleInput.GetKeyDown(KeyCode.Space))
     {
         HomingMeSoul.Core.AppCore.Instance.RestartApp();
     }
 }
Exemplo n.º 2
0
    void Update()
    {
        bool grounded_ = Physics2D.OverlapCircle(groundCheck.position, groundRadius, whatIsGround);

        //if (grounded_ && !grounded)
        //    jumpMove = 0;
        grounded = grounded_;
        checkJump();
        if (SimpleInput.GetKey(KeyCode.R))
        {
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }

        if (SimpleInput.GetKeyDown(KeyCode.Escape))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("GameMenu");
            #if !UNITY_EDITOR
            //Application.Quit();
            #endif

            #if UNITY_EDITOR
            //UnityEditor.EditorApplication.isPlaying = false;
            #endif
        }
    }
Exemplo n.º 3
0
 //new for p5
 public void showInventory()
 {
     if (!(SimpleInput.GetKeyDown(KeyCode.H)))
     {
         panel.SetActive(!panel.activeSelf);
         UpdateUI();
     }
 }
Exemplo n.º 4
0
 public override void Update()
 {
     if (SimpleInput.GetKeyDown(Context.keyCode))
     {
         ChangeState(new Flying(StateMachine));
         return;
     }
     GameCore.Instance.SpinCharacterAtPosition(Context, startPos);
 }
Exemplo n.º 5
0
 //new for p5
 public void pauseGame()
 {
     if (!(SimpleInput.GetKeyDown(KeyCode.P)))
     {
         active         = !active;
         canvas.enabled = active;
         Time.timeScale = (active) ? 0:1f;
     }
 }
Exemplo n.º 6
0
 private void checkJump()
 {
     if (!damaged && grounded && (SimpleInput.GetKeyDown(KeyCode.W) || SimpleInput.GetKeyDown(KeyCode.UpArrow) || isJumpDown)) //isJumpDown
     {
         jump = true;
         //jumpMove = move;
         isJumpDown = false;
     }
 }
Exemplo n.º 7
0
        public override void Update()
        {
            if (SimpleInput.GetKeyDown(Context.keyCode))
            {
                ChangeState(new Flying(StateMachine));
                return;
            }

            GameCore.Instance.RotatePlayerOnLocation(Context, rotatingOn.position);
        }
Exemplo n.º 8
0
 public override void Update()
 {
     foreach (KeyCode vKey in Context.allowedKeys)
     {
         if (SimpleInput.GetKeyDown(vKey))
         {
             Context.TogglePlayer(vKey);
         }
     }
 }
Exemplo n.º 9
0
    private void Update()
    {
        FlipPlayer();
        if (SimpleInput.GetKeyDown(KeyCode.Space) && isground == true)
        {
            rb.AddForce(Vector2.up * height);
            //anim.SetBool("jump", true);
            isground = false;
        }
        healthslider.value = health;

        if (health <= 0)
        {
            Destroy(gameObject);
        }
    }
Exemplo n.º 10
0
        public override void Update()
        {
            if (SimpleInput.GetKeyDown(Context.keyCode))
            {
                ChangeState(new Flying(StateMachine));
                return;
            }

            if (Time.frameCount > lastDeliverFrame + GameCore.Instance.config.Value.updatesDelayBetweenDeliver && Context.supplyPoint > 0)
            {
                GameCore.Instance.scoreBase.gameObject.GetComponent <ScoreBase>().DeliverPickups(Context.keyCode, 1);
                Context.scoreThisGame += 1;
                Context.supplyPoint   -= 1;

                lastDeliverFrame = Time.frameCount;
            }

            GameCore.Instance.RotatePlayerInHome(Context);
        }
    void Hareket()
    {
        transform.Translate(0, 0, oyunYonetim.KarakterHiz * Time.deltaTime);

        if (SimpleInput.GetKeyDown(KeyCode.UpArrow) && YerdeMi)
        {
            YerdeMi = false;
            animator.SetBool("Zipla", true);
            //rigidbody2.velocity = Vector3.up * 300f * Time.deltaTime;
            transform.Translate(0, 2f * Time.deltaTime, 0);

            Invoke("ZiplaIptal", 0.5f);
        }

        if (SimpleInput.GetKeyDown(KeyCode.RightArrow))
        {
            yon = 1;
        }

        if (SimpleInput.GetKeyDown(KeyCode.LeftArrow))
        {
            yon = 2;
        }

        if (SimpleInput.GetKeyDown(KeyCode.DownArrow))
        {
            yon = 3;
        }

        if (yon == 1)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(69f, transform.position.y, transform.position.z), Time.deltaTime * 2f);
        }
        else if (yon == 2)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(50f, transform.position.y, transform.position.z), Time.deltaTime * 2f);
        }
        else if (yon == 3)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(60f, transform.position.y, transform.position.z), Time.deltaTime * 2f);
        }
    }
Exemplo n.º 12
0
    void FixedUpdate() //Dans FixedUpdate pour jouer sur la physique
    {
        //Quand on appuie sur la barre espace ...
        if (SimpleInput.GetKeyDown(KeyCode.Space))
        {
            //Et qu'on est au sol ...
            if (ent.isGrounded)
            {
                //On saute !
                rb.velocity    = new Vector2(rb.velocity.x, jumpForce);
                stoppedJumping = false;
            }
        }

        //Si on reste appuyé...
        if ((SimpleInput.GetKey(KeyCode.Space)) && !stoppedJumping)
        {
            //et que le compteur n'a pas atteint 0...
            if (jumpTimeCounter > 0)
            {
                // On saute plus haut !
                rb.velocity      = new Vector2(rb.velocity.x, jumpForce);
                jumpTimeCounter -= Time.deltaTime;
            }
        }


        //Quand on lache le bouton...
        if (SimpleInput.GetKeyUp(KeyCode.Space))
        {
            //On arrete de sauter et on réinitialise le comptuer.
            jumpTimeCounter = 0;
            stoppedJumping  = true;
        }

        //Ajoute une force rappel vers le sol lors de la chute (commence avant le sommet de la parabole, ajuster ySpeedLimit pour avoir le meilleur resultat)
        if (rb.velocity.y < ySpeedLimit)
        {
            rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier) * Time.deltaTime;
        }
    }
Exemplo n.º 13
0
    /// <summary>
    /// Find user input. Should put this in its own class but im lazy
    /// </summary>
    private void MyInput()
    {
        x         = SimpleInput.GetAxisRaw("Horizontal");
        y         = SimpleInput.GetAxisRaw("Vertical");
        jumping   = SimpleInput.GetButton("Jump");
        crouching = SimpleInput.GetButton("Crouch");
        if (SimpleInput.GetKeyDown(KeyCode.Q))
        {
            DamagePlayer();
        }

        //Crouching
        if (SimpleInput.GetButtonDown("Crouch"))
        {
            StartCrouch();
        }
        if (SimpleInput.GetButtonUp("Crouch"))
        {
            StopCrouch();
        }
    }
Exemplo n.º 14
0
    void Haraket()
    {
        transform.Translate(0f, 0f, Hiz * Time.deltaTime);

        if (SimpleInput.GetKeyDown(KeyCode.UpArrow) && YerdeMi)
        {
            YerdeMi = false;
            transform.Translate(0f, 2f, 0f);
            animator.SetBool("Zipla", true);
            Invoke("ZiplaIptal", 0.5f);
        }

        if (SimpleInput.GetKeyDown(KeyCode.LeftArrow))
        {
            Yol = 1;
        }

        if (SimpleInput.GetKeyDown(KeyCode.RightArrow))
        {
            Yol = 2;
        }

        if (SimpleInput.GetKeyDown(KeyCode.DownArrow))
        {
            Yol = 3;
        }

        if (Yol == 1)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(transform.position.x, transform.position.y, SolKord), Time.deltaTime * 2f);
        }
        else if (Yol == 2)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(transform.position.x, transform.position.y, SagKord), Time.deltaTime * 2f);
        }
        else if (Yol == 3)
        {
            transform.position = Vector3.Lerp(transform.position, new Vector3(transform.position.x, transform.position.y, OrtKord), Time.deltaTime * 2f);
        }
    }
Exemplo n.º 15
0
    // Update is called once per frame
    void Update()
    {
        //Get input from the input manager, round it to an integer and store in horizontal to set x axis move direction
        moveInput.x = SimpleInput.GetAxisRaw("Horizontal");
        moveInput.y = SimpleInput.GetAxisRaw("Vertical");
        moveInput.Normalize();
        //Move the player
        if (!isSliding)
        {
            rigidBodyPlayer.velocity = moveInput * activeMoveSpeed;
        }
        else
        {
            rigidBodyPlayer.velocity = Vector3.ClampMagnitude(rigidBodyPlayer.velocity, 15);
            rigidBodyPlayer.AddForce(moveInput * moveForce);
        }
        //Hitbox and Animation
        if (moveInput.magnitude > 0)
        {
            animator.SetBool("isMoving", true);
            animator.SetFloat("Horizontal", moveInput.x);
            animator.SetFloat("Vertical", moveInput.y);
            savedInput = moveInput;
            //Attack HitBox Change Direction
            radian = Convert.ToSingle(Math.Atan2(moveInput.y, moveInput.x));
            hitBoxObject.transform.position = gameObject.transform.position + new Vector3(Convert.ToSingle(attackRange * Math.Cos(radian)), Convert.ToSingle(attackRange * Math.Sin(radian)), 0);
        }
        else
        {
            animator.SetBool("isMoving", false);
            animator.SetFloat("Horizontal", savedInput.x);
            animator.SetFloat("Vertical", savedInput.y);
        }
        if (SimpleInput.GetKeyDown(KeyCode.Backspace))
        {
            GameManager.instance.nextMap();
        }
        if (playerWeapons.Count > 0)
        {
            //Weapon change part
            if (SimpleInput.GetKeyDown(KeyCode.E))
            {
                nextWeapon();
            }
            float d = Input.GetAxis("Mouse ScrollWheel");
            if (d > 0f)
            {
                nextWeapon();
            }
            if (d < 0f)
            {
                currWeaponPos = autoDecrement(currWeaponPos, playerWeapons.Count);
                changeWeaponPlayerTo(currWeaponPos);
            }
        }

        //Player Dash Part
        if (SimpleInput.GetKeyDown(KeyCode.Space))
        {
            startDash();
        }
        if (dashCounter > 0)
        {
            dashCounter -= Time.deltaTime;
            if (dashCounter <= 0)
            {
                activeMoveSpeed = moveSpeed;
                dashCoolCounter = dashCooldown;
            }
        }
        if (dashCoolCounter > 0)
        {
            dashCoolCounter -= Time.deltaTime;
        }
    }