public void Update() { if (Input.GetMouseButtonDown(0) && gameObject.GetComponent <Player_Controler>().getCharge() != 0.0) { gameObject.GetComponent <Player_Controler>().subtractCharge(cost); PowerUp_Controler pc = (PowerUp_Controler)gameObject.GetComponent("PowerUp_Controler"); if (pc.getMode() == 1) // fire { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.red, gameObject); LazerBeam.CreateLazerBeam(fireLocation2.position, fireLocation2.rotation, Color.red, gameObject); // TODO remove extra charge in the player_conroler } else if (pc.getMode() == 2) // water { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.blue, gameObject); } else if (pc.getMode() == 3) // earth { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.gray, gameObject); } else if (pc.getMode() == 4) // air { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.cyan, gameObject); } else if (pc.getMode() == 5) // lightning { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.yellow, gameObject); } else // default { LazerBeam.CreateLazerBeam(fireLocation.position, fireLocation.rotation, Color.green, gameObject); } } }
void Update() { if (timePassed <= 0.0f) { timePassed = 1.0f; LazerBeam.CreateLazerBeam(transform.position, transform.rotation, myColor, gameObject); } timePassed -= Time.deltaTime; }
public void FireLazer(Vector3 pos, Quaternion rot, Vector3 color, NetworkMessageInfo info) { LazerBeam.CreateLazerBeam(pos, rot, new Color(color.x, color.y, color.z, 1.0f), info.networkView.gameObject); }