public override void onTaskStop() { base.onTaskStop(); if (this.table != null) { this.table.setOccupant(null); // Try to move away from the chair so it "looks free". // If there no walkable space, stay on the chair. Others will still be able to claim it. Position?freeSpot = this.getFreeSpot(this.owner.position); if (freeSpot != null) { NavPath path = this.agent.calculatePath( (Position)freeSpot, false); if (path != null) { this.agent.setPath(path); } } //this.owner.animator.stopClip(); } this.table = null; this.owner.emote.cancelEmote(); }
public override bool shouldExecute() { if (this.owner.hunger.value <= this.startFoodHuntAt) { // Find a table. if (this.isCook() && this.cookMeta.plateState != CellBehaviorTable.EnumPlateState.FULL) { return(false); } foreach (CellBehaviorTable table in this.owner.world.getAllBehaviors <CellBehaviorTable>(behavior => behavior.hasChair && !behavior.isOccupied())) { NavPath path = this.agent.calculatePath(table.chairPos); if (path != null) { path.endingLookDirection = Rotation.directionToRotation(table.center - table.chair.behavior.center); this.navPath = path; this.table = table; this.table.setOccupant(this.owner); return(true); } else { this.owner.emote.startEmote(new Emote("exclamation", 0.1f).setTooltip("Can't find a table")); } } } return(false); }
public override bool shouldExecute() { if (this.cookData.plateState == CellBehaviorTable.EnumPlateState.NONE || this.cookData.plateState == CellBehaviorTable.EnumPlateState.CLEAN) { this.table = this.calculateAndSetPathToClosest <CellBehaviorTable>( true, behavior => behavior.plateState == CellBehaviorTable.EnumPlateState.DIRTY); if (this.table != null) { return(true); } } return(false); }
public override bool shouldExecute() { if (this.cookData.plateState == CellBehaviorTable.EnumPlateState.FULL) { this.table = this.calculateAndSetPathToClosest <CellBehaviorTable>( true, behavior => behavior.plateState == CellBehaviorTable.EnumPlateState.NONE && behavior.isOccupantSitting()); if (this.table != null) { return(true); } else { this.owner.emote.startEmote(new Emote("exclamation", 0.1f).setTooltip("Can't find a way to the table")); } } return(false); }