Exemplo n.º 1
0
    private void SetNewTargetPosition()
    {
        if (isBlueCar)
        {
            targetPosition = path.getBluePoint(isPathSwitched);
        }
        else
        {
            targetPosition = path.getRedPoint(isPathSwitched);
        }


        if (looping)
        {
            if (isBlueCar)
            {
                if (path.BlueIndex == path.blueGetLength() - 1)
                {
                    path.resetIndex(isBlueCar);
                }
            }
            else
            {
                if (path.RedIndex == path.redGetLength() - 1)
                {
                    path.resetIndex(isBlueCar);
                }
            }
        }

        path.updateIndex(isBlueCar, isPathSwitched);
    }
Exemplo n.º 2
0
 void Start()
 {
     path = SingletonPath.Instance;
     if (isBlueCar)
     {
         targetPosition = path.getBluePoint(isPathSwitched);
     }
     else
     {
         targetPosition = path.getRedPoint(isPathSwitched);
     }
 }