/// <summary>
 /// Trigger when the health information of the unit has changed
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 public void UpdateHPBar(Object sender, UnitHPChangedEventArgs args)
 {
     HPBar hpBar = getHPBar();
     hpBar.CurrentHP = args.NewHP;
 }
コード例 #2
0
        /// <summary>
        /// Trigger function in the event of unit's health point has changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void killUnit(Object sender, UnitHPChangedEventArgs e)
        {
            if (e.NewHP <= 0)
            {
                e.Unit.MovedEventHandlers -= updateLocationOfUnit;
                e.Unit.HPChangedEventHandlers -= killUnit;

            }
        }
コード例 #3
0
        /// <summary>
        /// Trigger function in the event of unit's health point has changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void killUnit(Object sender, UnitHPChangedEventArgs e)
        {
            if (e.NewHP <= 0)
            {
                // Do not remove the unit until the animation is done for at least 3 seconds
                //System.Console.Out.WriteLine("Kill Unit");
                /**
                UnitUI ui = (UnitUI)componentToUI[e.Unit];

                ui.Dispose();

                RemoveChild(ui);
                **/
                e.Unit.MovedEventHandlers -= updateLocationOfUnit;
                e.Unit.HPChangedEventHandlers -= killUnit;

            }
        }