Exemple #1
0
    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();
    }
Exemple #2
0
    /// <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));
    }
Exemple #3
0
 public Point()
 {
     _interpolation = new MovementInterpolation();
     _localPosition = Vector2.zero;
     _delay         = 0f;
 }