private void FixedUpdate()
 {
     if (axis.GetPlayerHorizontal() > 0.50f)
     {
         if (team != Team.Wolf)
         {
             changeTeam(1);
         }
     }
     else if (axis.GetPlayerHorizontal() < -0.50f)
     {
         if (team != Team.Shepherd)
         {
             changeTeam(0);
         }
     }
 }
예제 #2
0
    public void UpdateTargetPosition()
    {
        if (inputs == null)
        {
            currentTarget = transform.position;
            return;
        }
        IsMoving = false;
        Vector2 newTarget = new Vector2();

        if (inputs.GetPlayerHorizontal().Abs() > sensitivity)
        {
            LastPlayerInput.x = inputs.GetPlayerHorizontal();
            newTarget.x       = transform.position.x + (LastPlayerInput.x * targetDisplacement);
            IsMoving          = true;
        }
        else
        {
            LastPlayerInput.x = 0;
            newTarget.x       = transform.position.x;
        }

        if (inputs.GetPlayerVertical().Abs() > sensitivity)
        {
            LastPlayerInput.y = inputs.GetPlayerVertical();
            newTarget.y       = transform.position.y + (LastPlayerInput.y * targetDisplacement);
            IsMoving          = true;
        }
        else
        {
            LastPlayerInput.y = 0;
            newTarget.y       = transform.position.y;
        }

        currentTarget = newTarget;
    }