Пример #1
0
    /// <summary>
    /// Draw lines and colors related to dependency.
    /// </summary>
    public void DrawDependencyInfo(Planet planet, Structure structure)
    {
        this.planet = planet;
        this.structure = structure;

        List<Structure> neighbors = planet.GetNeigboringStructures(transform.position);
        this.neighbors = neighbors;

        bool isValid = false;
        ClearDependencyLines();

        foreach(Structure neighbor in neighbors)
        {
            if(structure.CheckRequirements(neighbor.GetOutput()))
            {
                UpdateDependencyLine(neighbor.gameObject);
                isValid = true;
            }
            else
                ClearDependencyLine(neighbor.gameObject);
        }

        if(isValid)
            renderer.material.color = Color.green;
        else
        {
            renderer.material.color = Color.red;
        }
    }
Пример #2
0
 //TODO: Check ALL reqs, not one, for both this function and DrawDependencies
 private bool CheckRequirements(Planet planet)
 {
     List<Structure> neighbors = planet.GetNeigboringStructures(transform.position);
     foreach(Structure neighbor in neighbors)
     {
         if(CheckRequirements(neighbor.GetOutput()))
         {
             return true;
         }
     }
     return false;
 }