Exemplo n.º 1
0
    public override IEnumerator Perform()
    {
        ObjectDefinition buildDefinition = GameObject.GetComponent <ObjectDefinition>();

        ResourceResolver resources = Owner.GetComponent <ResourceResolver>();

        BuildQueue queue = Owner.GetComponent <BuildQueue>();

        queue.OnBuildComplete += BuildComplete;

        if (resources.CanAfford(buildDefinition))
        {
            resources.Spend(buildDefinition);

            queue.Add(GameObject, Position, buildDefinition.BuildTime, PostBuildAction);
        }

        yield return(0);
    }