// Update is called once per frame
    void Update()
    {
        // Player movement from input (it's a variable between -1 and 1) for
        // degree of left or right movement
        float moveVer = Input.GetAxis("Vertical");
        float moveHor = Input.GetAxis("Horizontal");


        //Player bouncing of walls//
        ///////////////////////////
        if (stoneWall)
        {
            if (moveHor < 0)
            {
                transform.Translate(0, 0, 0);
                stoneWall = false;
            }
            if (moveHor > 0)
            {
                transform.Translate(0, 0, 0);
                stoneWall = false;
            }
            if (moveVer < 0)
            {
                transform.Translate(0, 0, 0);
                stoneWall = false;
            }
            if (moveVer > 0)
            {
                transform.Translate(0, 0, 0);
                stoneWall = false;
            }
        }



        ///Player Punch////////////////
        /// /////////////////////////////
        if (Input.GetKeyDown("space"))
        {
            if (!animate.GetBool("Charge"))
            {
                attack.Punch();
            }
        }

        ///Player Charge////////////////
        /// /////////////////////////////
        if (Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
        {
            //if (attack.chargeAllowed) {

            attack.Charge();
            //animate.SetBool ("Charge", true);
        }
    }
Ejemplo n.º 2
0
    IEnumerator FakeUpdate()
    {
        while (true)
        {
            if (Input.GetButtonDown(shockInput))
            {
                attacks.Charge();
            }
            else if (Input.GetButtonUp(shockInput))
            {
                attacks.Shock();
            }

            yield return(null);
        }
    }
Ejemplo n.º 3
0
    public override void AgentAction(float[] vectorAction, string textAction)
    {
        base.AgentAction(vectorAction, textAction);

        if (vectorAction[0] != .0f && vectorAction[1] != .0f && vectorAction[0] <= 1f && vectorAction[1] <= 1f && vectorAction[0] >= -1f && vectorAction[1] >= -1f)
        {
            moves.Move(Vector2.ClampMagnitude(new Vector2(vectorAction[0], vectorAction[1]), 1f));
            AddReward(.001f);
        }

        if (!attacks.isCharging && vectorAction[2] >= .5f)
        {
            attacks.Charge();
            AddReward(.07f);
        }
        else if (attacks.isCharging && vectorAction[2] > 0 && vectorAction[2] < .5f)
        {
            attacks.Shock();

            AddReward(.015f * attacks.normalizedCharge);
        }

        AddReward(-.005f);
    }