/// <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); }
/// <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); }
/// <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); }