Example #1
0
 /// <summary>
 /// What happens when the player reaches a <see cref="IntersectionNode"/>
 /// </summary>
 /// <param name="node"></param>
 public void OnNodeTrigger(IntersectionNode node)
 {
     // Check if next direction is allowed
     if (_moveQueue.NextDirection != Utility.EDirection4.None && node.IsAllowed(_moveQueue.NextDirection))
     {
         // Set correct position and update movement
         transform.position          = node.Position;
         _moveQueue.CurrentDirection = _moveQueue.NextDirection;
         //if (_nodeMovement.CurrentDirection != Utility.EDirection.None)
         //    _collidingNode = null;
     }
     // Check if current direction is allowed
     else if (!node.IsAllowed(_moveQueue.CurrentDirection))
     {
         //GetComponent<Rigidbody2D>().position = node.Position;
         transform.position          = node.Position;
         _moveQueue.CurrentDirection = Utility.EDirection4.None;
         _collidingNode = node;
     }
 }