Ejemplo n.º 1
0
 public Guard(MobileObjectInitialization init) : base(init)
 {
     foreach (var pameter in init.Parameters)
     {
         switch (pameter.Item1)
         {
         case "path":
             var track = GameInformationManager.GetTrackByName(pameter.Item2);
             normalGuardTrack = track;
             break;
         }
     }
 }
Ejemplo n.º 2
0
        public static ICreature GetCreatureByNameAndInitParams(CreatureTypes type, MobileObjectInitialization init)
        {
            switch (type)
            {
            case CreatureTypes.Player:
                return(init.IsDefaultInitialization
                        ? new Player(new MobileObjectInitialization(init.Position, init.Direction))
                        : new Player(init));

            case CreatureTypes.Guard:
                return(init.IsDefaultInitialization
                        ? new Guard(new MobileObjectInitialization(init.Position, init.Direction))
                        : new Guard(init));

            default:
                throw new Exception("Попытка создания несуществующего Creature: " + type);
            }
        }
Ejemplo n.º 3
0
 //public static MobileObject GetDefault(MobileObjectInitialization init)
 //{
 //    return GenerateRandomMobileObject(init.Position, init.Direction);
 //}
 protected MobileObject(MobileObjectInitialization init)
 {
     if (init.IsDefaultInitialization)
     {
         GenerateRandomMobileObject(init.Position, init.Direction);
     }
     else
     {
         Position         = init.Position;
         Health           = init.Health;
         MaxHealth        = init.MaxHealth;
         Direction        = init.Direction;
         MinHearingVolume = init.MinHearingVolume;
         MaxHearingDelta  = init.MaxHearingDelta;
         ViewDistanse     = init.ViewDistanse;
         ViewWidth        = init.ViewWidth;
         Inventory        = init.Inventory;
     }
 }
Ejemplo n.º 4
0
 public static void CreateCreature(CreatureTypes type, MobileObjectInitialization init)
 {
     AddCreature(GetCreatureByNameAndInitParams(type, init));
 }
Ejemplo n.º 5
0
 public Player(MobileObjectInitialization init) : base(init)
 {
 }