Esempio n. 1
0
    private void SuperHit()
    {
        Debug.Log("doing super hit");
        playerStatsLogic.powerUpModeActive = PowerUpType.SUPERHIT;
        touch.SetDisableMovment();
        movmentLogic.ResetRotation();
        animationLogic.SetDashing();
        LeanTween.cancel(character.gameObject, true);
        // var playerPosition = character.transform;
        var enemies = GameObject.FindGameObjectsWithTag("Enemy");

        LeanTween.pauseAll();
        Time.timeScale            = 0f;
        originalStr               = playerStatsLogic.Strength;
        playerStatsLogic.Strength = 100;

        Stack <GameObject> enemiesObject = new Stack <GameObject>();

        foreach (var enemy in enemies)
        {
            if (insideScreen(enemy.transform))
            {
                enemiesObject.Push(enemy);
                var enemyCollider = enemy.GetComponent <Collider2D>();
                enemyCollider.enabled = false;
            }
        }
        punchEnemies(enemiesObject);
        if (enemiesObject.Count == 0)
        {
            finishedSuperHit();
        }
    }
Esempio n. 2
0
    public void MoveCharacter(MoveCharacterModel model)
    {
        //player out of dashes
        if (playerStatsLogic.dashNum <= 0)
        {
            return;
        }
        playerStatsLogic.dashNum--;
        soundLogic.playJumpSound();
        ResetRotation();
        animationLogic.SetDashing();

        Vector2 target     = new Vector2(model.touchPoint.x, model.touchPoint.y);
        Vector2 vecBetween = target - model.player.position;
        var     distToGo   = vecBetween.magnitude;

        if (distToGo > dashDist)
        {
            distToGo = dashDist;
            target   = model.player.position + model.Direction * distToGo;
        }
        RotateToDash(vecBetween);
        animationLogic.OnMoveSetDirection(new moveAnimationModel {
            direction = vecBetween.normalized
        });


        LeanTween.cancel(character.gameObject, true);
        LeanTween.move(model.player.gameObject, (Vector2)target, CalculateTimeForDistance(distToGo)).setEase(LeanTweenType.easeInOutQuad).setOnComplete(
            () =>
        {
            FinishedMoving(playerStatsLogic.combo);
        });
    }