예제 #1
0
    public override IEnumerator Gather(EntityBody target)
    {
        //TODO: based on stats, equipment and the specific target
        // time should be modified
        // also, gathering range stuff
        Energy -= 3;
        ResourceNodeBody targetResource = target as ResourceNodeBody;

        if (targetResource != null && !targetResource.ResourceReady)
        {
            yield return(StartCoroutine(WaitWithProgress(1)));

            yield break;
        }

        float time    = targetResource != null ? targetResource.BaseGatheringTime : 4;
        int   timeMod = 5;

        switch (target.GenericName)
        {
        case EntityType.Tree:
            timeMod += Strength;
            if (Tool == ToolKind.Axe)
            {
                timeMod += ToolLevel;
            }
            else
            {
                Energy -= 4;
            }
            break;

        case EntityType.Lake:
            timeMod += Agility;
            if (Tool == ToolKind.Pole)
            {
                timeMod += ToolLevel;
            }
            else
            {
                Energy -= 4;
            }
            break;
        }
        time *= 5.0f / timeMod;
        yield return(StartCoroutine(WaitWithProgress(time)));

        target.GetGathered(this);
    }
예제 #2
0
 public void NewDepleted(ResourceNodeBody body)
 {
     nodes.Add(body);
 }