public void InvokeMoveCompleteEvent()
 {
     //updates the player node assigned to the customer
     clickable.UpdateChildNode();
     positionNode = GameManager.Instance.RefreshNodeParent(customer);
     OnMoveComplete?.Invoke(positionNode);
 }
Exemple #2
0
        private void MoveTo()
        {
            gameObject.transform.position = Vector3.Lerp(gameObject.transform.position, target, _speed * Time.deltaTime);
            var position = transform.position;

            if (Math.Round(position.x, MidpointRounding.AwayFromZero) == Math.Round(target.x, MidpointRounding.AwayFromZero) &&
                Math.Round(position.y, MidpointRounding.AwayFromZero) == Math.Round(target.y, MidpointRounding.AwayFromZero) &&
                Math.Round(position.z, MidpointRounding.AwayFromZero) == Math.Round(target.z, MidpointRounding.AwayFromZero))
            {
                CancelInvoke("MoveTo");

                _state.CurrentState = _postMoveCompleteState;
                onMoveComplete.Invoke();
            }
        }
    public void InvokeMoveCompleteEvent()
    {
        positionNode = GameManager.Instance.RefreshNodeParent(player);
        OnMoveComplete?.Invoke(positionNode);

        //at the front of the queue is the destination where the player is currently in
        //DequeuePath(); temorarily commented out

        //if there is no more destination queued, return
        if (path.Count == 0)
        {
            return;
        }

        //if there is still destination queued, peek at the destination which is now at the front
        Transform nextDestination = DequeuePath();

        //go to the next path in the queue if there is a destination queued
        TransportPlayer(nextDestination);
    }
Exemple #4
0
    private void Update()
    {
        switch (mobState)
        {
        case State.Idle:
            break;

        case State.Running:

            smoothedPosition   = Vector3.Lerp(transform.position, targetPosition, speed * Time.deltaTime);
            transform.position = smoothedPosition;

            if (Vector3.Distance(transform.position, targetPosition) < reachedDistance)
            {
                transform.position = targetPosition;
                OnMoveComplete?.Invoke();
            }

            break;
        }
    }
 public void InvokeSpecialMoveCompleteEvent(MNode positionNode)
 {
     OnMoveComplete?.Invoke(positionNode);
 }