public NavigationInfo(Transform transform, BoxCollider2D boxCollider2D, TransitionFloorType type) { this.transform = transform; this.boxCollider2D = boxCollider2D; this.type = type; colliderBounds = new ColliderBounds(); UpdateColliderBounds(boxCollider2D); }
public PatrolPointInfo(Transform transform, Collider2D collider2D, TransitionFloorType type, Navigation navigation) { this.transform = transform; this.floorCollider2D = collider2D; this.transitionFloorType = type; this.currentFloor = new Floor(-1); this.currentTransitionFloor = new TransitionFloor(); navigation.CheckForCurrentFloor(transform, floorCollider2D, ref currentFloor, ref currentTransitionFloor); navigation.CheckForCurrentTransitionFloor(transform, ref currentFloor, ref currentTransitionFloor, type); }
public TransitionFloor(Floor firstFloor, Floor secondFloor, Transform transform, ColliderBounds colliderBounds, TransitionFloorType type) { floors = new List <Floor>() { firstFloor, secondFloor }; floors.Sort((floor, floor1) => floor.number - floor1.number); this.transform = transform; this.type = type; this.colliderBounds = colliderBounds; }
public void CheckForCurrentTransitionFloor(Transform transform, CapsuleCollider2D collider2D, ref Floor currentFloor, ref TransitionFloor currentTransitionFloor, TransitionFloorType type) { if (type == TransitionFloorType.Obstacle) { currentFloor = new Floor(-1); currentTransitionFloor = this.transitionFloorList.Find(lambdaExpression => lambdaExpression.transform != null && MathHelpers.Approximately(lambdaExpression.transform.position.x, transform.position.x, 0.5f) && MathHelpers.Approximately(lambdaExpression.transform.position.y, transform.position.y, 3f)); } else if (type == TransitionFloorType.Ladder) { currentFloor = new Floor(-1); currentTransitionFloor = this.transitionFloorList.Find(lambdaExpression => lambdaExpression.transform != null && MathHelpers.Approximately(lambdaExpression.transform.position.x, transform.position.x, 0.5f) && transform.position.y >= lambdaExpression.colliderBounds.bottomMid.y && transform.position.y <= lambdaExpression.colliderBounds.topMid.y + collider2D.size.y / 2); } else if (type == TransitionFloorType.Stairs) { currentFloor = new Floor(-1); currentTransitionFloor = this.transitionFloorList.Find(lambdaExpression => !lambdaExpression.colliderBounds.Equals(null) && lambdaExpression.colliderBounds.bottomLeft.x <= transform.position.x && lambdaExpression.colliderBounds.bottomRight.x >= transform.position.x && lambdaExpression.colliderBounds.boundingBoxBottomY.y <= transform.position.y && lambdaExpression.colliderBounds.boundingBoxTopY.y >= transform.position.y); } }
public NavigationNode(Transform transform, TransitionFloorType type, List <Floor> floors) { this.transform = transform; this.type = type; this.floors = floors; }