Esempio n. 1
0
        private void UpdateUnitAbilityActivations(List <UnitAbilityActivationMessage> receivedUnitAbilityMessagesSinceLastFrame)
        {
            // sort by oldest frame to newest frame
            receivedUnitAbilityMessagesSinceLastFrame.Sort((message1, message2) =>
            {
                return(message1.StartFrame == message2.StartFrame ? 0 : MatchSimulationUnit.IsFrameInFuture(message1.StartFrame, message2.StartFrame) ? 1 : -1);
            });

            for (int i = 0; i < receivedUnitAbilityMessagesSinceLastFrame.Count; i++)
            {
                UnitAbilityActivationMessage unitAbilityActivationMessage = receivedUnitAbilityMessagesSinceLastFrame[i];

                MatchSimulationUnit unitToUpdate;
                if (simulationUnits.TryGetValue(unitAbilityActivationMessage.UnitId, out unitToUpdate))
                {
                    unitToUpdate.AbilityActivationSubject.OnNext(new AbilityActivation
                    {
                        Rotation        = UnitValueConverter.ToUnityRotation(unitAbilityActivationMessage.Rotation),
                        StartFrame      = unitAbilityActivationMessage.StartFrame,
                        ActivationFrame = unitAbilityActivationMessage.ActivationFrame
                    });
                }
            }
        }
Esempio n. 2
0
 public Quaternion GetUnityRotation()
 {
     return(Quaternion.Euler(0f, UnitValueConverter.ToUnityRotation(Rotation), 0f));
 }