- Home /
Score added on collision with another player
Hi guys, so I've got this very simple game going, and I guess for me to be able to ask the question I gotta give a bit of context. The game works by having a player made up of two parts, a front and a back (pictured)
And attached to that back square, is the following code, which means that if something collides with it, the player is destroyed
using UnityEngine;
using System.Collections;
public class Collide : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public Transform player;
void OnTriggerEnter(Collider other) {
Destroy(player.gameObject);
}
}
Now, heres the issue, that I cant for the life of me come up with a solution for. The game is Multiplayer, and all the players have this. I want to make it so when the front square hits the back square of another player (destroying the other player), the player that hit the player gets a point. Even better if you can tell me how to display this.
Thanks a lot guys, hopefully there will be an easy answer to this, but I just dont know what to do.