示例#1
0
    public void playerCollideWithEnemy(CollisionModel model)
    {
        if (playerStatsLogic.powerUpModeActive == PowerUpType.SUPERHIT)
        {
            playerStatsLogic.resetDash();
            playerStatsLogic.addOneToCombo();
            return;
        }
        movmentLogic.ResetRotation();
        LeanTween.cancel(model.mainCollider.gameObject, true);
        //to remove secondary collisions
        if (model.CollidedWith != null)
        {
            Physics2D.IgnoreCollision(model.CollidedWith.GetComponent <Collider2D> (), model.mainCollider.GetComponent <Collider2D> ());
        }
        var enemyPosition  = model.CollidedWith.transform.position;
        var playerPosition = model.mainCollider.transform.position;
        var VectorForce    = (Vector2)((playerPosition - enemyPosition).normalized);

        soundLogic.playSliceSound();

        //if player hit some1 than he get back is dashes
        playerStatsLogic.resetDash();
        playerStatsLogic.addOneToCombo();

        //building path
        var sign = VectorForce.x > 0 ? 1 : -1;

        Vector3[] path = new Vector3[] {
            new Vector3(playerPosition.x + (-2.697063f * sign), playerPosition.y),
            new Vector3(playerPosition.x + (-1.397063f * sign), playerPosition.y + 5.108706f),
            new Vector3(playerPosition.x + (0.397063f * sign), playerPosition.y + 6.408706f),
            new Vector3(playerPosition.x + (1f * sign), playerPosition.y + 7.749998f),
        };


        LeanTween.move(model.mainCollider.gameObject, path, impactTimeOnPlayer).setOnComplete(() =>
        {
            stopAfterBounce(new StopAfterCollisionModel {
                collidedWith = model.CollidedWith.gameObject, subject = model.mainCollider.GetComponent <Rigidbody2D> ()
            });
        });
        rollOver(model.mainCollider);
        animationLogic.UnSetDashing();
        animationLogic.SetSlicing();
    }
示例#2
0
 public void DeathByFall()
 {
     if (playerStatsLogic.removeHp(1))
     {
         DeathScreen();
     }
     movmentLogic.MoveOnFallDeath();
     playerStatsLogic.resetDash();
 }