Commit 176f43f3 authored by Ata Dogan's avatar Ata Dogan

Google Cloud Platform Connection

Reads Activities from database
parent 2d892691
......@@ -118,8 +118,18 @@ namespace GoogleARCore.Examples.Common
m_MeshRenderer.material.SetColor("_GridColor", k_PlaneColors[s_PlaneCount++ % k_PlaneColors.Length]);
m_MeshRenderer.material.SetFloat("_UvRotation", Random.Range(0.0f, 360.0f));
activitySpawnCount = s_PlaneCount;
if (activitySpawnCount >= activities.Length)
string activity = ActivityFinder.instance.GetActivity();
if(activity == "basketball")
{
activitySpawnCount = 2;
}else if(activity == "gardening")
{
activitySpawnCount = 1;
}else if(activity == "painting")
{
activitySpawnCount = 0;
}
......@@ -129,9 +139,9 @@ namespace GoogleARCore.Examples.Common
Update();
spawnedPrefab.transform.position = m_PlaneCenter;
Vector3 v3T = spawnedPrefab.transform.position + Camera.main.transform.rotation * Vector3.forward;
v3T.y = spawnedPrefab.transform.position.y;
spawnedPrefab.transform.LookAt(v3T, Vector3.up);
Vector3 v3T = spawnedPrefab.transform.position + Camera.main.transform.rotation * Vector3.forward;
v3T.y = spawnedPrefab.transform.position.y;
spawnedPrefab.transform.LookAt(v3T, Vector3.up);
}
......
......@@ -157,6 +157,50 @@ PrefabInstance:
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: c10877f7cd5764de18d46d7b777d1faa, type: 3}
--- !u!1 &288348367
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 288348369}
- component: {fileID: 288348368}
m_Layer: 0
m_Name: GameObject
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &288348368
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 288348367}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 800006fe9bd4c024da904cb6cb0fc8d2, type: 3}
m_Name:
m_EditorClassIdentifier:
current: 0
--- !u!4 &288348369
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 288348367}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -4.2008057, y: 0.25784302, z: -0.13842773}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 8
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &557169198
GameObject:
m_ObjectHideFlags: 0
......@@ -582,7 +626,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!23 &1759795986
MeshRenderer:
m_ObjectHideFlags: 0
......
......@@ -9,16 +9,19 @@ using Assets.Scripts;
using UnityEngine;
public class ActivityFinder : MonoBehaviour
{
public static ActivityFinder instance;
private string connectionString = "Server=35.196.37.245;Database=social_engagement;User=root;Password=password;";
List<Activity> activities;
public List<Activity> activities;
private string mapsApiKey = "AIzaSyDbH-6aQPs64y7LwOgXRtSplUCeViz850c";
int current = 0;
public int current = 0;
// Start is called before the first frame update
void Start()
{
instance = this;
activities = GetNearbyActivities();
//getDistance(activities[0].activityLocation, activities[1].activityLocation);
}
......@@ -29,8 +32,10 @@ public class ActivityFinder : MonoBehaviour
}
string GetActivity ()
public string GetActivity ()
{
if (current < activities.Count)
{
return activities[current++].activityName;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment