Added camera shake anytime a bullet is instantiated
This commit is contained in:
@@ -7,11 +7,14 @@ public class BulletScript : MonoBehaviour
|
||||
|
||||
private float speed;
|
||||
private Rigidbody2D rb;
|
||||
private ShakeScript shake;
|
||||
|
||||
void Start()
|
||||
{
|
||||
rb = GetComponent<Rigidbody2D>();
|
||||
speed = Random.Range(3.0f, 8.0f);
|
||||
shake = GameObject.Find("Shake Manager").GetComponent<ShakeScript>();
|
||||
shake.CamShake();
|
||||
}
|
||||
|
||||
void FixedUpdate()
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ShakeScript : MonoBehaviour
|
||||
{
|
||||
public Animator animator;
|
||||
|
||||
public void CamShake()
|
||||
{
|
||||
|
||||
switch(Random.Range(0,4))
|
||||
{
|
||||
case 0:
|
||||
animator.SetTrigger("Shake1");
|
||||
break;
|
||||
case 1:
|
||||
animator.SetTrigger("Shake2");
|
||||
break;
|
||||
case 2:
|
||||
animator.SetTrigger("Shake3");
|
||||
break;
|
||||
case 3:
|
||||
animator.SetTrigger("Shake4");
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9d2ce1ad97b9044b85e0dcf8bb4403a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user