示例#1
0
    public override bool IsAvailable(NPC_Commune npc)
    {
        List <SoilBush> plantable = new List <SoilBush>();

        foreach (var tilledsoil in GameObject.FindObjectsOfType <SoilBush>())
        {
            if (tilledsoil.CurrentStage == SoilBush.Stage.Tilled && tilledsoil.AssignedNPC == null)
            {
                plantable.Add(tilledsoil);
            }
        }
        if (plantable.Count > 0)
        {
            SoilBush             = plantable[Random.Range(0, plantable.Count)];
            SoilBush.AssignedNPC = npc;
            return(true);
        }
        return(false);
    }
示例#2
0
    public override bool IsAvailable(NPC_Commune npc)
    {
        List <SoilBush> gatherable = new List <SoilBush>();

        foreach (var bush in GameObject.FindObjectsOfType <SoilBush>())
        {
            if (bush.CurrentStage == SoilBush.Stage.Harvestable && bush.AssignedNPC == null)
            {
                gatherable.Add(bush);
            }
        }
        if (gatherable.Count > 0)
        {
            Bush             = gatherable[Random.Range(0, gatherable.Count)];
            Bush.AssignedNPC = npc;
            return(true);
        }
        return(false);
    }