コード例 #1
0
    dStructure GetBasicStructure()
    {
        Dictionary <eRadius, RadiusRange> radii = new Dictionary <eRadius, RadiusRange>();

        radii[eRadius.Vision]     = new RadiusRange(ePath.Euclidian, 5f);
        radii[eRadius.Control]    = new RadiusRange(ePath.NodeEuclidian, 3f);
        radii[eRadius.Extraction] = new RadiusRange(ePath.NodeEuclidian, 2f);
        radii[eRadius.Military]   = new RadiusRange(ePath.NodeEuclidian, 1f);
        dStructure sd = new dStructure(1f, 3f, radii);

        return(sd);
    }
コード例 #2
0
    public virtual dStructurePlacement Click(Player currentPlayer)
    {
        dStructure          structureToBuild = GetBasicStructure();
        dStructurePlacement spd = new dStructurePlacement(structureToBuild, currentPlayer, this);
        bool placementSuccess   = TryToMakeStructure(currentPlayer, structureToBuild);

        if (placementSuccess)
        {
            return(spd);
        }
        else
        {
            return(null);
        }
    }
コード例 #3
0
    public virtual bool TryToMakeStructure(Player currentPlayer, dStructure structureToBuild)
    {
        bool madeStructure = false;

        if (currentPlayer != null)
        {
            if (_structure == null)
            {
                if (_terrain._type == eTerrain.Land)
                {
                    if (_game._stats._numberOfStructures[currentPlayer] <= 0 || _stats._control._controllingPlayers[currentPlayer])
                    {
                        dStructurePlacement potentialSd = new dStructurePlacement(structureToBuild, currentPlayer, this);
                        madeStructure = currentPlayer._buildQueue.TryToAddStructureToBuildQueue(potentialSd);
                        Debug.Log($"{currentPlayer._name} added a structure to the build queue");
                    }
                    else
                    {
                        Debug.Log($"{currentPlayer._name} can't Build - Not Controlled");
                    }
                }
                else
                {
                    Debug.Log($"{currentPlayer._name} can't Build - Unbuildable");
                }
            }
            else
            {
                Debug.Log("Can't Build - Occupied");
            }
        }
        else
        {
            Debug.Log("Can't Build - No Player");
        }

        return(madeStructure);
    }
コード例 #4
0
 public dStructurePlacement(dStructure d, Player p, HomelandsLocation l)
 {
     data     = d;
     creator  = p;
     location = l;
 }