示例#1
0
 // Invokes on PlayerStop and Start MineCoroutine
 public void InvokeMiningAnimation()
 {
     if (block)
     {
         animatorController.SetValues(block.transform.position);
         animatorController.InvertIsMiningVar();
         isMining = true;
     }
 }
示例#2
0
    // Move our character and Invokes atStop and whenMovementResumes Events
    private void MovementController()
    {
        if (path != null &&
            index < path.Count)
        {
            if (isStanding)
            {
                whenMovementResumes.Invoke();
            }

            isStanding = false;

            Move();
        }
        else if (!isStanding)
        {
            isStanding = true;
            atStop.Invoke();
        }

        // Move our character
        void Move()
        {
            if (transform.position + new Vector3(0, 0, -10) !=
                path[index].transform.position)
            {
                rigidBody.MovePosition(Vector2.MoveTowards(transform.position,
                                                           path[index].transform.position,
                                                           Time.fixedDeltaTime * speed));
            }
            else
            {
                index++;
                if (index < path.Count)
                {
                    animatorController.SetValues(path[index].transform
                                                 .position);
                }
            }
        }
    }