public void OnButtonPressed(VirtualButtonBehaviour vb) { //Does whatever it should do when a certain button is pressed. if (vb.Equals(btRed.GetComponent <VirtualButtonBehaviour>())) { //With red, it turns the cube red, the same goes for blue, yellow and black. cube.GetComponent <Renderer>().material.SetColor("_Color", Color.red); } if (vb.Equals(btBlue.GetComponent <VirtualButtonBehaviour>())) { cube.GetComponent <Renderer>().material.SetColor("_Color", Color.blue); } if (vb.Equals(btYellow.GetComponent <VirtualButtonBehaviour>())) { cube.GetComponent <Renderer>().material.SetColor("_Color", Color.yellow); } if (vb.Equals(btBlack.GetComponent <VirtualButtonBehaviour>())) { cube.GetComponent <Renderer>().material.SetColor("_Color", Color.black); } }
public void OnButtonReleased(VirtualButtonBehaviour vb) { if (ApplicationModel.twoPlayers && touchActivated) { if (vb.Equals(redBehaviour)) { ReleaseButton(0); } else if (vb.Equals(greenBehaviour)) { ReleaseButton(1); } else if (vb.Equals(yellowBehaviour)) { ReleaseButton(2); } else if (vb.Equals(blueBehaviour)) { ReleaseButton(3); } } }
public void OnButtonPressed(VirtualButtonBehaviour vb) { if (ApplicationModel.twoPlayers && touchActivated) { if (vb.Equals(redBehaviour)) { PressButton(0); if (gameStarted) { if (ApplicationModel.traditional) { PlayerMove(0); PlaySound(0); } else { PlayerMove(6); PlaySound(6); } } } else if (vb.Equals(greenBehaviour)) { PressButton(1); if (gameStarted) { if (ApplicationModel.traditional) { PlayerMove(1); PlaySound(1); } else { PlayerMove(7); PlaySound(7); } } } else if (vb.Equals(yellowBehaviour)) { PressButton(2); if (gameStarted) { if (ApplicationModel.traditional) { PlayerMove(2); PlaySound(2); } else { PlayerMove(8); PlaySound(8); } } } else if (vb.Equals(blueBehaviour)) { PressButton(3); if (gameStarted) { if (ApplicationModel.traditional) { PlayerMove(3); PlaySound(3); } else { PlayerMove(9); PlaySound(9); } } } } }