private void DestroyObject(IMatchThreeItem item) { if (_trashController != null && item.GetGameObject() == _trashController.GetGameObject()) { Object.Destroy(_trashController.gameObject); AnimationService.OnAnimationDestroyEndEvent -= DestroyObject; } }
public void SelfDestroy(IMatchThreeItem item) { var animation = item.GetGameObject().transform.DOScale(Vector3.zero, 0.4f).Pause(); animation.SetEase(Ease.OutQuad); animation.OnKill(() => OnDestroyCallBack(item)); animation.Play(); }
public void SetItemController(IMatchThreeItem controller, bool deletePrevSlot = true) { var curControllerSlot = controller?.GetSlot(); if (curControllerSlot != _slotController && curControllerSlot != null && deletePrevSlot) { curControllerSlot.SetItemController(null); // null previous slot item } CurrentItemController = controller; if (controller != null) //change transform of item { var itemTransform = controller.GetGameObject().transform; itemTransform.SetParent(_slotController.transform); //itemTransform.localPosition = Vector3.zero; // without animation } }
public void Fall(IMatchThreeItem item, bool isLast) { var animation = item.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause(); animation.SetEase(Ease.Linear); if (isLast) { animation.OnComplete(() => { OnAnimationFallEndEvent?.Invoke(false); OnAnimationStateChangeEvent?.Invoke(false); }); } animation.OnStart(() => OnAnimationStateChangeEvent?.Invoke(true)); animation.Play(); }
public void Swap(IMatchThreeItem first, IMatchThreeItem second, bool sendEvent) { var animFirst = first.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause(); var animSecond = second.GetGameObject().transform.DOLocalMove(Vector3.zero, 0.5f).Pause(); animFirst.SetEase(Ease.OutQuad); animSecond.SetEase(Ease.OutQuad); if (sendEvent) { animSecond.OnKill(() => OnAnimationSwapEndEvent?.Invoke()); } animFirst.OnStart(() => OnAnimationStateChangeEvent?.Invoke(true)); animSecond.OnComplete(() => OnAnimationStateChangeEvent?.Invoke(false)); animFirst.Play(); animSecond.Play(); }
public void Swap(IMatchThreeItem second, bool sendEvent = true) { var position = second.GetGameObject().transform.position; position.Set(position.x, position.y, position.z - 1); //set on front var bufFirst = (IMatchThreeItem)_trashController; var firstSlot = _trashController.GetSlot(); var secondSlot = second.GetSlot(); firstSlot.SetItemController(second, false); secondSlot.SetItemController(bufFirst, false); s_FirstSwapped = _trashController; s_SecondSwapped = second; MatchThreeController.animationController.Swap(second, bufFirst, sendEvent); }
public void Swap(IMatchThreeItem otherItem, bool sendEvent) => _trashService.Swap(otherItem, sendEvent);
private void OnDestroyCallBack(IMatchThreeItem item) { OnAnimationDestroyEndEvent?.Invoke(item); // OnAnimationFallEndEvent?.Invoke(true); ЕБАНАЯ СУКА ХУЕТА БЛЯТЬ НА КОТОРУЮ Я БЛЯТЬ 3 ЧАСА БЛЯТЬ ПОТРАТИЛ НЕ РАССКОМЕНЧВАТЬ }
public void SelfDestroy(IMatchThreeItem item) => _animationService.SelfDestroy(item);
public void Fall(IMatchThreeItem item, bool isLast) => _animationService.Fall(item, isLast);
public void Swap(IMatchThreeItem first, IMatchThreeItem second, bool sendEvent) => _animationService.Swap(first, second, sendEvent);
public void SetItemController(IMatchThreeItem itemController, bool deletePrevSlot = true) => _slotService.SetItemController(itemController, deletePrevSlot);