Beispiel #1
0
    public static ImprovementObject PlaceImprovement(string name, TileObject tile, UnitObject source)
    {
        if (name == "City")
        {
            //capital doesnt exist yet, but its building a city
            if (!source.Nation.Capital)
            {
                name = "Capital";
            }
        }
        else if (name == "Capital")
        {
            //building a capital, but we already have one
            if (source.Nation.Capital)
            {
                name = "City";
            }
        }

        Debug.Log("Placed " + name);
        Improvement improvement = name;

        ImprovementObject improvementObject = Instantiate(improvement.prefab).GetComponent <ImprovementObject>();

        improvementObject.Improvement = improvement;
        improvementObject.Tile        = tile;
        improvementObject.Initialize(source);

        return(improvementObject);
    }
Beispiel #2
0
    internal void Enter(ImprovementObject obj)
    {
        if (improvementObjects.Contains(obj))
        {
            return;
        }

        improvementObjects.Add(obj);
    }
Beispiel #3
0
    internal void Exit(ImprovementObject obj)
    {
        if (!improvementObjects.Contains(obj))
        {
            return;
        }

        improvementObjects.Remove(obj);
    }
Beispiel #4
0
    private void Awake()
    {
        canvas = GetComponentInChildren <Canvas>();
        panel  = canvas.GetComponentInChildren <Image>();

        nameText  = panel.transform.Find("Name").GetComponent <Text>();
        statsText = panel.transform.Find("Stats").GetComponent <Text>();

        unitObject        = GetComponent <UnitObject>();
        improvementObject = GetComponent <ImprovementObject>();
    }
Beispiel #5
0
 public void Initialize(Task task, ImprovementObject improvementObject)
 {
     this.improvementObject = improvementObject;
     this.task = task;
     Text      = task.friendlyName;
 }