Example #1
0
    public static GameObject GetLocalPlayer()
    {
        GameObject tofind;

        if (Camera.main.transform.position.x > 0 && Camera.main.transform.position.z > 0)
        {
            tofind = Unit_ID.FindPlayer(2);
        }
        else if (Camera.main.transform.position.x < 0 && Camera.main.transform.position.z > 0)
        {
            tofind = Unit_ID.FindPlayer(3);
        }
        else if (Camera.main.transform.position.x > 0 && Camera.main.transform.position.z < 0)
        {
            tofind = Unit_ID.FindPlayer(1);
        }
        else //if (Camera.main.transform.position.x < 0 && Camera.main.transform.position.y < 0)
        {
            tofind = Unit_ID.FindPlayer(4);
        }

        return(tofind);

        /*
         * if (localPlayer)
         * {
         *  return localPlayer;
         * }
         *
         * foreach (GameObject player in GameSharedData.GetAllPlayers)
         * {
         *  if (player.GetComponent<PlayerNetwork>().connectionId == LANLobbyNetworkManager.singleton.client.connection.connectionId)
         *  {
         *      localPlayer = player;
         *  }
         * }
         *
         * return localPlayer;*/
    }
Example #2
0
 public void CmdSpawnUnit(MinionType _typeToSpawn)
 {
     Unit_ID.FindPlayer(_unit_ID.GetPlayerIndex()).GetComponent <SpawnerController>().spawnedCharacter = _typeToSpawn;
 }