Пример #1
0
    public static ShakeCamera Shake(float magnitude, float duration)
    {
        OrbitGameObject orbitGameObject = (OrbitGameObject)UnityEngine.Object.FindObjectOfType(typeof(OrbitGameObject));
        ShakeCamera     shakeCamera     = orbitGameObject.gameObject.AddComponent <ShakeCamera>();

        shakeCamera.Magnitude = magnitude;
        shakeCamera.Duration  = duration;
        return(shakeCamera);
    }
Пример #2
0
    private void Update()
    {
        this.Duration -= Time.deltaTime;
        if (this.Duration < 0f)
        {
            UnityEngine.Object.Destroy(this);
        }
        OrbitGameObject component = base.gameObject.GetComponent <OrbitGameObject>();

        if (component)
        {
            component.ShakeVal.y = Mathf.Sin(1000f * Time.time) * this.Duration * this.Magnitude;
        }
    }