// Update is called once per frame void Update() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); Vector3 forward = transform.TransformDirection(Vector3.forward) * 10; Debug.DrawRay(transform.position, forward, Color.green); //Anim.Idle (); if (Physics.Raycast(ray, out ray_hit)) { if (ray_hit.collider.tag == "Enemy") { Fire_Enemy(); Debug.Log("Hitting Enemy"); } Colour = player_script.Get_Colour(); if (Input.GetButtonDown("Fire1") && Colour == "Green") { Heal(); } if (Input.GetButtonDown("Fire1") && player_script.gethasColour() == true && ray_hit.collider.tag != "Enemy") { Fire(); } } }
void Red_Light(string c) { if (Input.GetButtonDown("Take")) { Colour = c; player_script.Store_Colour(Colour); // Broken code at the moment need to fix!! // if the player tries to take a colour while already having a colour this should resest colour etc but does not // ColourBar.fillAmount = 1; // F_Script.shot = 0; //ColourBar.fillAmount = 1; // Fire.shot = 0; ColourBar.color = Color.red; player_script.sethasColour(true); if (player_script.gethasColour() == true && Input.GetButtonDown("Take")) { ColourBar.fillAmount = 1; Fire_Script.shot = 0; //Debug.Log (Fire_Script.shot); } } }