コード例 #1
0
        /// <summary>
        /// Runs the script event with the given input.
        /// </summary>
        /// <param name="prio">The priority to run with.</param>
        /// <param name="oevt">The details of the script to be ran.</param>
        /// <returns>The event details after firing.</returns>
        public void Run(int prio, BarricadeDestroyedEventArgs oevt)
        {
            BarricadeDestroyedScriptEvent evt = (BarricadeDestroyedScriptEvent)Duplicate();

            evt.Cancelled = oevt.Cancelled;
            evt.Barricade = oevt.Barricade;
            evt.Amount    = oevt.Amount;
            evt.Call(prio);
            oevt.Amount    = evt.Amount;
            oevt.Cancelled = evt.Cancelled;
        }
コード例 #2
0
 public static bool BarricadeDamaged(Barricade barricade, ref ushort amount)
 {
     // TODO: causes?
     BarricadeTag barricadeTag = new BarricadeTag(barricade);
     if (amount >= barricade.health)
     {
         BarricadeDestroyedEventArgs deathevt = new BarricadeDestroyedEventArgs();
         deathevt.Barricade = barricadeTag;
         deathevt.Amount = new NumberTag(amount);
         UnturnedFreneticEvents.OnBarricadeDestroyed.Fire(deathevt);
         amount = (ushort)deathevt.Amount.Internal;
         return deathevt.Cancelled || EntityDestroyed(barricadeTag, ref amount);
     }
     BarricadeDamagedEventArgs evt = new BarricadeDamagedEventArgs();
     evt.Barricade = barricadeTag;
     evt.Amount = new NumberTag(amount);
     UnturnedFreneticEvents.OnBarricadeDamaged.Fire(evt);
     amount = (ushort)evt.Amount.Internal;
     return evt.Cancelled || EntityDamaged(barricadeTag, ref amount);
 }
コード例 #3
0
 /// <summary>
 /// Runs the script event with the given input.
 /// </summary>
 /// <param name="prio">The priority to run with.</param>
 /// <param name="oevt">The details of the script to be ran.</param>
 /// <returns>The event details after firing.</returns>
 public void Run(int prio, BarricadeDestroyedEventArgs oevt)
 {
     BarricadeDestroyedScriptEvent evt = (BarricadeDestroyedScriptEvent)Duplicate();
     evt.Cancelled = oevt.Cancelled;
     evt.Barricade = oevt.Barricade;
     evt.Amount = oevt.Amount;
     evt.Call(prio);
     oevt.Amount = evt.Amount;
     oevt.Cancelled = evt.Cancelled;
 }