Exemple #1
0
    private void GrappleOnPlanet(bool force = false)
    {
        isInOrbit = true;
        distance  = Vector3.Distance(transform.position, grappledPlanet.transform.position);
        clockwise = !force?GetAngle(grappledPlanet.transform) < 0 : false;

        lastDistance = float.MaxValue;
        background.ChangeOwner(grappledPlanet, this, !force);
        grappledPlanet.Grapple(this);
        trailMaterialControler.SetDirection(clockwise ? 1 : -1);

        if (GetInputDevice() != null)
        {
            var d = transform.position.x - grappledPlanet.transform.position.x;
            GetInputDevice().Vibrate(this, 0.4f, Mathf.Clamp01(d), Mathf.Clamp01(-d));
        }
    }