public Contact(ContactState state, string name, DateTime requestSent, string message) { Name = name; State = state; RequestSent = requestSent; Message = message; }
public PhysicalContactMatrixState(PhysicalContactMatrix matrix) { _defaultContact = new ContactState(matrix.defaultContact); if (matrix.contacts != null) { for (int i = 0; i < matrix.contacts.Length; ++i) { var contact = matrix.contacts[i]; var state = new ContactState(contact); Dictionary<PhysicalMaterialClass, ContactState> map; if (!_contactMap.TryGetValue(contact.material1, out map)) { map = new Dictionary<PhysicalMaterialClass, ContactState>(); _contactMap[contact.material1] = map; } map[contact.material2] = state; if (!_contactMap.TryGetValue(contact.material2, out map)) { map = new Dictionary<PhysicalMaterialClass, ContactState>(); _contactMap[contact.material2] = map; } map[contact.material1] = state; } } }
public void Update(int x,int y,ContactState state) { Position = new Point(x, y); State = state; Orientation = 0; }
public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2) { if (body1.ID < body2.ID) { this.body1 = body1; this.body2 = body2; } else { this.body1 = body2; this.body2 = body1; } this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag; this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag; this.circle1 = this.body1.Shape as CircleShape; this.circle2 = this.body2.Shape as CircleShape; this.friction = MathHelper.Sqrt( this.body1.Coefficients.DynamicFriction * this.body2.Coefficients.DynamicFriction); this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution); this.parent = parent; this.contacts = new LinkedList <ContactPoint>(); this.lastUpdate = -1; this.state = ContactState.New; this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse; }
public override void Update(GameTime gameTime) { KeyboardState keyboardState = _parentEntity.Manager.Scene.KeyboardState; _previousContactState = _contactState; if (!(_previousKeyboardState.IsKeyDown(Keys.Up) || _previousKeyboardState.IsKeyDown(Keys.Space) || _previousKeyboardState.IsKeyDown(Keys.W)) && ( keyboardState.IsKeyDown(Keys.Up) || keyboardState.IsKeyDown(Keys.Space) || keyboardState.IsKeyDown(Keys.W))) { Jump(); } _parentEntity.PreviousX = _parentEntity.X; _parentEntity.X += _speed; _parentEntity.Y += VelocityY; VelocityY += _gravity; if (VelocityY > _velocityYMax) { VelocityY = _velocityYMax; } _previousKeyboardState = keyboardState; }
public HandPointContact(HandPointContact hc, ContactState state) : base(hc.Id, state,hc.Position, 20, 20) { velocityx = 0; velocityy = 0; // CenterPoint = new Point(hc.Position.X, hc.Position.Y); }
public HandPointContact(HandPointContact hc, ContactState state) : base(hc.Id, state, hc.Position, 20, 20) { velocityx = 0; velocityy = 0; // CenterPoint = new Point(hc.Position.X, hc.Position.Y); }
internal void EnqueueContact(HandPointContact cursor, ContactState state) { lock (contactsQueue) { contactsQueue.Enqueue(new HandPointContact(cursor, state)); } }
internal void EnqueueContact(TuioCursor cursor, ContactState state) { lock (contactsQueue) { contactsQueue.Enqueue(new TuioContact(cursor, state, monitorSize)); } }
public void Update(int x, int y, ContactState state) { Position = new Point(x, y); State = state; Orientation = 0; }
public HandPointContact(int id, int x, int y, ContactState state) : base(id, state,new Point(x,y), 20, 20) { // CenterPoint = new Point(x,y); velocityy = 0; velocityx = 0; Orientation = 0; }
/// <summary> /// Initializes a new instance of the <see cref="Contact"/> class. /// </summary> /// <param name="id">The id.</param> /// <param name="state">The state.</param> /// <param name="position">The position.</param> /// <param name="majorAxis">The major axis.</param> /// <param name="minorAxis">The minor axis.</param> public Contact(int id, ContactState state, Point position, double majorAxis, double minorAxis) { Id = id; Position = position; State = state; MajorAxis = majorAxis; MinorAxis = minorAxis; }
internal void OnDeserializing(StreamingContext context) { if (History == null) { History = new ObservableCollection <Message>(); } State = ContactState.Offline; }
public HandPointContact(int id, int x, int y, ContactState state) : base(id, state, new Point(x, y), 20, 20) { // CenterPoint = new Point(x,y); velocityy = 0; velocityx = 0; Orientation = 0; }
public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize) : base(cursor.getFingerID(), state, new Point(0, 0), 20, 20) { float x = cursor.getScreenX(monitorSize.Width); float y = cursor.getScreenY(monitorSize.Height); Position = new Point(x, y); Orientation = 0; }
internal void EnqueueContact(TuioCursor cursor, ContactState state) { lock (contactsQueue) { Contact contact = new TuioContact(cursor, state, monitorSize); //Trace.WriteLine(contact.Position.ToString()); contactsQueue.Enqueue(contact); } }
public TransformedContact(IContact copy) { Id = copy.Id; X = copy.X; Y = copy.Y; Width = copy.Width; Height = copy.Height; State = copy.State; }
public void FreeFall() { _contactState = ContactState.Airborne; if (_previousContactState == ContactState.Grounded) { _jumpState = JumpState.CantJump; } }
public Contact() { this.NickName = string.Empty; this.Name = string.Empty; this.Surname = string.Empty; this.Email = string.Empty; this.Password = string.Empty; this.Id = Guid.NewGuid(); this.State = ContactState.Online; }
public Contact(string nickName, string name, string surname, string email, string password) { this.Id = Guid.NewGuid(); this.NickName = nickName; this.Name = name; this.Surname = surname; this.Email = email; this.Password = password; this.State = ContactState.Online; }
internal static ContactData GetContactData(int id, ContactState state, Point point) { ContactData contactData = new ContactData(); contactData.Position = point; contactData.Id = id; contactData.MajorAxis = 20; contactData.MinorAxis = 30; contactData.State = state; contactData.Orientation = 0; return contactData; }
internal static ContactData GetContactData(int id, ContactState state, Point point) { ContactData contactData = new ContactData(); contactData.Position = point; contactData.Id = id; contactData.MajorAxis = 20; contactData.MinorAxis = 30; contactData.State = state; contactData.Orientation = 0; return(contactData); }
public override void Update(GameTime gameTime) { _previousContactState = _contactState; _parentEntity.PreviousX = _parentEntity.X; _parentEntity.X += _speed; _parentEntity.Y += VelocityY; VelocityY += _gravity; if (VelocityY > _velocityYMax) { VelocityY = _velocityYMax; } }
void DetermineContactState() { contactState = ContactState.FLATGROUND; sideAdjacent = MovementDirection.NEUTRAL; //If there is a collision below, the character is either FLATGROUND, a steep slope, or a slanted wall if (collisions.below) { if (collisions.groundSlopeAngle < steepSlopeAngle) { contactState = ContactState.FLATGROUND; } else { contactState = ContactState.STEEPSLOPE; } } //If there is a collision on the side but the slope is not vertical enough, the character is also on a steep slope. else if ((collisions.left && collisions.leftSurfaceAngle < minWallGrabAngle) || (collisions.right && collisions.rightSurfaceAngle < minWallGrabAngle)) { contactState = ContactState.STEEPSLOPE; } //If the character was in contact with a steep surface beside it within a few milliseconds, it counts as //grabbing the wall else if (collisions.left) { contactState = ContactState.WALLADJACENT; sideAdjacent = MovementDirection.LEFT; } else if (collisions.right) { contactState = ContactState.WALLADJACENT; sideAdjacent = MovementDirection.RIGHT; } else { contactState = ContactState.AIRBORNE; } if (oldContactState != contactState) { contactStateChanged = true; } else { contactStateChanged = false; } oldContactState = contactState; }
public MainMenuInputComponent(BaseEntity parentEntity) : base(parentEntity) { _parentEntity = parentEntity; Name = "Input"; _speed = 4; _gravity = 1; _velocityYMax = 8; _contactState = ContactState.Airborne; _previousContactState = ContactState.Airborne; _jumpCounter = 0; _maxJump = 10; _minJump = 7; Initialize(); }
public void OnRemoved() { if (everCollided) { body1.IsFrozen = false; body2.IsFrozen = false; // body1.idleCount -= 3; // body2.idleCount -= 3; } this.state = ContactState.Ended; if (Ended != null) { Ended(this, EventArgs.Empty); } }
static RoutedEvent GetPreviewEventFromRawMultitouchState(ContactState state) { if (state == ContactState.New) { return(MultitouchScreen.PreviewNewContactEvent); } if (state == ContactState.Moved) { return(MultitouchScreen.PreviewContactMovedEvent); } if (state == ContactState.Removed) { return(MultitouchScreen.PreviewContactRemovedEvent); } return(null); }
static void RaiseEnterLeave(Contact contact, UIElementsList list) { foreach (DependencyObject treeElement in list) { ContactState state = list.GetState(treeElement); switch (state) { case ContactState.New: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactEnterEvent); break; case ContactState.Removed: RaiseEnterLeaveEvents(contact, treeElement, MultitouchScreen.ContactLeaveEvent); break; } } }
public void Update(TimeStep step) { if (lastUpdate != -1) { if (lastUpdate != step.UpdateCount - 1) { state = ContactState.New; } else { state = ContactState.Old; } } if ((!body1.IsFrozen || !body2.IsFrozen)) { if (circle1 != null && circle2 != null && !body1.IsTransformed && !body2.IsTransformed) { CollideCircles(); } else { Collide(); } UpdateContacts(); if (Collided) { body1.IsFrozen = false; body2.IsFrozen = false; everCollided = true; } } if (Collided) { lastUpdate = step.UpdateCount; } if (Updated != null && contactsArray.Length != 0) { Updated(this, EventArgs.Empty); } }
public TuioContact(TuioCursor cursor, ContactState state, System.Drawing.Size monitorSize) : base(cursor.getFingerID(), state, new Point(0, 0), 20, 20) { float x, y; //Edit by Wander if (secondaryScreen == null) { x = cursor.getScreenX(monitorSize.Width); y = cursor.getScreenY(monitorSize.Height); } else { x = cursor.getX() * secondaryScreen.WorkingArea.Width + secondaryScreen.WorkingArea.Left; y = cursor.getY() * secondaryScreen.WorkingArea.Height + secondaryScreen.WorkingArea.Top; } Position = new Point(x, y); Orientation = 0; }
/// <summary> /// Get contact state string /// </summary> /// <returns></returns> private string GetContactStateString(string utid, int probe, decimal state, int language) { string contactStateString = ""; ContactState contactState = null; try { contactState = new ContactState(); contactState.UTID = utid; contactState.Probe = probe; contactState.contactState = state; contactState.LanguageID = language; contactState.Execute(contactState); contactStateString = contactState.contactStateString; } catch (Exception ex) { /*Debug Object values for reference*/ LogBook.Debug(contactState, this); /*Write exception log*/ LogBook.Write("Error has occurred while retrieving contactStateString", ex, "CooperAtkins.NotificationClient.NotificationComposer.Notification"); } finally { contactState.Dispose(); } //Set default string if contact string doesn't exist if (contactStateString == string.Empty && state == 0) { contactStateString = "Closed"; } else if (contactStateString == string.Empty) { contactStateString = "Open"; } return(contactStateString); }
protected override void ReadingChangedAsync(object sender, BandSensorReadingEventArgs <BandContactReading> args) { Task.Run(() => { try { ContactState state = args.SensorReading.State; if (_previousState == null || state != _previousState.Value) { ContactStateChanged?.Invoke(this, state); _previousState = state; } } catch (Exception ex) { SensusServiceHelper.Get().Logger.Log("Error processing Band contact change: " + ex.Message, LoggingLevel.Normal, GetType()); } base.ReadingChangedAsync(sender, args); }); }
private void ContactStateChanged(object sender, ContactState contactState) { // contact probe might get a reading before this probe changes to the running state or after it changes // to the stopped state. if (Running) { // start readings if band is worn, regardless of whether we're stopping readings when it isn't worn. if (contactState == ContactState.Worn) { StartReadings(); _stoppedBecauseNotWorn = false; } else if (contactState == ContactState.NotWorn && _stopWhenNotWorn && !_stoppedBecauseNotWorn) { // prevent race condition with client health test, which will be trying to start readings on this probe. lock (HEALTH_TEST_LOCKER) { StopReadings(); _stoppedBecauseNotWorn = true; } } } }
public async Task RunContactAction(int currentUserId, int contactUserId, ContactState state) { using (var contactRepository = _unitOfWork.Repository <Contact>()) { var contact = await contactRepository .Query() .Include(c => c.User) .Include(c => c.ContactUser) .SingleOrDefaultAsync(c => c.User.Id == currentUserId && c.ContactUser.Id == contactUserId); if (contact != null) { var contactUserDto = new UserContactDto { Id = currentUserId, State = state, Avatar = contact.User.Avatar, Name = contact.User.FirstName + " " + contact.User.LastName, City = contact.User.City, UserState = contact.User.State, IsOnline = contact.User.IsOnline }; using (var userRepository = _unitOfWork.Repository <User>()) { var contactUser = await userRepository .Query() .SingleOrDefaultAsync(u => u.Id == contactUserId); if (contactUser != null && !string.IsNullOrEmpty(contactUser.ConnectionId)) { await _hubContext.Clients.Client(contactUser.ConnectionId).onContactAction(contactUserDto); } } } } }
public Contact(ContactState state, Vector2 position) { State = state; Position = position; }
public void ChangeState(ContactState newState) => this.State = newState;
public void ChangedState(VsJid id, ContactState state) { GetInterlocutorOrSelf(id).State = state; }
private int StateMeasure(ContactState state) { switch (state) { case ContactState.Online: return 1; case ContactState.Offline: return 2; default: return 0; } }
public Arbiter(SequentialImpulsesSolver parent, Body body1, Body body2) { if (body1.ID < body2.ID) { this.body1 = body1; this.body2 = body2; } else { this.body1 = body2; this.body2 = body1; } this.tag1 = (SequentialImpulsesTag)this.body1.SolverTag; this.tag2 = (SequentialImpulsesTag)this.body2.SolverTag; this.circle1 = this.body1.Shape as CircleShape; this.circle2 = this.body2.Shape as CircleShape; this.friction = MathHelper.Sqrt( this.body1.Coefficients.DynamicFriction * this.body2.Coefficients.DynamicFriction); this.restitution = Math.Min(body1.Coefficients.Restitution, body2.Coefficients.Restitution); this.parent = parent; this.contacts = new LinkedList<ContactPoint>(); this.lastUpdate = -1; this.state = ContactState.New; this.ignoresCollisionResponse = body1.IgnoresCollisionResponse || body2.IgnoresCollisionResponse; }
internal static ContactData GetContactData(int id, ContactState state) { return GetContactData(id, state, new Point(100, 100)); }
public MicrosoftBandContactDatum(DateTimeOffset timestamp, ContactState state) : base(timestamp) { _state = state; }
static RoutedEvent GetPreviewEventFromRawMultitouchState(ContactState state) { if (state == ContactState.New) return MultitouchScreen.PreviewNewContactEvent; if (state == ContactState.Moved) return MultitouchScreen.PreviewContactMovedEvent; if (state == ContactState.Removed) return MultitouchScreen.PreviewContactRemovedEvent; return null; }
internal BandContactReading(ContactState state) { State = state; }
public CursorState(TuioCursor cursor, ContactState state) { Cursor = cursor; State = state; }
public Interlocutor() { History = new ObservableCollection <Message>(); State = ContactState.Offline; }