Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     if (!status.getGrounded() && Input.GetButtonDown("GroundPound"))
     {
         pounding = true;
         anim.SetBool("Pounding", pounding);
     }
 }
Esempio n. 2
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log(Input.GetButtonDown("GroundPound"));

        if (!status.getGrounded() && Input.GetButtonDown("GroundPound"))
        {
            pounding = true;
            status.setPounding(true);
            anim.SetBool("Pounding", pounding);
            //Debug.Log("Ground pound input handled");

            if (!hangtime)
            {
                hangtime = true;
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        //Checks for the jump button press
        if (Input.GetButtonDown("Jump") && (status.getGrounded() || status.getHanging()))
        {
            jumped = true;
        }

        if (Input.GetButtonDown("Jump") && !(status.getGrounded() || status.getHanging()) && numberOfJumps > 0)
        {
            doubleJumped = true;
        }

        if (status.getGrounded() || status.getHanging())
        {
            numberOfJumps = 1;
            doubleJumped  = false;
        }
    }
Esempio n. 4
0
    void FixedUpdate()
    {
        if (playerVelocity > 0)
        {
            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x + playerVelocity, GetComponent <Rigidbody2D>().velocity.y);
            transform.localScale = new Vector3(faceRight, 1f, 1f);
            mattyFactor          = 1.0f;
        }

        if (playerVelocity < 0)
        {
            GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x + playerVelocity, GetComponent <Rigidbody2D>().velocity.y);
            transform.localScale = new Vector3(faceLeft, 1f, 1f);
            mattyFactor          = -1.0f;
        }

        if (playerVelocity == 0 && !status.getHanging() && status.getGrounded() && GetComponent <Rigidbody2D>().velocity.x != 0)
        {
            //changeFriction(0.4f);
            if (GetComponent <Rigidbody2D>().velocity.x < 0)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x + drag, GetComponent <Rigidbody2D>().velocity.y);
            }
            else if (GetComponent <Rigidbody2D>().velocity.x > 0)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x - drag, GetComponent <Rigidbody2D>().velocity.y);
            }

            if (GetComponent <Rigidbody2D>().velocity.x > -dragLimit && GetComponent <Rigidbody2D>().velocity.x < dragLimit)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(0, GetComponent <Rigidbody2D>().velocity.y);
            }
        }



        if (Mathf.Abs(GetComponent <Rigidbody2D>().velocity.x) > status.getMaxSpeed() && !status.getKnocked())
        {
            //Subtracts player velocity when over max speed, keeping the net gain at 0
            //GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x - playerVelocity, GetComponent<Rigidbody2D>().velocity.y);

            if (GetComponent <Rigidbody2D>().velocity.x > 0)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(status.getMaxSpeed(), GetComponent <Rigidbody2D>().velocity.y);
            }
            else if (GetComponent <Rigidbody2D>().velocity.x < 0)
            {
                GetComponent <Rigidbody2D>().velocity = new Vector2(-status.getMaxSpeed(), GetComponent <Rigidbody2D>().velocity.y);
            }
        }

        testSpeed = GetComponent <Rigidbody2D>().velocity.x;
    }
 // Update is called once per frame
 void Update()
 {
     if (status.getPounding())
     {
         gameObject.GetComponent <BoxCollider2D>().enabled = true;
         //box.enabled = true;
     }
     else if (status.getTechyBounce() || status.getGrounded())
     {
         gameObject.GetComponent <BoxCollider2D>().enabled = false;
         //box.enabled = false;
     }
 }
Esempio n. 6
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetButton("Laser") && ready)
        {
            charging = true;
            ready    = false;

            if (Input.GetAxisRaw("Horizontal") == -1)
            {
                fireDirection = 4;
            }

            if (Input.GetAxisRaw("Horizontal") == 1)
            {
                fireDirection = 2;
            }

            if (Input.GetAxisRaw("Vertical") == -1)
            {
                status.setShootDown(true);
                fireDirection = 3;
            }

            if (Input.GetAxisRaw("Vertical") == 1)
            {
                fireDirection = 1;
            }
        }
        else
        {
            if (charging)
            {
                charging = false;
                firing   = true;
            }
        }


        if (status.getGrounded())
        {
            status.setKnocked(false);
            ready = true;
        }
    }