// Use this for initialization void Start() { physConst = GameObject.Find("PhysicalConstants"); physicsConstants = physConst.GetComponent("PhysicsConstants") as PhysicsConstants; SpeedOfLight = physicsConstants.SpeedOfLight; size = (int)((2.0f * Mathf.PI) / thetaScale) + 2; thetaRange = 2.0f * Mathf.PI + thetaScale; i = 0; lRend = transform.GetComponents <LineRenderer>(); lRend[0].SetVertexCount(size); timeOfCircle = Time.time; //GENERATE THE CIRCLE GiveCircleRadius(radius); /*for (float theta= 0.0f; theta < thetaRange; theta += thetaScale) * { * x = radius*Mathf.Cos( theta ); * y = radius*Mathf.Sin( theta ); * Vector3 pos = new Vector3(x,y,0.0f); * lRend[0].SetPosition(i, pos); * i++; * }*/ //GiveCircleRadius(radius); }
public void ReadChildData(BinaryReader reader) { for (int x = 0; x < _physicsConstants.Count; x++) { PhysicsConstants.AddNew(); PhysicsConstants[x].Read(reader); } for (int x = 0; x < _physicsConstants.Count; x++) { PhysicsConstants[x].ReadChildData(reader); } for (int x = 0; x < _states.Count; x++) { States.AddNew(); States[x].Read(reader); } for (int x = 0; x < _states.Count; x++) { States[x].ReadChildData(reader); } for (int x = 0; x < _particleStates.Count; x++) { ParticleStates.AddNew(); ParticleStates[x].Read(reader); } for (int x = 0; x < _particleStates.Count; x++) { ParticleStates[x].ReadChildData(reader); } }
void listener_Flick(object sender, FlickGestureEventArgs e) { //Debug.WriteLine("listener_Flick"); if (e.Direction == Orientation.Vertical) { _state = State.Flicking; _selectedItem = null; if (!IsExpanded) { IsExpanded = true; } Point velocity = new Point(0, e.VerticalVelocity); double flickDuration = PhysicsConstants.GetStopTime(velocity); Point flickEndPoint = PhysicsConstants.GetStopPoint(velocity); IEasingFunction flickEase = PhysicsConstants.GetEasingFunction(flickDuration); AnimatePanel(new Duration(TimeSpan.FromSeconds(flickDuration)), flickEase, _panningTransform.Y + flickEndPoint.Y); e.Handled = true; _selectedItem = null; UpdateItemState(); } }
public virtual void ReadChildData(BinaryReader reader) { int x = 0; for (x = 0; (x < _physicsConstants.Count); x = (x + 1)) { PhysicsConstants.Add(new ParticleSystemPhysicsConstantsBlock()); PhysicsConstants[x].Read(reader); } for (x = 0; (x < _physicsConstants.Count); x = (x + 1)) { PhysicsConstants[x].ReadChildData(reader); } for (x = 0; (x < _states.Count); x = (x + 1)) { States.Add(new ParticleSystemTypeStatesBlock()); States[x].Read(reader); } for (x = 0; (x < _states.Count); x = (x + 1)) { States[x].ReadChildData(reader); } for (x = 0; (x < _particleStates.Count); x = (x + 1)) { ParticleStates.Add(new ParticleSystemTypeParticleStatesBlock()); ParticleStates[x].Read(reader); } for (x = 0; (x < _particleStates.Count); x = (x + 1)) { ParticleStates[x].ReadChildData(reader); } }
public PhysicsMovement(GameObject character) : base(character) { physicsConstants = new PhysicsConstants(character); contactFilter.useTriggers = false; contactFilter.SetLayerMask(LayerMask.GetMask("Block")); contactFilter.useLayerMask = true; }
private void OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { if (_isDragging) { // See if it was a flick if (e.IsInertial) { _state = State.Flicking; _selectedItem = null; if (!IsExpanded) { IsExpanded = true; } Point velocity; if (Orientation == Orientation.Vertical) { velocity = new Point(0, e.FinalVelocities.LinearVelocity.Y); } else { velocity = new Point(e.FinalVelocities.LinearVelocity.X, 0); } double flickDuration = PhysicsConstants.GetStopTime(velocity, Friction, MaximumSpeed, ParkingSpeed); Point flickEndPoint = PhysicsConstants.GetStopPoint(velocity, Friction, MaximumSpeed, ParkingSpeed); IEasingFunction flickEase = PhysicsConstants.GetEasingFunction(flickDuration, Friction); double to; if (Orientation == Orientation.Vertical) { to = _panningTransform.Y + flickEndPoint.Y; } else { to = _panningTransform.X + flickEndPoint.X; } AnimatePanel(new Duration(TimeSpan.FromSeconds(flickDuration)), flickEase, to); e.Handled = true; _selectedItem = null; UpdateItemState(); } if (_state == State.Dragging) { SelectAndSnapToClosest(); } _state = State.Expanded; } }
void start() { physConst = GameObject.Find("PhysicalConstants"); physicsConstants = physConst.GetComponent("PhysicsConstants") as PhysicsConstants; SpeedOfLight = physicsConstants.SpeedOfLight; //timeStart=0.0f; blastRadius = 15.0f; //lifeTime= blastRadius/(SpeedOfLight*0.2f)+timeStart; }
public void ReadChildData(BinaryReader reader) { _bitmaps.ReadString(reader); _pointPhysics.ReadString(reader); _bitmap.ReadString(reader); for (int x = 0; x < _physicsConstants.Count; x++) { PhysicsConstants.AddNew(); PhysicsConstants[x].Read(reader); } for (int x = 0; x < _physicsConstants.Count; x++) { PhysicsConstants[x].ReadChildData(reader); } }
public virtual void ReadChildData(BinaryReader reader) { int x = 0; _bitmaps.ReadString(reader); _pointPhysics.ReadString(reader); _bitmap.ReadString(reader); for (x = 0; (x < _physicsConstants.Count); x = (x + 1)) { PhysicsConstants.Add(new ParticleSystemPhysicsConstantsBlock()); PhysicsConstants[x].Read(reader); } for (x = 0; (x < _physicsConstants.Count); x = (x + 1)) { PhysicsConstants[x].ReadChildData(reader); } }
private void OnManipulationCompleted(object sender, ManipulationCompletedEventArgs e) { if (_isDragging) { // See if it was a flick if (e.IsInertial) { _state = State.Flicking; _selectedItem = null; if (!IsExpanded) { IsExpanded = true; } Point velocity = new Point(0, e.FinalVelocities.LinearVelocity.Y); double flickDuration = PhysicsConstants.GetStopTime(velocity); Point flickEndPoint = PhysicsConstants.GetStopPoint(velocity); IEasingFunction flickEase = PhysicsConstants.GetEasingFunction(flickDuration); double endPoint = _panningTransform.Y + flickEndPoint.Y; double adjustedEndPoint = Math.Round(endPoint / ActualItemHeight) * ActualItemHeight; flickDuration *= adjustedEndPoint / endPoint; AnimatePanel(new Duration(TimeSpan.FromSeconds(flickDuration)), flickEase, adjustedEndPoint); #if WP8 _changeStateAfterAnimation = false; #endif e.Handled = true; _selectedItem = null; UpdateItemState(); } if (_state == State.Dragging) { SelectAndSnapToClosest(); } _state = State.Expanded; } }