void Start() { if (shieldSphere == null) { Debug.LogError("Shield sphere is not set in Controlls Script!"); } shieldSphere.rotation = Quaternion.identity; movementInterpolation = new MovementInterpolation(range); previousAngle = GetCurrentAngle(); }
/// <summary> /// Moves a pawn from one spot to another in small steps /// </summary> /// <param name="nextSpotResolver">Determines the next spot to land on</param> /// <param name="postAction">Determines what to do after the movement</param> /// <returns></returns> public IEnumerator Move(Func <SpotConnection, GameObject> nextSpotResolver, Action postAction) { var destinationSpot = nextSpotResolver(_currentSpot); var sourcePoint = _currentSpot.transform.position; var destinationPoint = destinationSpot.transform.position; //var startingPosition = sourcePoint + PawnSpotOffset; var startingPosition = transform.position; //var directionResolver = _currentSpot.GetComponent<StepOrientation>().DetermineDirection(); var movementInterpolator = new MovementInterpolation(sourcePoint, destinationPoint, PawnSpeed); _currentSpot = destinationSpot.GetComponent <SpotConnection>(); return(movementInterpolator.Iterate(p => { transform.position = startingPosition + p; }, postAction)); }
public Point() { _interpolation = new MovementInterpolation(); _localPosition = Vector2.zero; _delay = 0f; }