protected override void Update(TimeSpan gameTime) { Timers.BeginTimer("Cube Behavior Update"); timeLapse = (gameTime.Milliseconds / 1000f); currentAngle = currentAngle + (angleStep * speed * timeLapse); Vector3 aux = this.Transform.Position; if (Transform.Position.X != 0f) { aux.X = Transform.Position.X + ((float)Math.Cos(currentAngle)); } if (Transform.Position.Y != 0f) { aux.Y = Transform.Position.Y + ((float)Math.Sin(currentAngle)); } if (Transform.Position.Z != 0f) { aux.Z = Transform.Position.Z + ((float)Math.Cos(currentAngle)); } this.Transform.Position = aux; Timers.EndTimer("Cube Behavior Update"); Labels.Add("First cube position", this.Transform.Position.ToString()); }
protected override void Update(TimeSpan gameTime) { Timers.BeginTimer("Cube Behavior Update"); currentAngle = (float)(clock.TotalTime.TotalSeconds) * this.Frequency; float sinAngle = (float)Math.Sin(currentAngle); float cosAngle = (float)Math.Cos(currentAngle); Vector3 aux; aux.X = initPosition.X + (sinAngle * this.Amplitude.X); aux.Y = initPosition.Y + (cosAngle * this.Amplitude.Y); aux.Z = initPosition.Z + (sinAngle * this.Amplitude.Z); this.Transform.Position = aux; Timers.EndTimer("Cube Behavior Update"); Labels.Add("First cube position", this.Transform.Position); }