public void SetAbility(Ability ability, bool shouldBePresent, AbilityViewState newState) { bool alreadyPresent = _abilityViewsByOrder[ability.Order] != null; if (alreadyPresent && !shouldBePresent) { AbilityView viewToRemove = _abilityViewsByOrder[ability.Order]; _abilityViewsByOrder[ability.Order] = null; PoolingManager.Free(PoolingManager.AbilityView, viewToRemove.gameObject); } else if (!alreadyPresent && shouldBePresent) { AbilityView newView = PoolingManager.Fetch <AbilityView>(PoolingManager.AbilityView, Vector3.zero, Quaternion.identity, transform); _abilityViewsByOrder[ability.Order] = newView; newView.InitializeWith(ability, newState); AdjustViewOrder(ability, newView); } else if (alreadyPresent) { AbilityView viewToChange = _abilityViewsByOrder[ability.Order]; viewToChange.UpdateForState(newState); } }
public void FreeTemporaryUiElements() { IEnumerable <GameObject> statusesToFree = _statusesGroup.GetComponentsInChildren <Image>().Select(i => i.gameObject); foreach (GameObject statusObject in statusesToFree) { PoolingManager.Free(PoolingManager.StatusImage, statusObject); } }
public void RemoveStatus(ViewStatusClass viewStatusClass) { Image imageToFree; if (_classesToStatusImages.TryGetValue(viewStatusClass, out imageToFree)) { _classesToStatusImages.Remove(viewStatusClass); PoolingManager.Free(PoolingManager.StatusImage, imageToFree.gameObject); } }
public void StopShowingCharacterDetails() { foreach (PositionEffect positionEffect in _positionEffectsShown) { PoolingManager.Free(PoolingManager.PositionEffect, positionEffect.gameObject); } _positionEffectsShown.Clear(); GameEntity playerActor = _context.GetPlayerEntity(); Position playerPosition = playerActor.position.Position; _tilePresenter.ResetToHighTiles(); _tilePresenter.ShortenHighTiles(playerPosition, 5); }
public void Free() { _entityUiPresenter.FreeTemporaryUiElements(); PoolingManager.Free(PoolingManager.EntityView, gameObject); }