当前位置: 首页>>代码示例>>C#>>正文


C# Actor.ToLuaValue方法代码示例

本文整理汇总了C#中Actor.ToLuaValue方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.ToLuaValue方法的具体用法?C# Actor.ToLuaValue怎么用?C# Actor.ToLuaValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Actor的用法示例。


在下文中一共展示了Actor.ToLuaValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TickIdle

		public void TickIdle(Actor self)
		{
			foreach (var f in Triggers[Trigger.OnIdle])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
						f.First.Call(a).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:16,代码来源:ScriptTriggers.cs

示例2: Damaged

		public void Damaged(Actor self, AttackInfo e)
		{
			foreach (var f in Triggers[Trigger.OnDamaged])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = e.Attacker.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:17,代码来源:ScriptTriggers.cs

示例3: UnitProducedByOther

		public void UnitProducedByOther(Actor self, Actor producee, Actor produced)
		{
			if (world.Disposing)
				return;

			// Run Lua callbacks
			foreach (var f in Triggerables(Trigger.OnOtherProduction))
			{
				try
				{
					using (var a = producee.ToLuaValue(f.Context))
					using (var b = produced.ToLuaValue(f.Context))
						f.Function.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnOtherProducedInternal(producee, produced);
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:24,代码来源:ScriptTriggers.cs

示例4: Infiltrated

		public void Infiltrated(Actor self, Actor infiltrator)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnInfiltrated))
			{
				try
				{
					using (var b = infiltrator.ToLuaValue(f.Context))
						f.Function.Call(f.Self, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:19,代码来源:ScriptTriggers.cs

示例5: OnCapture

		public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnCapture))
			{
				try
				{
					using (var b = captor.ToLuaValue(f.Context))
					using (var c = oldOwner.ToLuaValue(f.Context))
					using (var d = newOwner.ToLuaValue(f.Context))
						f.Function.Call(f.Self, b, c, d).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnCapturedInternal(self);
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:24,代码来源:ScriptTriggers.cs

示例6: UnitProduced

		public void UnitProduced(Actor self, Actor other, CPos exit)
		{
			if (world.Disposing)
				return;

			// Run Lua callbacks
			foreach (var f in Triggerables(Trigger.OnProduction))
			{
				try
				{
					using (var b = other.ToLuaValue(f.Context))
						f.Function.Call(f.Self, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnProducedInternal(self, other);
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:23,代码来源:ScriptTriggers.cs

示例7: RegisterMapActor

		public void RegisterMapActor(string name, Actor a)
		{
			using (var registerGlobal = (LuaFunction)runtime.Globals["RegisterSandboxedGlobal"])
			{
				if (runtime.Globals.ContainsKey(name))
					throw new LuaException("The global name '{0}' is reserved, and may not be used by a map actor".F(name));

				using (var obj = a.ToLuaValue(this))
					registerGlobal.Call(name, obj).Dispose();
			}
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:11,代码来源:ScriptContext.cs

示例8: Killed

		public void Killed(Actor self, AttackInfo e)
		{
			// Run Lua callbacks
			foreach (var f in Triggers[Trigger.OnKilled])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = e.Attacker.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnKilledInternal(self);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:21,代码来源:ScriptTriggers.cs

示例9: UnitProduced

		public void UnitProduced(Actor self, Actor other, CPos exit)
		{
			// Run Lua callbacks
			foreach (var f in Triggers[Trigger.OnProduction])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = other.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnProducedInternal(self, other);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:21,代码来源:ScriptTriggers.cs

示例10: OnDiscovered

		public void OnDiscovered(Actor self, Player discoverer, bool playNotification)
		{
			foreach (var f in Triggers[Trigger.OnDiscovered])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = discoverer.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			foreach (var f in Triggers[Trigger.OnPlayerDiscovered])
			{
				try
				{
					using (var a = self.Owner.ToLuaValue(f.Second))
					using (var b = discoverer.ToLuaValue(f.Second))
					using (var c = self.ToLuaValue(f.Second))
						f.First.Call(a, b, c).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:33,代码来源:ScriptTriggers.cs

示例11: UnitProducedByOther

		public void UnitProducedByOther(Actor self, Actor producee, Actor produced)
		{
			// Run Lua callbacks
			foreach (var f in Triggers[Trigger.OnOtherProduction])
			{
				try
				{
					using (var a = producee.ToLuaValue(f.Second))
					using (var b = produced.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnOtherProducedInternal(producee, produced);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:21,代码来源:ScriptTriggers.cs

示例12: RemovedFromWorld

		public void RemovedFromWorld(Actor self)
		{
			// Run Lua callbacks
			foreach (var f in Triggers[Trigger.OnRemovedFromWorld])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
						f.First.Call(a).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnRemovedInternal(self);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:20,代码来源:ScriptTriggers.cs

示例13: Infiltrated

		public void Infiltrated(Actor self, Actor infiltrator)
		{
			foreach (var f in Triggers[Trigger.OnInfiltrated])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = infiltrator.ToLuaValue(f.Second))
						f.First.Call(a, b).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:17,代码来源:ScriptTriggers.cs

示例14: OnCapture

		public void OnCapture(Actor self, Actor captor, Player oldOwner, Player newOwner)
		{
			foreach (var f in Triggers[Trigger.OnCapture])
			{
				try
				{
					using (var a = self.ToLuaValue(f.Second))
					using (var b = captor.ToLuaValue(f.Second))
					using (var c = oldOwner.ToLuaValue(f.Second))
					using (var d = newOwner.ToLuaValue(f.Second))
						f.First.Call(a, b, c, d).Dispose();
				}
				catch (Exception ex)
				{
					f.Second.FatalError(ex.Message);
					return;
				}
			}

			// Run any internally bound callbacks
			OnCapturedInternal(self);
		}
开发者ID:ushardul,项目名称:OpenRA,代码行数:22,代码来源:ScriptTriggers.cs

示例15: foreach

		void INotifyPassengerExited.OnPassengerExited(Actor self, Actor passenger)
		{
			if (world.Disposing)
				return;

			foreach (var f in Triggerables(Trigger.OnPassengerExited))
			{
				try
				{
					using (var trans = self.ToLuaValue(f.Context))
					using (var pass = passenger.ToLuaValue(f.Context))
						f.Function.Call(trans, pass).Dispose();
				}
				catch (Exception ex)
				{
					f.Context.FatalError(ex.Message);
					return;
				}
			}
		}
开发者ID:OpenRA,项目名称:OpenRA,代码行数:20,代码来源:ScriptTriggers.cs


注:本文中的Actor.ToLuaValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。