Ejemplo n.º 1
0
        void FixedUpdate()
        {
            movement = Vector2.zero;
            if (Path.NxtPos == -1)
            {
                started = false;
            }
            if (!started)
            {
                return;
            }
            remainingWaitingTime -= Time.deltaTime;
            if (remainingWaitingTime >= 0f)
            {
                return;
            }
            movement = new Vector2(Path.NxtNode.position.x - rb.position.x, 0);

            if (Mathf.Abs(movement.x) <= BreakingRadius)
            {
                remainingWaitingTime = Path.CurStageTime;
                Path.MoveNext();
            }
            else
            {
                movement = movement.normalized * Speed;
                pawnController.Move(movement);
                UpdateFacing(movement);
            }
        }