public void spawnParticles(verletter.JellyColor color, Rigidbody centerBody) { ParticleSystem ps = getParticleSystemByColor(color); ps.transform.position = centerBody.position; ps.GetComponent <Rigidbody>().velocity = centerBody.velocity; ps.Emit(100); ps.transform.position = Vector3.zero; }
public ParticleSystem getParticleSystemByColor(verletter.JellyColor color) { switch (color) { case verletter.JellyColor.RED: return(thoughtExplodeRed); case verletter.JellyColor.GREEN: return(thoughtExplodeGreen); case verletter.JellyColor.BLUE: return(thoughtExplodeBlue); default: return(thoughtExplodeGray); } }
public static Material getMatFromJellyColor(verletter.JellyColor c, bool highlight) { switch (c) { case verletter.JellyColor.RED: return(highlight ? Game.instance.data.brightRedTargetMat : Game.instance.data.redTargetMat); case verletter.JellyColor.GREEN: return(highlight ? Game.instance.data.brightGreenTargetMat : Game.instance.data.greenTargetMat); case verletter.JellyColor.BLUE: return(highlight ? Game.instance.data.brightBlueTargetMat : Game.instance.data.blueTargetMat); default: throw new System.Exception("expected valid target jellycolor, but had " + c.ToString()); } }
public void instantiateThought(GameObject thoughtPrefab, verletter.JellyColor color) { Vector3 velocity = new Vector3(12, 11); GameObject thought = Instantiate(thoughtPrefab, thoughtsContainer); verletter jelly = thought.GetComponent <verletter>(); if (jelly == null) { Destroy(thought); throw new System.Exception("failed to instanciate thought because prefab didn't have a verletter component, prefab: " + thoughtPrefab.ToString()); } jelly.color = color; Vector3 offset = firemanBrain.position - jelly.centerPoint.position; offset.z = 0; foreach (Rigidbody rb in jelly.GetComponentsInChildren <Rigidbody>()) { rb.position += offset; rb.velocity = velocity; } }