示例#1
0
    public override void OnStartClient()
    {
        NetworkManagerWakaMole networkManager = GameObject.Find("NetworkManager_WakaMole").GetComponent <NetworkManagerWakaMole>();

        if (networkManager != null)
        {
            networkManager.GamePlayers.Add(this.gameObject);
        }
    }
示例#2
0
        /// <summary>
        /// The Unity Update() method.
        /// </summary>
        public void Update()
        {
            _UpdateApplicationLifecycle();

            if (placeMap)
            {
                ShowMapPlaceholder();
            }

            // If the player has not touched the screen, we are done with this update.
            Touch touch;

            if (Input.touchCount < 1 || (touch = Input.GetTouch(0)).phase != TouchPhase.Began)
            {
                return;
            }

            // Should not handle input if the player is pointing on UI.
            if (EventSystem.current.IsPointerOverGameObject(touch.fingerId))
            {
                return;
            }

            Debug.Log("TAPPPPPPPPP");

            if (placeMap && mapInstance != null)
            {
                placeMap = false;
                // Hide AR planes
                GameObject.Find("Plane Generator").SetActive(false);

                // Hide panel and show StartButton if user is HOST
                PlaceMapPanel.SetActive(false);
                NetworkManagerWakaMole networkManager = NetworkManagerWakaMole.singleton as NetworkManagerWakaMole;
                foreach (GameObject gamePlayer in networkManager.GamePlayers)
                {
                    PlayerScript player = gamePlayer.GetComponent <PlayerScript>();
                    if (player.isLocalPlayer && player.isHost)
                    {
                        StartGameButton.SetActive(true);
                    }
                }

                return;
            }

            // Raycast against the location the player touched to search for objects
            RaycastHit hit = new RaycastHit();
            Ray        ray = FirstPersonCamera.ScreenPointToRay(touch.position);

            if (Physics.Raycast(ray, out hit))
            {
                hit.transform.gameObject.SendMessage("OnTouchDetected");
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        networkManager = GameObject.Find("NetworkManager_WakaMole").GetComponent <NetworkManagerWakaMole>();

        if (networkManager == null)
        {
            return;
        }

        foreach (GameObject player in networkManager.GamePlayers)
        {
            Transform startPos = networkManager.GetStartPosition();

            if (startPos != null)
            {
                player.transform.position = startPos.position;
                player.transform.rotation = startPos.rotation;

                player.transform.parent = startPos; // make sure it's inside of the parent
            }
        }
    }
示例#4
0
 public void Start()
 {
     networkManager = NetworkManagerWakaMole.singleton as NetworkManagerWakaMole;
 }