Commit a26c19a6 authored by Mitchie Maluschnig's avatar Mitchie Maluschnig
Browse files

added a particle system which shows good/bad/perfect above players head

parent b079a9ae
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: accuracyText
m_Shader: {fileID: 200, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 8400000, guid: 4df7453a606e21c45bb096daefee1799, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _InvFade: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}
fileFormatVersion: 2
guid: af955d72651e7af40ad186401bb724e1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: bf8747e4259d9bd46acdd2b6e3588586
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:
......@@ -8,9 +8,11 @@ public class Key : MonoBehaviour {
public int points = 10;
public GameObject explosion;
TriggerManager triggerManager;
// Use this for initialization
void Start () {
triggerManager = GameObject.FindWithTag("TriggerManager").GetComponent<TriggerManager>();
}
// Update is called once per frame
......@@ -19,8 +21,8 @@ public class Key : MonoBehaviour {
if(!isVisible()){
MimeMime.MissHit(GetComponent<Key>());
Instantiate(explosion, transform.position, transform.rotation);
Destroy(gameObject);
triggerManager.performBadHit(this.gameObject);
}
}
bool isVisible(){
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class TriggerManager : MonoBehaviour
{
//player accuracy triggers
public Collider2D perfectCollider;
public Collider2D goodCollider;
public Collider2D badCollider;
......@@ -11,14 +13,20 @@ public class TriggerManager : MonoBehaviour
private Transform player;
private Transform mime;
//explosion prefabs
public GameObject perfectHit;
public GameObject goodHit;
public GameObject badHit;
//accuracy Text stuff
public GameObject textParticles;
public Text particleText;
public Transform accuracySpawn;
//the distance between the centre of each trigger area.
public float sepparation = 1f;
public ContactFilter2D filter = new ContactFilter2D();
private ContactFilter2D filter = new ContactFilter2D();
enum keys { left = 0, right = 3, up = 1, down = 2 }
......@@ -152,29 +160,25 @@ public class TriggerManager : MonoBehaviour
} else if (perfectCollider.OverlapPoint(currentKey.transform.position))
{
MimeMime.PerfectHit(currentKey.GetComponent<Key>());
print("PERFECT");
Instantiate(perfectHit, currentKey.transform.position, currentKey.transform.rotation);
Destroy(currentKey);
performPerfectHit(currentKey);
}
else if (goodCollider.OverlapPoint(currentKey.transform.position))
{
MimeMime.GoodHit(currentKey.GetComponent<Key>());
print("GOOD");
Instantiate(goodHit, currentKey.transform.position, currentKey.transform.rotation);
Destroy(currentKey);
performGoodHit(currentKey);
}
else if (badCollider.OverlapPoint(currentKey.transform.position))
{
MimeMime.BadHit(currentKey.GetComponent<Key>());
print("Bad");
Instantiate(badHit, currentKey.transform.position, currentKey.transform.rotation);
Destroy(currentKey);
performBadHit(currentKey);
}
else
{
print("That was so horrible im just gonna pretend it didnt happen");
Instantiate(badHit, (Vector2)badCollider.transform.position + badCollider.offset, Quaternion.identity);
//create accuracy text on player
GameObject newParticle = Instantiate(textParticles, accuracySpawn);
var main = newParticle.GetComponent<ParticleSystem>().main;
main.startColor = Color.red;
particleText.text = "Miss";
}
}
......@@ -211,5 +215,40 @@ public class TriggerManager : MonoBehaviour
return results[lowestIndex].gameObject;
}
}
public void performPerfectHit(GameObject currentKey) {
MimeMime.PerfectHit(currentKey.GetComponent<Key>());
print("PERFECT");
//create explosion
Instantiate(perfectHit, currentKey.transform.position, currentKey.transform.rotation);
//create accuracy text on player
GameObject newParticle = Instantiate(textParticles, accuracySpawn);
var main = newParticle.GetComponent<ParticleSystem>().main;
main.startColor = Color.green;
Destroy(currentKey);
particleText.text = "Perfect";
}
public void performGoodHit(GameObject currentKey) {
MimeMime.GoodHit(currentKey.GetComponent<Key>());
print("GOOD");
Instantiate(goodHit, currentKey.transform.position, currentKey.transform.rotation);
//create accuracy text on player
GameObject newParticle = Instantiate(textParticles, accuracySpawn);
var main = newParticle.GetComponent<ParticleSystem>().main;
main.startColor = Color.magenta;
Destroy(currentKey);
particleText.text = "Good";
}
public void performBadHit(GameObject currentKey) {
MimeMime.BadHit(currentKey.GetComponent<Key>());
print("Bad");
Instantiate(badHit, currentKey.transform.position, currentKey.transform.rotation);
//create accuracy text on player
GameObject newParticle = Instantiate(textParticles, accuracySpawn);
var main = newParticle.GetComponent<ParticleSystem>().main;
main.startColor = Color.red;
Destroy(currentKey);
particleText.text = "Bad";
}
}
\ No newline at end of file
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: TextRenderer
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_Width: 256
m_Height: 256
m_AntiAliasing: 1
m_DepthFormat: 2
m_ColorFormat: 0
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
fileFormatVersion: 2
guid: 4df7453a606e21c45bb096daefee1799
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment