예제 #1
0
    void Update()
    {
        JSAngle JS = GameObject.Find("Canvas_2").GetComponent <JSAngle>();

        JS.HealthSliderValue = Health;

        //if (Health > 150) Health = 150;
        if (Health <= 0)
        {
            Health = 0;
            Player.GetComponent <Movement1>().Death();
        }
    }
예제 #2
0
    void Update()
    {
        JSAngle JS = GameObject.Find("Canvas_2").GetComponent <JSAngle>();

        Mov = Weapon.parent.GetComponent <Movement1>();

        if (Mov.Attack || JS.Abool == true)
        {
            Wp = true;
            Invoke("WpF", 0.01f);
        }

        Weapon.gameObject.GetComponent <BoxCollider2D>().enabled = (Wp);

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene("mainmenuscene");
        }
    }
예제 #3
0
    void Update()
    {
        //Application.targetFrameRate = 1;
        isOnGround = Physics2D.OverlapCircle(groundCheck.position, 0.1f, Ground);
        JSAngle JS = GameObject.Find("Canvas_2").GetComponent <JSAngle>();

        Angle = JS.Angle;
        Bbool = JS.Bbool;

        /*
         * if (Angle != 0) {
         * D =  Mathf.Sign(Angle);
         * } else */

        anim.SetFloat("Speed", Mathf.Abs(Input.GetAxis("Horizontal")));

        //Drag
        if (Input.GetKeyDown(KeyCode.E))
        {
            DragOn();
        }
        if (Input.GetKeyUp(KeyCode.E))
        {
            DragOff();
        }

        if (Player.position.y < -5)
        {
            Death();
        }

        if (Player.position.x > 217)
        {
            winEvent();
        }


        //Trigger Attack
        if (Input.GetKeyDown(KeyCode.X) && !Player.gameObject.GetComponent <Attack>().Wp&& isOnGround)
        {
            Attack = true;
            D      = 0;
            Invoke("atReset", 0.1f);
            anim.SetTrigger("Attack");
            audioMan.PlayOnce(2, 10);
        }

        //Walk Animation Controllers
        if (isOnGround)
        {
            if (D == 0)
            {
                rbPlayer.velocity = rbPlayer.velocity - ((rbPlayer.velocity * 1.5f));
                //Idle anim-Sound Here
                anim.SetBool("Idle", true);
                anim.SetBool("Walk", false);
                audioMan.StopSound();
            }
            else
            {
                //Walk anim-sound Here
                anim.SetBool("Idle", false);
                anim.SetBool("Walk", true);
                audioMan.PlaySound(0);
            }
        }

        //falling anims
        if (rbPlayer.velocity.y < 0 && a == true)
        {
            anim.SetBool("Falling", true);
            Fall_State = 0;
            a          = false;
        }
        if (rbPlayer.velocity.y < -0.1f)
        {
            Fall_State = 1;
        }
        if (isOnGround && anim.GetBool("Falling"))
        {
            rbPlayer.velocity = new Vector2(rbPlayer.velocity.x, 0);
            anim.SetBool("Falling", false);
            Fall_State = 2;
            a          = true;
            Invoke("rReset", 0.4f);
        }

        anim.SetInteger("Falling_State", Fall_State);
        //--------------------
    }