protected override void Execute(List <GameEntity> entities) { foreach (var entity in entities) { InteractibleView interactibleView = entity.view.value.GetComponent <InteractibleView>(); interactibleView.ToggleContainer(entity.containedObject.ParentEntity); if (interactibleView.Type == InteractibleTypesEnum.Fruit) { TriggerEvent(EventsEnum.FruitInCrate, -1); } } }
private void ProcessPick(GameEntity entity) { // Prevent picking more than one object at the same time. if (_pickedUpObjects.count > 0 || _movingObjects.count > 0) { return; } // If the object is out from a contained space, additional actions are required. if (entity.hasContainedObject) { InteractibleView interactibleView = entity.view.value.GetComponent <InteractibleView>(); entity.RemoveContainedObject(); interactibleView.ToggleContainer(null); if (interactibleView.Type == InteractibleTypesEnum.Fruit) { TriggerEvent(EventsEnum.FruitInCrate, 1); } } entity.AddPickedUp(Time.time, entity.view.value.transform.position, 0); }