// Use this for initialization void Start() { infected = false; myRenderer = GetComponent <Renderer>(); colourBlend = 0.0f; parentScript = GetComponentInParent <CellScript>(); type = parentScript.infectedType; cellGenes = parentScript.GetChromosome(); }
void SpawnNucleus(CellScript inputCell) { GameObject newNucleus = (GameObject)Instantiate(nucleus, inputCell.transform.position, inputCell.transform.rotation); NucleusScript script = newNucleus.GetComponent <NucleusScript>(); script.SetChromosome(inputCell.GetChromosome()); script.SetVelocity(inputCell.velocity); script.attachedToCell = false; }
// Use this for initialization void Start() { infected = false; myRenderer = GetComponent<Renderer>(); colourBlend = 0.0f; parentScript = GetComponentInParent<CellScript>(); type = parentScript.infectedType; cellGenes = parentScript.GetChromosome(); }
void OnTriggerEnter(Collider other) { if (born) { return; } if (other.tag == "Enemy" && other.gameObject.layer == 9) { //absorb the enemy CellScript cell = other.gameObject.GetComponent <CellScript>(); targetScale += 0.04f; //these values will need balancing health += cell.GetChromosome()[0] * 3.0f; damage += cell.GetChromosome()[1] / 100.0f; atkSpeed += cell.GetChromosome()[2] / 100.0f; speed += cell.GetChromosome()[3] / 100.0f; Destroy(other.gameObject); } }
// Update is called once per frame void Update() { if (infected) { if (colourBlend < colorBrightness) { colourBlend += Time.deltaTime; } cellGenes = parentScript.GetChromosome(); if (blending) { BlendColours(); } else { DiscreteColours(); } } }
void SpawnNucleus(CellScript inputCell) { GameObject newNucleus = (GameObject)Instantiate(nucleus, inputCell.transform.position, inputCell.transform.rotation); NucleusScript script = newNucleus.GetComponent<NucleusScript>(); script.SetChromosome(inputCell.GetChromosome()); script.SetVelocity(inputCell.velocity); script.attachedToCell = false; }