예제 #1
0
    public void UpdatePosition()
    {
        if (hasGoalPosition)
        {
            Vector3 speed    = (goalPosition - transform.position) / 4;
            float   minSpeed = 0.1f;
            if (speed.magnitude <= minSpeed)
            {
                transform.position = goalPosition;
                hasGoalPosition    = false;

                if (DoAfterMove != null)
                {
                    DoAfterMove.Invoke();
                    DoAfterMove = null;
                }

                elementController.Match(this);
            }
            else
            {
                transform.position += speed;
            }
        }
    }