當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。