Ejemplo n.º 1
0
    public MiningWorker(int value, WORKER_TYPE workerType) : base(value, workerType)
    {
        switch (workerType)
        {
        case WORKER_TYPE.StoneMiner:
            targetResource = "Stone";
            break;

        case WORKER_TYPE.CopperMiner:
            targetResource = "Copper Ore";
            break;

        case WORKER_TYPE.TinMiner:
            targetResource = "Tin Ore";
            break;

        case WORKER_TYPE.CoalMiner:
            targetResource = "Coal";
            break;

        case WORKER_TYPE.IronMiner:
            targetResource = "Iron Ore";
            break;
        }
        //TODO actually custom-tailor these to the worker types
        mCurTime = 0.0f;
        mMaxTime = 1.0f;

        mCapCount = 10; //TODO start this at zero, increase it with new building unlocks & upgrades
        //Debug.Log(gameObject);

        mwei         = new MiningWorkerEventInfo(targetResource);
        mwei.eventGO = go;
    }
Ejemplo n.º 2
0
    //called whenever a worker purchase occurs. Updates the mining power.
    //Event driven
    void MiningWorkerUpdate(MiningWorkerEventInfo eventInfo)
    {
        //Debug.Log(eventInfo.workerCount);
        int    power  = eventInfo.workerPower;
        string target = eventInfo.eventTargetResource;

        switch (target)
        {
        case "Stone":
            stonePower = power;
            break;

        case "Copper Ore":
            copperPower = power;
            break;

        case "Tin Ore":
            tinPower = power;
            break;

        case "Coal":
            coalPower = power;
            break;

        case "Iron Ore":
            ironPower = power;
            break;
        }
    }