public void TestSfeManager() { var manager = new FieldManager(10, 10); var entity1 = new TestScriptFieldEntity(); var guid = entity1.Id; entity1.Health.OverchargeMaximum = 100; entity1.Health.Maximum = 100; entity1.Health.Value = 100; manager.QueueRegistration(entity1); var entity2 = new TestScriptFieldEntity(); entity2.RegisterScript(ManagerTestScriptText); manager.QueueRegistration(entity2); manager.UpdateField(1.0f); entity2.RunVoidScript("x_set", guid); var res = entity2.RunScript <FieldEntity>("x_get"); Assert.AreEqual(entity1, res); entity2.RunScript <int, double>("x_damage_other_health", 10); Assert.AreEqual(90, entity1.Health.Value); entity2.RunScript <int, double>("x_heal_other_health", 1000); Assert.AreEqual(100, entity1.Health.Value); entity2.RunScript <int, double>("x_set_self_health", 50); Assert.AreEqual(50, entity2.Health.Value); }
public void TestSfeCopy() { var entity1 = new TestScriptFieldEntity(); entity1.RegisterScript(ScriptText); var entity2 = new TestScriptFieldEntity(); entity2.CopySources(entity1); Assert.AreEqual(3.0, entity2.RunScript <int, int, double>("add", 1, 2)); Assert.AreEqual("arhan", entity2.RunScript <string>("retstr")); Assert.AreEqual("yuuki", entity2.Script.Globals["konno"]); }