public void OnTick(TimeUpdateMessage message) { var remove = new List<Attack>(); foreach(var attack in m_Attacks) { var target = m_VesselRepository.GetByName(attack.Target); if (target != null) { Vector targetPosition = target.GetPosition(message.Time); var distance = (targetPosition - attack.FiringPosition).Length; var travelTime = distance / BaseConstants.WeaponSpeed * 1000; double elapsedTime = (double)( message.Time - attack.FiringTime); if( travelTime <= elapsedTime) { // we hit explode things here m_Renderer.Scene.Remove("Attack" + attack.FiringTime); remove.Add(attack); } } else { remove.Add(attack); } } foreach (var attack in remove) { m_Attacks.Remove(attack); } }
private void OnTimeUpdate(TimeUpdateMessage message) { //todo adjust for ping here //technically safe to hanle our own message as it will just update the time to be the same. //we can also adjust remote simulation speed to try keep it closer to the master here m_Time = message.Time; }