Ejemplo n.º 1
0
    protected void MoveToPlatform(Platform destinationPlatform)
    {
        if (!onMoving && destinationPlatform && destinationPlatform.GetNode().walkable)
        {
            AudioController.PlaySFX("Move");
            Facing(destinationPlatform);
            transform.parent = destinationPlatform.transform;

            onMoving = true;

            activePlatform.OnTriggerExitPlatform();
            direction = GetDirection(destinationPlatform);
            //Platform platformDestination = activePlatform.GetNextNode(currentMove);
            activePlatform = destinationPlatform;

            DOTween.Sequence()
            .AppendCallback(() => transform.DOLocalMove(GetJumpKoefisien(), speed / 2))
            .AppendInterval(speed / 2)
            .AppendCallback(() => transform.DOLocalMove(Vector2.zero + offsetPosition, speed / 2).SetEase(Ease.Flash))
            .AppendInterval(speed / 2)
            .AppendCallback(() => activePlatform.OnTriggerEnterPlatform())
            .OnComplete(() => OnCompleteStep());
        }
        else
        {
            if (destinationPlatform)
            {
                if (!destinationPlatform.GetNode().walkable)
                {
                    dialogueSay.SaySomething("not_walkable");
                }
                if (destinationPlatform.platformClaim)
                {
                    dialogueSay.SaySomething("platform_claim");
                }
            }
            else
            {
                dialogueSay.SaySomething("not_found");
            }
        }
    }
Ejemplo n.º 2
0
    protected void MoveToPlatform(Platform destinationPlatform)
    {
        if (activePlatform.CheckWalkableNode(currentMove) && !rewind && !ObstacleCheck(destinationPlatform))
        {
            AudioController.PlaySFX("Move");
            //Facing(currentMove);
            Facing(destinationPlatform);
            transform.parent = destinationPlatform.transform;
            onMoving         = true;
            activePlatform.OnTriggerExitPlatform();
            //activePlatform.OnPlatformExit(info.PlatformColor);

            //Platform platformDestination = activePlatform.GetNextNode(currentMove);
            activePlatform = destinationPlatform;
            if (activePlatform.GetNode().platformType != Platform.PlatformNode.PlatformType.FINISH)
            {
                savePlatform.Add(activePlatform);
            }
            else
            {
                if (collectableItem)
                {
                    rewind = true;
                    GameVariables.REWIND = true;
                    if (rewind)
                    {
                        dialogueSay.SaySomething("rewind");
                        countPlatform = savePlatform.Count - 1;
                        GameManagement.Instance.TriggerRewindEffect();
                        AudioController.PlaySFX("Rewind");
                    }
                }
                else
                {
                    dialogueSay.SaySomething("not_have_item");
                }
            }

            GameData.Instance.AddStep();

            DOTween.Sequence()
            .AppendCallback(() => transform.DOLocalMove(GetJumpKoefisien(true), speed / 2))
            .AppendInterval(speed / 2)
            .AppendCallback(() => transform.DOLocalMove(Vector2.zero + offsetPosition, speed / 2).SetEase(Ease.Flash))
            .AppendInterval(speed / 2)
            .AppendCallback(() => activePlatform.OnPlatformEnter(info))
            .AppendCallback(() => activePlatform.OnTriggerEnterPlatform())
            .AppendInterval(0.1f)
            .OnComplete(() => OnCompleteNormalStep());
        }
        else
        {
            if (destinationPlatform)
            {
                if (!destinationPlatform.GetNode().walkable)
                {
                    dialogueSay.SaySomething("not_walkable");
                }
                if (destinationPlatform.platformClaim)
                {
                    dialogueSay.SaySomething("platform_claim");
                }
            }
            else
            {
                dialogueSay.SaySomething("not_found");
            }
        }
    }