Пример #1
0
 private void Start()
 {
     if (GetComponent <ShakeObject>())
     {
         sO = GetComponent <ShakeObject>();
     }
 }
 private void SetShakeObject(Component component)
 {
     if (component != null)
     {
         _shakeObject = new ShakeObject(component.GetComponent <RectTransform>());
     }
 }
Пример #3
0
    public void ShakeCamera(float amount)
    {
        ShakeObject cameraShake = GameObject.Find("CameraManager").GetComponent <ShakeObject> ();

        cameraShake.smooth       = false;
        cameraShake.smoothAmount = 5f;

        float clampedAmount = Mathf.Clamp(amount, 0.2f, 0.8f);

        cameraShake.ShakeCamera(clampedAmount, clampedAmount * 0.05f);
    }
Пример #4
0
    private void Awake()
    {
        if (this.GetComponent <ItemController>() == null)
        {
            ItemsManager = this.gameObject.AddComponent <ItemController>();
        }
        else
        {
            ItemsManager = this.gameObject.GetComponent <ItemController>();
        }

        if (this.GetComponent <ShakeObject>() == null)
        {
            ObjectShaker = this.gameObject.AddComponent <ShakeObject>();
        }
        else
        {
            ObjectShaker = this.gameObject.GetComponent <ShakeObject>();
        }
    }
Пример #5
0
 void Start()
 {
     shakeObject = GetComponent <ShakeObject> ();
 }
Пример #6
0
 private void Start()
 {
     strumScript = FindObjectOfType <Strum>();
     shaker      = GetComponentInChildren <ShakeObject>();
     thisSpeaker = GetComponent <AudioSource>();
 }