コード例 #1
0
ファイル: EntityTests.cs プロジェクト: zs782306174/DOTSSample
            public override void AssertReplicatedCorrectly(TestSerializable clientEntity, bool isPredicting)
            {
                base.AssertReplicatedCorrectly(clientEntity, isPredicting);
                var c = clientEntity as MyEntity;

                Assert.IsTrue(c != null);
                //Assert.IsTrue(position == c.position);
                Assert.IsTrue(Math.Abs(position.x - c.position.x) < Math.Pow(10, -3));
                Assert.IsTrue(Math.Abs(position.y - c.position.y) < Math.Pow(10, -3));
                Assert.IsTrue(Math.Abs(position.z - c.position.z) < Math.Pow(10, -3));
                Assert.IsTrue(justData == c.justData);
                Assert.IsTrue(health == c.health);
                Assert.IsTrue(flag == c.flag);
                Assert.IsTrue(message.CompareTo(c.message) == 0);

                Assert.IsTrue(c.predictingClientId == -1); // Clients never know anything about if they predict or not
                if (isPredicting)
                {
                    Assert.IsTrue(predictingClientId != -1);
                    Assert.IsTrue(predictedData == c.predictedData);
                    Assert.IsTrue(100.0f == c.nonpredictedData);  // we should not be getting anything beyond the value at spawn
                }
                else
                {
                    Assert.IsTrue(100.0f == c.predictedData);  // we should not be getting anything beyond the value at spawn
                    Assert.IsTrue(nonpredictedData == c.nonpredictedData);
                }
            }
コード例 #2
0
            public override void AssertReplicatedCorrectly(TestSerializable clientEntity, bool isPredicting)
            {
                var c = clientEntity as MyCommand;

                Assert.IsTrue(c != null);
                Assert.IsTrue(c.intValue == intValue);
                Assert.IsTrue(c.boolValue == boolValue);
                Assert.IsTrue(c.floatValue == floatValue);
            }
コード例 #3
0
        // Assumes 'this' is a server entity and asserts that it has been replicated correctly to clientEntity
        public override void AssertReplicatedCorrectly(TestSerializable clientEntity, bool isPredicting)
        {
            var c = clientEntity as TestEntity;

            Assert.IsTrue(c != null);
            Assert.IsTrue(c.id == id);
            Assert.IsTrue(c.despawnTick == despawnTick);
            Assert.IsTrue(c.spawnTick == spawnTick);
        }
コード例 #4
0
 public abstract void AssertReplicatedCorrectly(TestSerializable clientEntity, bool isPredicting);