Пример #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;
        }
    }