Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        try
        {
            CombinedController.Facing facing = player.GetFacingDirection();
            if (prevFacing != facing)
            {
                transform.rotation *= Quaternion.AngleAxis(180, player.transform.up);
                prevFacing          = facing;
            }

            if (temporalEffect)
            {
                transform.rotation = Quaternion.SlerpUnclamped(transform.rotation, Quaternion.LookRotation(Vector3.forward, (Vector3)parentRB.velocity + player.GetFacingVector()) * Quaternion.AngleAxis(Time.time * RotationField.Instance.AngularVelocity * Mathf.Rad2Deg, Vector3.back), juiceConstant);
            }
            else
            {
                transform.rotation = Quaternion.SlerpUnclamped(transform.rotation, Quaternion.LookRotation(Vector3.forward, (Vector3)parentRB.velocity + player.GetFacingVector()), juiceConstant);
            }

            if (Input.GetAxis("Fire1") > 0 || pickup.childCount > 0)
            {
                integrationFactor += Time.deltaTime * integrationCoefficient;
            }
            else
            {
                overshooter        = overshooter * 0.95f + integrationFactor * 0.05f;
                integrationFactor -= overshooter;
            }

            transform.rotation *= Quaternion.AngleAxis(Time.time * integrationFactor, Vector3.forward);
        }
        catch { }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     try
     {
         parentRB   = GetComponentInParent <Rigidbody2D>();
         player     = GetComponentInParent <CombinedController>();
         pickup     = player.ItemHoldingTransform;
         prevFacing = player.GetFacingDirection();
     }
     catch { }
 }