so I am making multiplayer game and I stuck on one thing, I have blood overlay canvas in my scene(you know, in fps games if somebody shoots you your screen becomes red and this stuff), and when I shoot enemy, his screen becomes red, but mine also.
thats what i ahve now: if raycast hits enemy, player script calls: ColorController.MakeItred();
color controller is attached to this canvas image, here is its code:
`
void Start () {
if (current == 100 || current == 0)
{
opacity = 0;
}
}
// Update is called once per frame
void Update () {
image = GetComponent<Image>();
image.color = new Color32(reds, greens, blues, opacity);
if (current == 0)
{
opacity = 0;
}
if (!playing)
{
if (opacity > 0)
{
StartCoroutine(toLower());
}
}
if (opacity == 255)
{
playaudio();
}
}
public static void MakeItred()
{
opacity = 255;
}
public static void MakeItOff()
{
opacity = 0;
}
void playaudio()
{
AudioSource audio = GetComponent<AudioSource>();
audio.Play();
}
private IEnumerator toLower()
{
playing = true;
opacity -= 1;
yield return new WaitForSeconds(interval);
playing = false;
}`
btw thats function in player code that calls colorcontroller.makeitred,
[ClientRpc]
public void Rpcdoit()
{
ColorController.MakeItred();
}
-Nick thanks.