public void Update(IAtlas atlas, ITilesetTable table) { var temperatureAround = atlas.Temperature(Position); //LogAvatarStatus(atlas, temperatureAround); float oldEnergy = Energy; LoseEnergy(); BalanceTemperature(temperatureAround, oldEnergy - Energy); LoseRest(); if (Interact) { InteractWithAllInteractablesInFrontOf(atlas, table); Interact = false; return; } if (PickUp) { if (Tool == null) { PerformPickup(atlas, table); } else { PerformLayDown(atlas, table); } PickUp = false; return; } if (UseTool) { var usable = Tool as IUsableGameActor; if (usable != null) { usable.Use(new GameActorPosition(this, Position, LayerType.Object), atlas, table); } } }
public void Update(IAtlas atlas) { var temperatureAround = atlas.Temperature(Position); //LogAvatarStatus(atlas, temperatureAround); float oldEnergy = Energy; LoseEnergy(); BalanceTemperature(temperatureAround, oldEnergy - Energy); LoseRest(); if (Interact) { if (!InteractPreviousStep) { InteractWithAllInteractablesInFrontOf(atlas); } Interact = false; InteractPreviousStep = true; return; } InteractPreviousStep = false; if (PickUp) { if (!PickUpPreviousStep) { if (Tool == null) { PerformPickup(atlas); } else { PerformLayDown(atlas); } } PickUp = false; PickUpPreviousStep = true; return; } else { PickUpPreviousStep = false; } if (UseTool) { if (!UseToolPreviousStep) { var usable = Tool as IUsableGameActor; usable?.Use(new GameActorPosition(this, Position, LayerType.Object), atlas); } UseTool = false; UseToolPreviousStep = true; } else { UseToolPreviousStep = false; } }