IEnumerator NextAggressor(float lastZ, bool doPushback = true) { yield return 0; //Skip frame CutoutType type = Cutout.CutoutTypes[Random.Range(0, Cutout.CutoutTypes.Count)]; Aggressor = Instantiate(Cutout.CutoutToGameobject[type]).GetComponent<Cutout>(); //-1 to ignore null cutout Aggressor.transform.SetParent(this.transform, true); Aggressor.velocity = SpawnNum * 0.6f + 14; if (CurrentPowerup == CutoutType._Frost) Aggressor.velocity /= 1.8f; if (CurrentPowerup == CutoutType._Reverse) Aggressor.velocity *= -1; float pushback = (Mathf.Sqrt(3 / (SpawnNum + 3)) + 0.4f) * Mathf.Abs(Aggressor.velocity); Aggressor.transform.position = new Vector3(0, 0, lastZ + (doPushback ? pushback : 0)); Aggressor.type = type; Renderer rend = Aggressor.GetComponent<Renderer>(); rend.material.SetColor(Game._V_WIRE_COLOR, Color.HSVToRGB(secondsIntoCycle / SecondsPerCycle, .64f, 1)); GamePlayControls.self.SwitchButtonSymbols(type, CurrentPowerup == CutoutType._Flash ? 0.06f : 0.2f); }
void SetVertexColours(Color color) { for (int i = 0; i < WallComponenets.Length; i++) { WallComponenets[i].LineColor = color; } if (Aggressor != null) { Renderer rend = Aggressor.GetComponent<Renderer>(); rend.material.SetColor(Game._V_WIRE_COLOR, color); } for(int i = 0; i < PulseComponenets.Length; i++) { int numParticlesAlive = PulseComponenets[i].GetParticles(R_PulseParticlesToUpdate); for (int j = 0; j < numParticlesAlive; j++) { R_PulseParticlesToUpdate[j].startColor = color; } PulseComponenets[i].SetParticles(R_PulseParticlesToUpdate, numParticlesAlive); var main = PulseComponenets[i].main; main.startColor = color; } GamePlayControls.self.UpdateButtonColors(color); }
IEnumerator InitAggressor() { yield return 0; //Skip frame CutoutType type = Cutout.CutoutTypes[Random.Range(0, Cutout.CutoutTypes.Count)]; Aggressor = Instantiate(Cutout.CutoutToGameobject[type]).GetComponent<Cutout>(); //-1 to ignore null cutout Aggressor.transform.SetParent(this.transform, true); Aggressor.transform.position = new Vector3(0, 0, 120); Aggressor.velocity = SpawnNum * 0.6f + 14; Aggressor.type = type; Renderer rend = Aggressor.GetComponent<Renderer>(); rend.material.SetColor(Game._V_WIRE_COLOR, Color.HSVToRGB(secondsIntoCycle / SecondsPerCycle, .64f, 1)); Aggressor.gameObject.SetActive(false); yield return 0; Aggressor.gameObject.SetActive(true); yield return new WaitForSeconds(1); GamePlayControls.self.SwitchButtonSymbols(type); }