void NextPulser() { if (unusedPulsers.Count == 0) { currentPulser = null; return; } currentPulser = unusedPulsers.Pop(); currentPulser.transform.localPosition = new Vector3(pulserUnplacedX, offsetY - rowHeight, 0); }
public void SetPlayer(Color newColor, int newPulserCount, bool newComputerPlayer) { color = newColor; pulserCount = newPulserCount; computerPlayer = newComputerPlayer; sourceMaterial.SetColor("_EmissionColor", color); // Remove and add pulsers. while (unusedPulsers.Count > 0) { PoweredComponent pulser = unusedPulsers.Pop(); Destroy(pulser.gameObject); } for (int i = 0; i < pulserCount; i++) { GameObject pulser = (GameObject)Instantiate(prefabs["Pulser"], transform.position, Quaternion.identity); pulser.transform.parent = transform; pulser.transform.localRotation = Quaternion.Euler(0, 0, -90); pulser.transform.localPosition += new Vector3(pulserStackX, offsetY + (rowHeight * (i - 1)), 0); unusedPulsers.Push(pulser.GetComponent<PoweredComponent>()); } currentPulser = null; }