示例#1
0
 public void Build(BuildPlotLocation location, BuildingType buildingType, BuildingModel buildingModel)
 {
     buildPlotMap.Build(location, buildingType, buildingModel);
     OutputPlotStatus();
     UpdateBuildPlotView(location);
     UpdateBuildingInfoView(buildingType);
 }
示例#2
0
    public void QueueBuildCommand()
    {
        BuildPlotLocation    location = selectedBuildPlotManager.GetSelectedLocation();
        GameBehaviourCommand command  = BuildingCommandFactory.CreateConstructBuildingCommand(location, buildingType, PlayerType.PLAYER);

        QueueUpCommand(command);
    }
    public DemolishBuildingCommand(BuildPlotLocation buildPlotLocation, PlayerType playerType)
    {
        this.playerType        = playerType;
        this.buildPlotLocation = buildPlotLocation;


        Debug.Log("demolish command created");
    }
示例#4
0
    public ConstructBuildingCommand(BuildPlotLocation buildPlotLocation, BuildingType buildingType, PlayerType playerType)
    {
        this.playerType        = playerType;
        this.buildPlotLocation = buildPlotLocation;
        this.buildingType      = buildingType;
        buildingModel          = null;

        Debug.Log("build command created");
    }
示例#5
0
 public BuildPlot(BuildPlotLocation location, PlayerType playerType)
 {
     this.playerType     = playerType;
     buildingType        = BuildingType.NONE;
     this.location       = location;
     isUnderConstruction = false;
     constructedTicks    = 0;
     constructionTime    = 0;
 }
示例#6
0
    public void Demolish(BuildPlotLocation location)
    {
        // get type for view update
        BuildingType buildingType = buildPlotMap.GetBuilding(location);

        // demolish
        buildPlotMap.Demolish(location);

        // update views
        OutputPlotStatus();
        UpdateBuildPlotView(location);
        UpdateBuildingInfoView(buildingType);
    }
示例#7
0
    public void UpdateBuildPlotView(BuildPlotLocation location)
    {
        if (playerType == PlayerType.AI)
        {
            return;
        }

        bool isUnderConstruction = buildPlotMap.IsUnderConstruction(location);

        buildPlotViews[location].UpdateUnderConstruction(isUnderConstruction);

        BuildingType building = buildPlotMap.GetBuilding(location);

        buildPlotViews[location].UpdateCurrentBuilding(building);
    }
    public void ShowSelectedBuildPlot()
    {
        BuildPlotLocation selectedItem = GetSelectedLocation();

        foreach (KeyValuePair <BuildPlotLocation, BuildPlotView> entry in buildPlotViews)
        {
            if (selectedItem == entry.Key)
            {
                entry.Value.gameObject.SetActive(true);
            }
            else
            {
                entry.Value.gameObject.SetActive(false);
            }
        }
    }
    public void InitialiseBuildPlotViewObjects()
    {
        buildPlotViews = new Dictionary <BuildPlotLocation, BuildPlotView>();

        BuildPlotLocation location = ConvertStringToBuildPlotLocation("North East");

        buildPlotViews[ConvertStringToBuildPlotLocation("North East")] = GameObject.Find("BuildPlotPanel - NorthEast").GetComponent <BuildPlotView>();

        location = ConvertStringToBuildPlotLocation("North West");
        buildPlotViews[location] = GameObject.Find("BuildPlotPanel - NorthWest").GetComponent <BuildPlotView>();

        location = ConvertStringToBuildPlotLocation("South");
        buildPlotViews[location] = GameObject.Find("BuildPlotPanel - South").GetComponent <BuildPlotView>();

        location = ConvertStringToBuildPlotLocation("West");
        buildPlotViews[location] = GameObject.Find("BuildPlotPanel - West").GetComponent <BuildPlotView>();
    }
示例#10
0
 public BuildingType GetBuilding(BuildPlotLocation location)
 {
     return(buildPlots[location].buildingType);
 }
示例#11
0
 // Safety functions
 public bool IsBuildable(BuildPlotLocation location)
 {
     return(buildPlots[location].IsEmpty() && !buildPlots[location].isUnderConstruction);
 }
示例#12
0
 public bool IsDemolishable(BuildPlotLocation location)
 {
     return(!(buildPlots[location].IsEmpty() || buildPlots[location].isUnderConstruction));
 }
 public static GameBehaviourCommand CreateConstructBuildingCommand(BuildPlotLocation plotLocation, BuildingType buildingType, PlayerType playerType)
 {
     return(new ConstructBuildingCommand(plotLocation, buildingType, playerType));
 }
 public static GameBehaviourCommand CreateDemolishCommand(BuildPlotLocation plotLocation, PlayerType playerType)
 {
     return(new DemolishBuildingCommand(plotLocation, playerType));
 }
示例#15
0
 // Check if buildable before this!
 public void Build(BuildPlotLocation location, BuildingType buildingType, BuildingModel buildingModel)
 {
     buildPlots[location].Build(buildingType, buildingModel);
 }
示例#16
0
 public bool IsDemolishable(BuildPlotLocation location)
 {
     return(buildPlotMap.IsDemolishable(location));
 }
示例#17
0
 // Check if Demolishable before this!
 public void Demolish(BuildPlotLocation location)
 {
     buildPlots[location].Demolish();
 }
示例#18
0
 public bool IsUnderConstruction(BuildPlotLocation location)
 {
     return(buildPlots[location].isUnderConstruction);
 }