Exemplo n.º 1
0
    public override void UpdateAbility(CharacterStateBase characterStateBase, Animator animator, AnimatorStateInfo stateInfo)
    {
        AliController control = characterStateBase.GetBotController(animator);

        if (control.MoveRight && control.MoveLeft)
        {
            control.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
            animator.SetBool("IsRunning", false);
            return;
        }

        if (!control.MoveRight && !control.MoveLeft)
        {
            control.transform.rotation = Quaternion.Euler(0f, 180f, 0f);
            animator.SetBool("IsRunning", false);
            return;
        }

        if (control.MoveRight)
        {
            /* DONT NEED TO SWITCH TO RUN (THIS IS RUN SCRIPT), JUST MOVE */
            control.transform.Translate(Vector3.forward * Speed * Time.deltaTime);
            control.transform.rotation = Quaternion.Euler(0f, 90f, 0f);
            //animator.SetBool("IsRunning", true);
        }

        if (control.MoveLeft)
        {
            /* DONT NEED TO SWITCH TO RUN (THIS IS RUN SCRIPT), JUST MOVE */
            control.transform.Translate(Vector3.forward * Speed * Time.deltaTime);
            control.transform.rotation = Quaternion.Euler(0f, -90f, 0f);
            //animator.SetBool("IsRunning", true);
        }
    }
 public AliController GetBotController(Animator animator)
 {
     /* only want to do this once so return controller if not null */
     if (aliController == null)
     {
         aliController = animator.GetComponentInParent <AliController>();
     }
     return(aliController);
 }
Exemplo n.º 3
0
    public override void UpdateAbility(CharacterStateBase characterStateBase, Animator animator, AnimatorStateInfo stateInfo)
    {
        AliController ali = characterStateBase.GetBotController(animator);

        if (IsGrounded(ali))
        {
            animator.SetBool("IsGrounded", true);
        }
        else
        {
            animator.SetBool("IsGrounded", false);
        }
    }
Exemplo n.º 4
0
 bool IsGrounded(AliController ali)
 {
     if (ali.RIGID_BODY.velocity.y > -0.01 && ali.RIGID_BODY.velocity.y <= 0)
     {
         return(true);
     }
     foreach (GameObject o in ali.BottomSpheres)
     {
         Debug.DrawRay(o.transform.position, -Vector3.up * 0.7f, Color.yellow);
         RaycastHit hit;
         if (Physics.Raycast(o.transform.position, -Vector3.up, out hit, Distance))
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 5
0
    public override void UpdateAbility(CharacterStateBase characterStateBase, Animator animator, AnimatorStateInfo stateInfo)
    {
        AliController control = characterStateBase.GetBotController(animator);

        if (control.Jump)
        {
            animator.SetBool("IsJumping", true); //This is where you left off
        }

        if (control.MoveRight)
        {
            animator.SetBool("IsRunning", true);
        }

        if (control.MoveLeft)
        {
            animator.SetBool("IsRunning", true);
        }
    }
Exemplo n.º 6
0
 private void Awake()
 {
     aliController = this.gameObject.GetComponent <AliController>();
 }