Added screen shake upon successful hits of non-ability moves and fixed some animation bugs/warnings

This commit is contained in:
Gregory Campbell
2020-06-29 21:37:59 -04:00
parent a83d8d9ee4
commit d0122c2a14
23 changed files with 2030 additions and 21 deletions
+5 -8
View File
@@ -71,6 +71,8 @@ public class GMScript : MonoBehaviour
private int[] EnemyPartsColours;
private int[] EnemyKillSequence;
private ShakeScript shake;
enum Colours {
Red, Brown, Orange,
Amber, Yellow, Lime,
@@ -89,6 +91,7 @@ public class GMScript : MonoBehaviour
enemyHealth = 16;
partyHealth = 8;
level = PlayerPrefs.GetInt("Level");
shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent<ShakeScript>();
if(PlayerPrefs.GetInt("GameMode") == 0 ||
PlayerPrefs.GetInt("GameMode") == 2)
@@ -669,13 +672,12 @@ public class GMScript : MonoBehaviour
Hit.SetActive(true);
Animator hit = Hit.transform.GetComponent<Animator>();
hit.SetTrigger("HitTrigger");
shake.camShake();
yield return new WaitForSeconds(
hit.GetCurrentAnimatorStateInfo(0).length * 2
+hit.GetCurrentAnimatorStateInfo(0).normalizedTime);
hit.SetTrigger("HitTrigger");
Hit.SetActive(false);
} else {
@@ -715,13 +717,11 @@ public class GMScript : MonoBehaviour
EnemyHit.SetActive(true);
Animator hit = EnemyHit.transform.GetComponent<Animator>();
hit.SetTrigger("HitTrigger");
yield return new WaitForSeconds(
hit.GetCurrentAnimatorStateInfo(0).length * 2
+hit.GetCurrentAnimatorStateInfo(0).normalizedTime);
hit.SetTrigger("HitTrigger");
EnemyHit.SetActive(false);
display.text = null;
@@ -764,13 +764,11 @@ public class GMScript : MonoBehaviour
Hit.SetActive(true);
Animator hit = Hit.transform.GetComponent<Animator>();
hit.SetTrigger("HitTrigger");
yield return new WaitForSeconds(
hit.GetCurrentAnimatorStateInfo(0).length * 2
+hit.GetCurrentAnimatorStateInfo(0).normalizedTime);
hit.SetTrigger("HitTrigger");
EnemyDamageText.text = null;
Hit.SetActive(false);
@@ -799,13 +797,12 @@ public class GMScript : MonoBehaviour
EnemyHit.SetActive(true);
Animator hit = EnemyHit.transform.GetComponent<Animator>();
hit.SetTrigger("HitTrigger");
shake.camShake();
yield return new WaitForSeconds(
hit.GetCurrentAnimatorStateInfo(0).length * 2
+hit.GetCurrentAnimatorStateInfo(0).normalizedTime);
hit.SetTrigger("HitTrigger");
EnemyHit.SetActive(false);
} else {
+32
View File
@@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ShakeScript : MonoBehaviour
{
public Animator camAnim;
public void camShake(){
int shakeSelect = Random.Range(0, 4);
switch (shakeSelect)
{
case 0:
camAnim.SetTrigger("Shake1");
break;
case 1:
camAnim.SetTrigger("Shake2");
break;
case 2:
camAnim.SetTrigger("Shake3");
break;
case 3:
camAnim.SetTrigger("Shake4");
break;
}
}
}
+11
View File
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ab014c819a1032d44be2556fb54b3a74
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: