private void ExitMagnet() { AttractedEdge attractedEdge = this.m_AttractedEdge.edge; double num = this.m_AttractedEdge.exitTime; if (this.m_ManipulateEdges == ManipulateEdges.Left) { attractedEdge = AttractedEdge.Left; } if (this.m_ManipulateEdges == ManipulateEdges.Right) { attractedEdge = AttractedEdge.Right; } if (attractedEdge == AttractedEdge.Left || attractedEdge == AttractedEdge.Right) { if (Event.get_current() != null) { Vector2 mousePosition = Event.get_current().get_mousePosition(); num = (double)this.m_State.PixelToTime(mousePosition.x); } } this.m_AttractionHandler.OnAttractedEdge(this.m_Attractable, this.m_AttractedEdge.edge, this.m_AttractedEdge.exitTime, this.m_ActiveMagnet.durationBeforeSnap); this.m_AttractedEdge = null; this.m_ActiveMagnet = null; this.ChangeState(SnapState.Free); }
private bool IsLeftEdgeAttracted(MagnetEngine.MagnetInfo magnet) { bool result; if (magnet.IsInInfluenceZone(this.m_Attractable.start, this.m_State, AttractedEdge.Left)) { this.m_ActiveMagnet = magnet; this.m_AttractedEdge = new MagnetEngine.EdgeInfo { time = this.m_Attractable.start, edge = AttractedEdge.Left }; double duration = this.m_Attractable.end - this.m_Attractable.start; this.m_AttractionHandler.OnAttractedEdge(this.m_Attractable, this.m_AttractedEdge.edge, magnet.time, duration); magnet.timeBeforeSnap = magnet.time; magnet.durationBeforeSnap = this.m_Attractable.end - this.m_Attractable.start; result = true; } else { result = false; } return(result); }
public bool IsAttractedBothSide(MagnetEngine.MagnetInfo magnet, ITimelineState state) { return(magnet != null && magnet.IsInBothInfluenceZone(this.exitTime, state)); }