Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class zaznaczanie : MonoBehaviour {
- public void unselectAll() {
- foreach (GameObject player in mercenaries) {
- Player.GetComponent<playercontroller> ().unselect Player ();
- }
- }
- private GameController gc;
- void Start () {
- gc = GameObject.Find ("GameController").GetComponent<gamecontroller>();
- }
- void Update () {
- if (Input.GetMouseButtonDown(0)){
- Ray ray = gameObject.GetComponent<camera>().ScreenPointToRay(Input.mousePosition);
- RaycastHit hit;
- if (Physics.Raycast(ray, out hit)) {
- if (hit.transform.gameObject.tag == "Player") {
- Transform selected = hit.transform;
- gc.unselectAll ();
- selected.SendMessage ("selectPlayer");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement