Esempio n. 1
0
        public IEnumerator SetStateTest()
        {
            var state = new NetworkEntityState
            {
                EntityId        = m_networkEntity.NetworkId.ToString(),
                ComponentStates = new List <NetworkComponentState>
                {
                    new NetworkComponentState
                    {
                        Name       = nameof(NetworkTransform),
                        Properties = new List <NetworkComponentProperty>
                        {
                            new NetworkComponentProperty {
                                Name = nameof(NetworkTransform.Position), Value = JsonSerializer.Serialize(m_expectedPosition)
                            },
                            new NetworkComponentProperty {
                                Name = nameof(NetworkTransform.Rotation), Value = JsonSerializer.Serialize(m_expectedRotation)
                            },
                        }
                    }
                }
            };

            yield return(null);

            m_networkEntity.HasLocalAuthority = false;
            m_networkEntity.SetState(state, 0);

            yield return(null);

            Assert.AreEqual(m_expectedPosition, m_networkEntity.transform.position);
            Assert.AreEqual(m_expectedRotation, m_networkEntity.transform.rotation);
        }