예제 #1
0
        /// <summary>
        /// Method simulates one iteration.
        /// </summary>
        /// <param name="playground"> Playground. </param>
        public void Iteration(IPlayground playground)
        {
            int numberOfRows    = playground.GetPlaygroundArray().GetLength(0);
            int numberOfColumns = playground.GetPlaygroundArray().GetLength(1);

            for (int index = 0; index < _hunters.Count; index++)
            {
                _hunters[index].SpecialAnimalBehavior(_hunters, _hebrivores, playground.GetPlaygroundArray());

                if ((_hunters[index].TimeToGiveBorth >= 3) && (_hunters.Count < _maximumNumberOfHunters))
                {
                    _hunters[index].TimeToGiveBorth = 0;
                    AddAnumalToList(_hunters[index].GetType(), numberOfRows, numberOfColumns);
                }
            }

            for (int index = 0; index < _hebrivores.Count; index++)
            {
                _hebrivores[index].SpecialAnimalBehavior(_hunters, _hebrivores, playground.GetPlaygroundArray());

                if ((_hebrivores[index].TimeToGiveBorth >= 3) && (_hebrivores.Count <= _maximumNumberOfHebrivores))
                {
                    _hebrivores[index].TimeToGiveBorth = 0;
                    AddAnumalToList(_hebrivores[index].GetType(), numberOfRows, numberOfColumns);
                }
            }

            AnimalHealthCheck();
        }
        //-------------------------------------------------------------------------------------[]
        private BrigadeData.Fighter GetGolemFighterData(
            IPlayground scene,
            string golemClass)
        {
            var loadedGolem = ServerHelper.Instance.GetRandomFighter(golemClass, scene.GamePointsLimit);
            var golem       = new BrigadeData.Fighter {
                Class = golemClass,
                Name  = (golemClass == CombatModelConstants.FighterClasses.GolemReaper
                             ? GenerateGolemReaperName()
                             : GenerateGolemName()),
                FighterCost           = loadedGolem.PriceGamePoints,
                SceneWeightGamePoints = loadedGolem.SceneWeightGamePoints,
                HealthPoints          = loadedGolem.HealthPoints,
                Armor =
                    new EquippedFighterData.ArmorParametersData {
                    ArmorId = loadedGolem.Armor.ArmorId,
                    MagicDamageReductionInPercent    = loadedGolem.Armor.MagicDamageReductionInPercent,
                    PhysicalDamageReductionInPercent = loadedGolem.Armor.PhysicalDamageReductionInPercent,
                },
                WeaponOrPrimarySpell =
                    new EquippedFighterData.WeaponOrPrimarySpellParametersData {
                    WeaponId = loadedGolem.WeaponOrPrimarySpell.WeaponId,
                    MaxPower = loadedGolem.WeaponOrPrimarySpell.MaxPower,
                    MinPower = loadedGolem.WeaponOrPrimarySpell.MinPower,
                    Range    = loadedGolem.WeaponOrPrimarySpell.Range,
                    Falloff  = loadedGolem.WeaponOrPrimarySpell.Falloff,
                },
                ActionPoints         = loadedGolem.ActionPoints,
                FogOfWarVisionRadius = loadedGolem.VisionRadius,
                IsReaper             = golemClass == CombatModelConstants.FighterClasses.GolemReaper
            };

            return(golem);
        }
예제 #3
0
 void Awake()
 {
     Background = GameObject.Find("/Middleground/Background");
     Middleground = GameObject.Find("/Middleground");
     Foreground = GameObject.Find("/Foreground");
     //Stats = new Statistics(Type);
     switch(Type)
     {
         case GameTypes._6x6:
             PlaygroundObject = gameObject.AddComponent<Mode6x6SquarePlayground>();
             break;
         case GameTypes._8x8:
             PlaygroundObject = gameObject.AddComponent<Mode8x8SquarePlayground>();
             break;
         case GameTypes._rhombus:
             PlaygroundObject = gameObject.AddComponent<Mode11RhombusPlayground>();
             break;
         case GameTypes._match3:
             PlaygroundObject = gameObject.AddComponent<ModeMatch3SquarePlayground>();
             break;
         case GameTypes._drops:
             PlaygroundObject = gameObject.AddComponent<ModeDropsPlayground>();
             break;
     }
 }
예제 #4
0
        public Savanna_Test()
        {
            _sut = new SavannaEngine();

            _playground = new Playground(20, 20);
            _playground.ZerroArray();
        }
 public PlaygroundsController(
     IUrlHelper urlHelper,
     IFoodRepository foodRepository,
     IMapper mapper,
     IPlayground provider)
 {
     _foodRepository     = foodRepository;
     _mapper             = mapper;
     _urlHelper          = urlHelper;
     _dataAccessProvider = provider;
 }
예제 #6
0
 public Playground_Test()
 {
     _sut          = new Playground(10, 10);
     _arrayForTest = new int[10, 10]  {
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
         { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, },
     };
     _sut.PlaygroundGrid = _arrayForTest;
 }
예제 #7
0
        /// <summary>
        /// Updates Playground with new data.
        /// </summary>
        /// <param name="playground"> Playground. </param>
        public void UpdatePlayground(IPlayground playground)
        {
            playground.ZerroArray();

            for (int index = 0; index < _hebrivores.Count; index++)
            {
                int x = _hebrivores[index].XPaygroundCoordinate;
                int y = _hebrivores[index].YPaygroundCoordinate;

                playground.SetValue(x, y, _hebrivores[index].AnimalTypeLabel);
            }

            for (int index = 0; index < _hunters.Count; index++)
            {
                int x = _hunters[index].XPaygroundCoordinate;
                int y = _hunters[index].YPaygroundCoordinate;

                playground.SetValue(x, y, _hunters[index].AnimalTypeLabel);
            }
        }
예제 #8
0
 /// <summary>
 /// Methode display playground.
 /// </summary>
 /// <param name="gamePlayground"> Playground. </param>
 public void DisplayPlayground(IPlayground gamePlayground)
 {
     Console.Clear();
     Drow(gamePlayground.GetPlaygroundArray());
 }
 //-------------------------------------------------------------------------------------[]
 private BrigadeData.Fighter GenerateGolem(
     IPlayground scene,
     string golemClass)
 {
     return(GetGolemFighterData(scene, golemClass));
 }
 //-------------------------------------------------------------------------------------[]
 private IFighterStartingInfo GetGolemStartingInfo(
     IPlayground scene,
     string golemClass)
 {
     return(new FighterStartingInfo(BrigadeId, GetGolemFighterData(scene, golemClass)));
 }
예제 #11
0
 /// <summary>
 /// Methode display playground, iteration number and number of live points.
 /// </summary>
 /// <param name="gamePlayground"> Playground </param>
 private void DisplayPlayground(IPlayground gamePlayground)
 {
     Drow(gamePlayground.GetPlaygroundArray());
     WriteInformationAboutPlayground(gamePlayground.GetNumberOfLivePoints(), gamePlayground.IterationNumber);
 }