// Use this for initialization void Start() { rend = gameObject.GetComponent<Renderer>(); //mat = new Material(Shader.Find("Standard")); //rend = new Renderer(); //rend.material = mat; gMO = GameObject.Find("GameManager"); gM = gMO.GetComponent<GameManager>(); tetrahedron = gameObject.GetComponent<Tetrahedron>(); octahedron = gameObject.GetComponent<Octahedron>(); dodecahedron = gameObject.GetComponent<Dodecahedron>(); icosahedron = gameObject.GetComponent<Icosahedron>(); counter = (int)Random.Range(1f, 5f); if(counter == 5) counter = 4; if(counter == 1) tetrahedron.MakeMesh(); if(counter == 2) octahedron.MakeMesh(); if(counter == 3) dodecahedron.MakeMesh(); if(counter == 4) icosahedron.MakeMesh(); gM.ZombiePlus(); }
public void ChangeShape(int shapeNumber, Color shapeColor) { switch (shapeNumber) { case 0: //print("0"); tetrahedron.MakeMesh(); transform.localScale = new Vector3(1.63965f, 1.63965f, 1.63965f); transform.localPosition = new Vector3(0f, 0.137f, 0.071f); rend.material.color = shapeColor; break; case 1: //print("1"); octahedron.MakeMesh(); transform.localScale = new Vector3(2.165706f, 2.165706f, 2.165706f); rend.material.color = shapeColor; break; case 2: //print("2"); dodecahedron.MakeMesh(); transform.localScale = new Vector3(1.04493f, 1.04493f, 1.04493f); rend.material.color = shapeColor; break; case 3: //print("3"); icosahedron.MakeMesh(); transform.localScale = new Vector3(1, 1, 1); rend.material.color = shapeColor; break; } }
// Update is called once per frame void Update() { if (counter == 0) { gM.ZombieMinus(); if (wasLeftFist) { gM.IncreaseSpeedLeft(); } else { gM.IncreaseSpeedRight(); } Destroy(gameObject); } else if (counter == 1) { tetrahedron.MakeMesh(); transform.localScale = new Vector3(2f, 2f, 2f); rend.material.color = tetrahedronColor; } else if (counter == 2) { octahedron.MakeMesh(); transform.localScale = new Vector3(2f, 2f, 2f); rend.material.color = octahedronColor; } else if (counter == 3) { dodecahedron.MakeMesh(); rend.material.color = dodecahedronColor; } else if (counter == 4) { icosahedron.MakeMesh(); rend.material.color = icosahedronColor; } else { //print("the counter of chooseShape is to big! "); } //print(counter); runCollisoinOnce = true; }
// Use this for initialization void Start() { rend = gameObject.GetComponent <Renderer>(); //mat = new Material(Shader.Find("Standard")); //rend = new Renderer(); //rend.material = mat; gMO = GameObject.Find("GameManager"); gM = gMO.GetComponent <GameManager>(); tetrahedron = gameObject.GetComponent <Tetrahedron>(); octahedron = gameObject.GetComponent <Octahedron>(); dodecahedron = gameObject.GetComponent <Dodecahedron>(); icosahedron = gameObject.GetComponent <Icosahedron>(); counter = (int)Random.Range(1f, 5f); if (counter == 5) { counter = 4; } if (counter == 1) { tetrahedron.MakeMesh(); } if (counter == 2) { octahedron.MakeMesh(); } if (counter == 3) { dodecahedron.MakeMesh(); } if (counter == 4) { icosahedron.MakeMesh(); } gM.ZombiePlus(); }