Exemplo n.º 1
0
 private void DestroyObject(IMatchThreeItem item)
 {
     if (_trashController != null && item.GetGameObject() == _trashController.GetGameObject())
     {
         Object.Destroy(_trashController.gameObject);
         AnimationService.OnAnimationDestroyEndEvent -= DestroyObject;
     }
 }
Exemplo n.º 2
0
    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();
    }
Exemplo n.º 3
0
    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
        }
    }
Exemplo n.º 4
0
    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();
    }
Exemplo n.º 5
0
    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();
    }
Exemplo n.º 6
0
    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);
    }
Exemplo n.º 7
0
 public void Swap(IMatchThreeItem otherItem, bool sendEvent) => _trashService.Swap(otherItem, sendEvent);
Exemplo n.º 8
0
 private void OnDestroyCallBack(IMatchThreeItem item)
 {
     OnAnimationDestroyEndEvent?.Invoke(item);
     // OnAnimationFallEndEvent?.Invoke(true); ЕБАНАЯ СУКА ХУЕТА БЛЯТЬ НА КОТОРУЮ Я БЛЯТЬ 3 ЧАСА БЛЯТЬ ПОТРАТИЛ НЕ РАССКОМЕНЧВАТЬ
 }
Exemplo n.º 9
0
 public void SelfDestroy(IMatchThreeItem item) => _animationService.SelfDestroy(item);
Exemplo n.º 10
0
 public void Fall(IMatchThreeItem item, bool isLast) => _animationService.Fall(item, isLast);
Exemplo n.º 11
0
 public void Swap(IMatchThreeItem first, IMatchThreeItem second, bool sendEvent) => _animationService.Swap(first, second, sendEvent);
Exemplo n.º 12
0
 public void SetItemController(IMatchThreeItem itemController, bool deletePrevSlot = true) => _slotService.SetItemController(itemController, deletePrevSlot);