示例#1
0
    public override bool shouldExecute()
    {
        if (this.cookData.plateState == CellBehaviorTable.EnumPlateState.CLEAN || this.cookData.plateState == CellBehaviorTable.EnumPlateState.NONE)
        {
            if (this.doesSomeoneNeedFood())
            {
                this.stove = this.calculateAndSetPathToClosest <CellBehaviorStove>(
                    false,
                    behavior => !behavior.isOccupied(),
                    Rotation.UP,
                    Position.down);

                if (this.stove != null)
                {
                    this.stove.setOccupant(this.owner);
                    return(true);
                }
                else
                {
                    // Someone needs food, but there is no stove
                    this.owner.emote.startEmote(new Emote("exclamation", 0.1f).setTooltip("Needs a stove to cook food"));
                }
            }
        }

        return(false);
    }
示例#2
0
    public override void onTaskStop()
    {
        base.onTaskStop();

        if (this.stove != null)
        {
            this.stove.setOccupant(null);
        }

        this.stove = null;

        this.cookTimer = 0;
    }