Ejemplo n.º 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMob"/> class.
        /// </summary>
        public BaseMob()
        {
            Items      = new List <IItem>();
            Stats      = new List <IStat>();
            Appearance = new List <IAppearanceAttribute>();

            // Setup the character event handlers.
            OnLeaveEvent += new OnLeaveHandler(OnLeave);
            OnEnterEvent += new OnEnterHandler(OnEnter);

            // Following event methods are stubs in the event they are ever called
            // without the user having attached its own methods to them.
            OnAttackTargetEvent  += new OnAttackTargetHandler(OnAttackTarget);
            OnDealDamageEvent    += new OnDealDamageHandler(OnDealDamage);
            OnRecieveDamageEvent += new OnRecieveDamageHandler(OnReceiveDamage);
            OnHealEvent          += new OnHealHandler(OnHeal);
            OnRestoreManaEvent   += new OnRestoreManaHandler(OnRestoreMana);
            OnConsumeManaEvent   += new OnConsumeManaHandler(OnConsumeMana);
            OnDeathEvent         += new OnDeathHandler(OnDeath);

            OnEquipEvent      += new OnEquipHandler(OnEquip);
            OnUnequipEvent    += new OnUnequipHandler(OnUnequip);
            OnUseItemEvent    += new OnUseItemHandler(OnUseItem);
            OnRemoveItemEvent += new OnRemoveItemHandler(OnRemoveItem);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseMob"/> class.
        /// </summary>
        public BaseMob()
        {
            Items = new List<IItem>();
            Stats = new List<IStat>();
            Appearance = new List<IAppearanceAttribute>();

            // Setup the character event handlers.
            OnLeaveEvent += new OnLeaveHandler(OnLeave);
            OnEnterEvent += new OnEnterHandler(OnEnter);

            // Following event methods are stubs in the event they are ever called
            // without the user having attached its own methods to them.
            OnAttackTargetEvent += new OnAttackTargetHandler(OnAttackTarget);
            OnDealDamageEvent += new OnDealDamageHandler(OnDealDamage);
            OnRecieveDamageEvent += new OnRecieveDamageHandler(OnReceiveDamage);
            OnHealEvent += new OnHealHandler(OnHeal);
            OnRestoreManaEvent += new OnRestoreManaHandler(OnRestoreMana);
            OnConsumeManaEvent += new OnConsumeManaHandler(OnConsumeMana);
            OnDeathEvent += new OnDeathHandler(OnDeath);

            OnEquipEvent += new OnEquipHandler(OnEquip);
            OnUnequipEvent += new OnUnequipHandler(OnUnequip);
            OnUseItemEvent += new OnUseItemHandler(OnUseItem);
            OnRemoveItemEvent += new OnRemoveItemHandler(OnRemoveItem);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseRoom"/> class.
        /// </summary>
        public BaseRoom() : base()
        {
            Doorways  = new Dictionary <AvailableTravelDirections, IDoor>();
            Occupants = new List <IMob>();
            Items     = new List <IItem>();

            OnEnterEvent += new OnEnterHandler(OnEnter);
            OnLeaveEvent += new OnLeaveHandler(OnLeave);
        }
Ejemplo n.º 4
0
        public override void OnEnter()
        {
            luaEnv = LuaManager.luaEnv; //此处要从LuaManager上获取 全局只有一个
            if (luaEnv == null)
            {
                return;
            }
            onEnter  = luaEnv.Global.GetInPath <OnEnterHandler>(this.GetType().Name + ".OnEnter");
            onUpdate = LuaManager.luaEnv.Global.GetInPath <OnUpdateHandler>(this.GetType().Name + ".OnUpdate");
            onLeave  = LuaManager.luaEnv.Global.GetInPath <OnLeaveHandler>(this.GetType().Name + ".OnLeave");
            onDestry = LuaManager.luaEnv.Global.GetInPath <OnDestryHandler>(this.GetType().Name + ".OnDestry");

            if (onEnter != null)
            {
                onEnter();
            }
        }
Ejemplo n.º 5
0
        public DefaultPlayer()
        {
            AddAppearanceDescription(new Head("The head of the body", "The head is normal sized without any outstanding features."));
            AddAppearanceDescription(new Hair("The hair on the head.", "The hair is combed nicely, parted down the middle."));
            Health hp = new Health();
            Mana mp = new Mana();

            hp.Amount = 100;
            mp.Amount = 50;

            AddStat(hp);
            AddStat(mp);

            CanTalk = true;
            MaxInventorySize = 12;

            StarterBag bag = new StarterBag();
            Items.Add(bag);

            OnEnterEvent += new OnEnterHandler(OnEnterRoom);
        }
Ejemplo n.º 6
0
        public DefaultPlayer()
        {
            AddAppearanceDescription(new Head("The head of the body", "The head is normal sized without any outstanding features."));
            AddAppearanceDescription(new Hair("The hair on the head.", "The hair is combed nicely, parted down the middle."));
            Health hp = new Health();
            Mana   mp = new Mana();

            hp.Amount = 100;
            mp.Amount = 50;

            AddStat(hp);
            AddStat(mp);

            CanTalk          = true;
            MaxInventorySize = 12;

            StarterBag bag = new StarterBag();

            Items.Add(bag);

            OnEnterEvent += new OnEnterHandler(OnEnterRoom);
        }