using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class BobAnimateController : MonoBehaviour {

    public float blend = 0f;
    public bool doWalk = false;
    public bool doJump = false;

    public bool doPunch = false;
    public bool doKick = false;

    public bool isDead = false;
    
    public bool wasHit = false;


    public Animator _animator;


    private void Awake()
    {
        _animator = GetComponent<Animator>();
    }


    // Use this for initialization
    void Start () {
        doWalk = false;
        doPunch = false;
        doKick = false;
        isDead = false;
        wasHit = false;

	}
	
	// Update is called once per frame
	void Update () {        
        int i = Random.Range(0, 10);
        if (doWalk)
            {
            _animator.SetTrigger("locomotion");
            doWalk = false;
            }
        if (doJump)
            {
            _animator.SetTrigger("jump");
            doJump = false;
            }

        if (doPunch)
        {
            if (i < 5 )
            {
                _animator.SetTrigger("punchRT");
                doPunch = false;
            }
            else
            {
                _animator.SetTrigger("punchLT");
                doPunch = false;
            }


            
        }
        if (doKick)
        {
            if (i > 4)
            {
                _animator.SetTrigger("kickRT");
                doKick = false;
            }
            else
            {
                _animator.SetTrigger("kickLT");
                doKick = false;
            }

        }
        if (isDead)
        {
            _animator.SetTrigger("dead");
        }

        if (wasHit)
        {
            _animator.SetTrigger("Hit");
            wasHit = false;
        }

        _animator.SetFloat("Blend", blend);




    }
}
