public void Spawn(Strain strain) { if (spawnCoolDown < 0 && hub.GetBytes() >= (int)strain) { hub.SpendBytes((int)strain); GameObject virus = (GameObject)Instantiate(Resources.Load("Virus" + strain.ToString())); virus.transform.position = gameObject.transform.position; spawnCoolDown = spawnRate; } }
// Update is called once per frame void Update() { if (hub != null) { switch (field) { case Field.Bytes: text.text = FormatSize(hub.GetBytes()); break; case Field.BitRate: text.text = FormatRate(hub.GetBitRate()); break; } } else { text.text = "0 B"; } }