Exemplo n.º 1
0
 public Ghost(Location location, ConsoleColor color, IMovingStrategy strategy)
     : base(location, '&', color)
 {
     this.strategy = strategy;
     this.route = new List<Location>();
     this.enumerator = this.route.GetEnumerator();
 }
Exemplo n.º 2
0
 public Animal(string name, IEatingStrategy eating, IMovingStrategy moving)
 {
     Name            = name;
     eatingStrategy  = eating;
     movingStrategy  = moving;
     animalListeners = new List <IAnimalListener>();
 }
Exemplo n.º 3
0
 public Ghost(Location location, ConsoleColor color, IMovingStrategy strategy)
     : base(location, '&', color)
 {
     this.strategy   = strategy;
     this.route      = new List <Location>();
     this.enumerator = this.route.GetEnumerator();
 }
Exemplo n.º 4
0
 public void SetStrategy(IMovingStrategy movingStrategy)
 {
     if (movingStrategy == null)
     {
         throw new Exception();
     }
     this.movingStrategy = movingStrategy;
 }
Exemplo n.º 5
0
 public Nuisible(Ecosystem ecosystem, int speed, Position position, STATE state = STATE.Alive)
 {
     this.Ecosystem      = ecosystem;
     this.Speed          = speed;
     this.State          = state;
     this.Position       = position;
     this.Color          = Color.Gray;
     this.MovingStrategy = new RandomMovingStrategy(this);
 }
Exemplo n.º 6
0
        // Moving strategy Intelligence
        public float this[IMovingStrategy movingStrategy]
        {
            get
            { return(movingStrategyIntelligence[movingStrategy]); }

            set
            {
                movingStrategyIntelligence[movingStrategy] = value;
            }
        }
Exemplo n.º 7
0
        public void ChangeContext(string newContext)
        {
            switch (newContext)
            {
            case "Engine":
                this._context        = newContext;
                this._movingStrategy = new EngineMover();
                this._movingStrategy.MoveVessel(this.SpeedOfVessel);
                break;

            case "Oars":
                this._context        = newContext;
                this._movingStrategy = new OarsMover();
                this._movingStrategy.MoveVessel(this.SpeedOfVessel);
                break;

            case "Sails":
                this._context        = newContext;
                this._movingStrategy = new SailMover();
                this._movingStrategy.MoveVessel(this.SpeedOfVessel);
                break;
            }
        }
Exemplo n.º 8
0
 public Amphibia(string name, IEatingStrategy eating, IMovingStrategy moving) : base(name, eating, moving)
 {
 }
Exemplo n.º 9
0
 public Bird(string name, IEatingStrategy eating, IMovingStrategy moving) : base(name, eating, moving)
 {
 }
Exemplo n.º 10
0
 public Reptile(string name, IEatingStrategy eating, IMovingStrategy moving) : base(name, eating, moving)
 {
 }
Exemplo n.º 11
0
 public Dictionary <IMovingStrategy, float> GetPartialIntelligence(IMovingStrategy movingStrategy)
 {
     return(new Dictionary <IMovingStrategy, float>());
 }
Exemplo n.º 12
0
 public bool IsPartialSmart(IMovingStrategy movingStrategy, StrategyIntelligence intelligence)
 {
     return(true);
 }
Exemplo n.º 13
0
 public void DecreaseIntelligence(IMovingStrategy movingStrategyKey, float amount)
 {
 }
Exemplo n.º 14
0
 public Player(string name, IMovingStrategy movingStrategy)
 {
     this.name           = name;
     this.movingStrategy = movingStrategy;
     Console.WriteLine($"New player {this.name} has been created");
 }
Exemplo n.º 15
0
 public void SetMovingStrategy(IMovingStrategy movingStrategy)
 {
     this.movingStrategy = movingStrategy;
 }