Ejemplo n.º 1
0
    /// <summary>
    /// Processes an action raised by the queuedrawer script
    /// </summary>
    /// <param name="index"></param>
    public void QueueAction(int index)
    {
        ProductionStruct ps = buildQueue[index];

        ps.productionObject.GetComponent <ResourceCost>().IncreaseResources();
        buildQueue.Remove(ps);
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Responds to a hud action
 /// </summary>
 /// <param name="go">The gameobject that was clicked</param>
 public override void HUDAction(GameObject go)
 {
     ResourceCost resCost = go.GetComponent<ResourceCost>();
     if (resCost == null)
     {
         Debug.LogError(string.Format("Buildable object {0} does not have a resource cost script", go.name));
     }
     if (!resCost.CheckCost())
     {
         return;
     }
     resCost.DecreaseResources();
     ProductionStruct ps = new ProductionStruct();
     ps.productionObject = go;
     ps.turnsLeft = go.GetComponent<Unit>().BuildTurns;
     buildQueue.Add(ps);
 }
Ejemplo n.º 3
0
    /// <summary>
    /// Responds to a hud action
    /// </summary>
    /// <param name="go">The gameobject that was clicked</param>
    public override void HUDAction(GameObject go)
    {
        ResourceCost resCost = go.GetComponent <ResourceCost>();

        if (resCost == null)
        {
            Debug.LogError(string.Format("Buildable object {0} does not have a resource cost script", go.name));
        }
        if (!resCost.CheckCost())
        {
            return;
        }
        resCost.DecreaseResources();
        ProductionStruct ps = new ProductionStruct();

        ps.productionObject = go;
        ps.turnsLeft        = go.GetComponent <Unit>().BuildTurns;
        buildQueue.Add(ps);
    }