Added camera shake anytime a bullet is instantiated

This commit is contained in:
Gregory Campbell
2020-07-11 20:46:20 -04:00
parent a1904de31e
commit f08dc0fee4
15 changed files with 1672 additions and 0 deletions
+3
View File
@@ -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()
+30
View File
@@ -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;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f9d2ce1ad97b9044b85e0dcf8bb4403a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: