public void AddPoint(double timeoffset, double data, WorkoutSampleDataType dataType) { switch (dataType) { case WorkoutSampleDataType.Power: PowerVector.AddPoint(timeoffset, data); break; case WorkoutSampleDataType.Cadence: CadenceVector.AddPoint(timeoffset, data); break; case WorkoutSampleDataType.HeartRate: HeartRateVector.AddPoint(timeoffset, data); break; case WorkoutSampleDataType.Speed: SpeedVector.AddPoint(timeoffset, data); break; } }
/// <summary> /// Actualise les sorts et les états de l'acteur puis appelle la fonction Tick() de sa classe mère. /// Ensuite, si l'acteur possède un AnmationHandler, on lui assigne comme type d'animation par défaut la valeur /// IdleAnimation si il est immobile, MovingAnimtaion sinon. /// Enfin, si les mouvements de l'acteur ne sont pas bloqués, on le déplace suivant son vecteur de vitesse et /// le temps écoulé. /// </summary> /// <param name="ms"> Le temps écoulé en millisecondes </param> public override void Tick(int ms) { SpellHandler.Tick(ms); _stateHandler.Tick(ms); base.Tick(ms); var handler = SpriteHandler as AnimationHandler; if (SpeedVector.IsNull() && handler != null) { handler.AnimationType = IdleAnimation; } else if (!SpeedVector.IsNull() && _blockingMoves == 0) { if (handler != null) { handler.AnimationType = MovingAnimation; } Orientation = SpeedVector.GetOrientation(); Move(SpeedVector * ((double)ms / 1000)); } }
private void Move(MovingAgent agent, SpeedVector speed) { if (speed == null) { return; } float tick = (float)CompleteWorld.TickTime / 1000; //en secondes //Console.WriteLine(" " + tick); //Console.WriteLine(speed.X + " " +speed.Y); //Console.WriteLine(agent.Location.X + " " +agent.Location.Y); float _x = agent.Location.X + speed.X * tick; float _y = agent.Location.Y + speed.Y * tick; float _z = agent.Location.Z + speed.Z * tick; agent.Location.X = _x; agent.Location.Y = _y; agent.Location.Z = _z; //Console.WriteLine(_x + " " +_y); }