public DoorTimerWrapper(Door DoorObject, ContentManager ContentArg, List<ScreenModel> modelsArg, GraphicsDeviceManager graphicsArg,CollisionCheckSystem User) : base() { //object that needs to be referenced in order to be closed DoorOfInterest = DoorObject; //args...girrrrrr Content = ContentArg; models = modelsArg; graphics = graphicsArg; UserRef = User; }
public String GetUserRoomLocation(CollisionCheckSystem User) { /* Console.WriteLine("DoorPos: " + this.Position.ToString()); Console.WriteLine("OutsideVect " + this.OutsideVect.ToString()); Console.WriteLine("InnerVect " + this.InnerVect.ToString()); Console.WriteLine("UserPos: " + User.Position.ToString());*/ float InnerDist = CalculateDistanceFromUser(InnerVect, User); float OutsideDist = CalculateDistanceFromUser(OutsideVect, User); //Console.WriteLine("In Dist: " + InnerDist); //Console.WriteLine("Out Dist: " + OutsideDist); if (InnerDist < OutsideDist) { //assings value in the user object User.CurrentRoom = this.InsideDoor; return (this.InsideDoor); } else if (InnerDist == OutsideDist) { User.CurrentRoom = "Between " + this.InsideDoor + "," + this.OutsideDoor; return ("Between " + this.InsideDoor + "," + this.OutsideDoor); } else { User.CurrentRoom = this.OutsideDoor; return (this.OutsideDoor); } }
private float CalculateDistanceFromUser(Vector3 CheckPt, CollisionCheckSystem User) { return (Vector3.Distance(User.Position, CheckPt)); }
//LOLZ I'M JUST TYPING RANDOM THINGS THIS ISN"T A REAL PROGRAM, I DONT KNOW WHAT IM DOING. //method to be called if the user has performed an action public void Action(ContentManager Content, List<ScreenModel> models, GraphicsDeviceManager graphics,CollisionCheckSystem User) { if (ThisRoomModels.Count == 0) foreach(ScreenModel ThisModel in models) ThisRoomModels.Add(ThisModel); //figures out if the door should be opened or closed if (OpenTrue) if ((GetBoundingBoxSurroundings(InverseDoor).Contains(User.Position)) && (GetBoundingBoxSurroundings(this).Contains(User.Position))) if (DataValues.VectorDistance(GetBoundingBoxSurroundings(InverseDoor).HalfExtent) > DataValues.VectorDistance(GetBoundingBoxSurroundings(this).HalfExtent)) CloseDoor(Content, models, graphics, User.Position); else InverseDoor.CloseDoor(Content, models, graphics, User.Position); else if (GetBoundingBoxSurroundings(InverseDoor).Contains(User.Position)) InverseDoor.CloseDoor(Content, models, graphics, User.Position); else CloseDoor(Content, models, graphics, User.Position); else { OpenDoor(Content, models, graphics, User.Position); //starts/assigns timer to close door DoorCloser = new DoorTimerWrapper(this, Content, models, graphics, User); DoorCloser.Start(); } }