private IHexCell BuildCell(
            CellTerrain terrain       = CellTerrain.Grassland,
            CellShape shape           = CellShape.Flatlands,
            CellVegetation vegetation = CellVegetation.None,
            CellFeature feature       = CellFeature.None,
            bool hasRoads             = false,
            bool hasRiver             = false,
            ICity city = null
            )
        {
            var mockCell = new Mock <IHexCell>();

            mockCell.SetupAllProperties();

            var newCell = mockCell.Object;

            newCell.Terrain    = terrain;
            newCell.Shape      = shape;
            newCell.Vegetation = vegetation;
            newCell.Feature    = feature;
            newCell.HasRoads   = hasRoads;

            MockRiverCanon.Setup(canon => canon.HasRiver(newCell)).Returns(hasRiver);

            MockCityLocationCanon.Setup(canon => canon.GetPossessionsOfOwner(newCell))
            .Returns(city != null ? new List <ICity>()
            {
                city
            } : new List <ICity>());

            return(newCell);
        }
 public void SetActiveShape(int index)
 {
     IsPainting = index >= 0;
     if (IsPainting)
     {
         ActiveFeature = (CellFeature)index;
     }
 }
        public void ChangeFeatureOfCell(IHexCell cell, CellFeature feature)
        {
            if (!CanChangeFeatureOfCell(cell, feature))
            {
                throw new InvalidOperationException("CanChangeFeatureOfCell must return true on the given arguments");
            }

            cell.Feature = feature;
        }
Пример #4
0
        public int GetBaseMoveCostOfFeature(CellFeature feature)
        {
            switch (feature)
            {
            case CellFeature.None:      return(0);

            case CellFeature.Oasis:     return(OasisMoveCost);

            case CellFeature.CityRuins: return(CityRuinsMoveCost);

            default: throw new NotImplementedException(string.Format("No configured move cost for feature {0}", feature));
            }
        }
Пример #5
0
        public YieldSummary GetYieldOfFeature(CellFeature feature)
        {
            switch (feature)
            {
            case CellFeature.None:      return(YieldSummary.Empty);

            case CellFeature.Oasis:     return(OasisYield);

            case CellFeature.CityRuins: return(YieldSummary.Empty);

            default: throw new NotImplementedException();
            }
        }
        private IHexCell BuildCell(
            ICity owner, bool isUnderwater = false, CellFeature feature = CellFeature.None
            )
        {
            var mockCell = new Mock <IHexCell>();

            mockCell.Setup(cell => cell.Terrain).Returns(isUnderwater ? CellTerrain.FreshWater : CellTerrain.Grassland);
            mockCell.Setup(cell => cell.Feature).Returns(feature);

            MockPossessionCanon.Setup(canon => canon.GetOwnerOfPossession(mockCell.Object)).Returns(owner);

            return(mockCell.Object);
        }
Пример #7
0
        private IHexCell BuildCell(
            CellTerrain terrain       = CellTerrain.Grassland,
            CellShape shape           = CellShape.Flatlands,
            CellVegetation vegetation = CellVegetation.None,
            CellFeature feature       = CellFeature.None
            )
        {
            var mockCell = new Mock <IHexCell>();

            mockCell.Setup(cell => cell.Terrain).Returns(terrain);
            mockCell.Setup(cell => cell.Shape).Returns(shape);
            mockCell.Setup(cell => cell.Vegetation).Returns(vegetation);
            mockCell.Setup(cell => cell.Feature).Returns(feature);

            return(mockCell.Object);
        }
 public bool CanChangeFeatureOfCell(IHexCell cell, CellFeature feature)
 {
     if (feature == CellFeature.None)
     {
         return(true);
     }
     else if (feature == CellFeature.Oasis)
     {
         return(cell.Terrain == CellTerrain.Desert && cell.Shape == CellShape.Flatlands);
     }
     else if (feature == CellFeature.CityRuins)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #9
0
        private IHexCell BuildCell(
            CellFeature feature = CellFeature.None, CellVegetation vegetation = CellVegetation.None,
            bool hasRiver       = false, bool hasRoads = false,
            IEnumerable <IImprovement> improvements = null, ICivilization civClaiming = null
            )
        {
            var mockCell = new Mock <IHexCell>();

            mockCell.Setup(cell => cell.Feature).Returns(feature);
            mockCell.Setup(cell => cell.Vegetation).Returns(vegetation);
            mockCell.Setup(cell => cell.HasRoads).Returns(hasRoads);

            var newCell = mockCell.Object;

            MockRiverCanon.Setup(canon => canon.HasRiver(newCell)).Returns(hasRiver);

            MockImprovementLocationCanon.Setup(canon => canon.GetPossessionsOfOwner(newCell)).Returns(
                improvements != null ? improvements : new List <IImprovement>()
                );

            MockCivTerritoryLogic.Setup(logic => logic.GetCivClaimingCell(newCell)).Returns(civClaiming);

            return(newCell);
        }
Пример #10
0
	public void SetFeature(CellFeature f)
	{ 
		feature = f;  
		if(cellView != null)
			cellView.SetFeature(f); 
	}
Пример #11
0
 public bool DoesFeatureOverrideYield(CellFeature feature)
 {
     return(feature == CellFeature.Oasis);
 }
Пример #12
0
	public void SetFeature(CellFeature f)
	{
		ResetFeatures();
		if(f == CellFeature.Bomb)
			render.material.SetFloat("_IsBomb", 1);
	}