Power Ups?
Options
Hi, I wanted to add power ups to my game and I'm having some issues. For some reason, when walking through a powerup, the powerups function gets added to ALL players instead of just the one that walked through it. Can somebody help me? Here's my code:
private void OnTriggerEnter2D(Collider2D collision)
{
if(collision.tag == "Player")
{
if(!isCollected)
{
photonView.RPC("Collect", PhotonTargets.All, collision.GetComponent<PhotonView>().ownerId);
isCollected = true;
}
}
}
[PunRPC]
public void Collect(int playerID)
{
PhotonView p = PhotonView.Find(playerID);
anim.Play("Collect");
particles.Play();
if (Function == PowerUps.ScaleUp)
{
p.RPC("ScaleUp", PhotonTargets.All);
}
}
0
Answers
This discussion has been closed.