Ejemplo n.º 1
0
        public void ComposeCreature(CreatureFaction faction, int creatureId, int definitionId, FDPosition position, int dropItem = 0)
        {
            CreatureDefinition creatureDef = DefinitionStore.Instance.GetCreatureDefinition(definitionId);
            FDCreature         creature    = new FDCreature(creatureId, faction, creatureDef, position);

            switch (faction)
            {
            case CreatureFaction.Friend:
                this.Friends.Add(creature);
                break;

            case CreatureFaction.Enemy:
                if (dropItem > 0)
                {
                    creature.Data.DropItem = dropItem;
                }
                this.Enemies.Add(creature);
                break;

            case CreatureFaction.Npc:
                this.Npcs.Add(creature);
                break;

            default:
                break;
            }

            CreatureComposePack pack = new CreatureComposePack(creatureId, creatureDef.AnimationId, position);

            gameCallback.OnHandlePack(pack);
        }
Ejemplo n.º 2
0
        private static ActivityBase BuildComposeCreatureActivity(CreatureComposePack pack)
        {
            if (pack == null)
            {
                throw new ArgumentNullException("CreatureMovePack");
            }

            CallbackActivity act = new CallbackActivity(
                (callback) => { callback.PlaceCreature(pack.CreatureId, pack.AnimationId, pack.Position); });

            return(act);
        }