• Tidak ada hasil yang ditemukan

BAB V PENUTUP

5.2 Saran

Berdasarkan penelitian ini, saran untuk penelitian selanjutnya adalah pengembangan aplikasi ARTanam yang lebih sempurna. Pengembangan dapat dilakukan pada beberapa bagian sebagai berikut:

1. Penambahan jumlah tanaman untuk diperkenalkan lebih banyak lagi.

2. Pengembangan pada bagian desain aplikasi ARTanam ini agar lebih menyerupai objek aslinya.

DAFTAR PUSTAKA

[1] I. D. Gede, W. Dhiyatmika, I. K. Gede, D. Putra, N. Made, and I. Marini, “Aplikasi Augmented Reality Magic Book Pengenalan Binatang untuk Siswa TK,” vol. 6, no. 2, pp. 120–127, 2015.

[2] J. Irfansyah, “Media Pembelajaran Pengenalan Hewan Untuk Siswa Sekolah Dasar Menggunakan Augmented Reality Berbasis Android,” vol. 01, pp. 9–17, 2013.

[3] U. Of et al., “Pemanfaatan Augmented Reality Sebagai Media

Pembelajaran Pengenalan Buah-Buahan,” vol. 3, no. 1, pp. 54–68, 2019.

[4] A. F. Silvia, E. Haritman, and Y. Muladi, “Rancang Bangun Akses Kontrol Pintu Gerbang Berbasis Arduino Dan Android,” Electrans, vol. 13, no. 1, pp. 1–10, 2014.

[5] A. Aldi, “Aplikasi Pengenalan Hewan dengan Teknologi Marker Less Augmented Reality Berbasis Android,” DOUBLECLICK J. Comput. Inf.

Technol., vol. 1, no. 1, p. 1, 2017.

[6] A. Yulianto, “Implementasi Teknologi Markerless Augmented Reality Berbasis Android sebagai Media Pengenalan Gedung-Gedung di FMIPA Universitas Lampung,” pp. 95–102, 2015.

[7] I. Al Fikri, “Aplikasi Navigasi Berbasis Perangkat Bergerak dengan Menggunakan Platform Wikitude untuk Studi Kasus Lingkungan ITS,” J.

Tek. ITS, vol. 5, no. 1, pp. 48–51, 2016.

[8] V. Sundareswaran et al., “3D audio augmented reality: Implementation and experiments,” Proc. - 2nd IEEE ACM Int. Symp. Mix. Augment. Reality,

ISMAR 2003, pp. 296–297, 2003.

[9] K. Teguh Martono, “Augmented Reality sebagai Metafora Baru dalam Teknologi Interaksi Manusia dan Komputer,” J. Sist. Komput., vol. 1, no. 2, pp. 60–64, 2011.

Kimia Berbasis Android Menggunakan Metode Fast Corner Detection,” 2016.

[11] M. E. Apriyani, M. Huda, and S. Prasetyaningsih, “Analisis Penggunaan Marker Tracking Pada Augmented Reality Huruf Hijaiyah,” J. INFOTEL -

Inform. Telekomun. Elektron., vol. 8, no. 1, p. 71, 2016.

[12] S. D. Siswanti and T. D. Handoko, “Deteksi Keypoint Pada Markerless Augmented Reality Untuk Design Furniture Room,” J. Komput. Terap., vol. 2, no. 2, pp. 179–194, 2016.

[13] M. Fauzi and J. Adler, “Pemanfaatan Augmented Reality Untuk Buku Pembelajaran Pengenalan Hewan Pada Anak Usia Dini Berbasis Android,” pp. 1–7, 2016.

[14] T. F. Hernowo, E. Sulviana, and H. I. Teddy, “Rancang Bangun Edugame Pembelajaran Kesehatan Gigi Untuk Anak-Anak Berbasis Unity 3D,” vol. 1, no. x, pp. 1–14, 2012.

[15] H. M. Hermawan Latius, “Pemanfaatan Augmented Reality Sebagai Media Informasi Kampus Menggunakan Brosur,” Sentika, vol. 2015, no. Sentika, pp. 81–88, 2015.

[16] G. Kusnanto, E. Sadewa, and T. H. Prasetyo, “3D Virtual Tour Kebun Binatang Surabaya Berbasis Android,” Tek. Inform. Univ. 17 Agustus 1945

Surabaya, 2014.

[17] "Android Studio Overview." [Online]. Available:

http://developer.android.com/tools/studio/index.html/. [Diakses 14

Desember 2015].

[18] DiMarzio. Android a Programmer’s Guide. United States of America:The McGraw-Hill, 2017.

[19] Roedavan, Rickman. Unity Tutorial Game Engine. Informatika. Bandung, 2014.

[21] http://developer.vuforia.com/library/articles/training [diakses pada 23-08-2019].

[22] Widodo, Prabowo Pudjo. Herlawati. 2011. Menggunakan UML. UML Secara

Luas Digunakan untuk Memodelkan Analisis & Desain Sistem Berorientasi Objek. Bandung: Informatika Bandung.

[23] Hermawan, J, 2004. “Analisa Desain dan Pemrograman Obyek dengan UML dan Visual Basic.Net.” Yogyakarta: Andi.

[24] Robert C. Martin, 2008. “Clean Code: A Handbook of Agile Software Craftsmanship”. Prentice Hall, 1st Edition

[25] Rosa, A.S. dan Shalahuddin, M., (2016). Rekayasa Perangkat Lunak Terstruktur dan Berorientasi Objek. Bandung: Penerbit Informatika.

[26] Pressman, Roger S. 2002. Rekayasa Perangkat Lunak Pendekatan Praktisi. Yogyakarta: Andi.

[27] Arsyad, Azhar. 2011. Media Pembelajaran.cetakan ke-15. Rajawalli Pers: Jakarta

[28] Martono, Kurniawan Teguh. Augmented Reality sebagai Metafora Baru dalam

Teknologi Interaksi Manusia dan Komputer. Jurnal sistem komputer, Vol. I,

LAMPIRAN

AudioManager

using UnityEngine.Audio; using System;

using UnityEngine;

public class audioManager : MonoBehaviour { public Sound[] sounds;

public void Awake() {

DontDestroyOnLoad(gameObject); foreach (Sound s in sounds)

{ s.source = gameObject.AddComponent<AudioSource>(); s.source.clip = s.clip; s.source.pitch = s.pitch; s.source.volume = s.volume; s.source.loop = s.loop; } }

public void Play(string name) {

Sound s = Array.Find(sounds, sound => sound.name == name); if (s == null)

{

Debug.LogWarning(" Sound = " + name + " Not Found !"); return;

}

s.source.Play(); }

public void Pause(string name) {

Sound s = Array.Find(sounds, sound => sound.name == name); s.source.Pause();

}

{

Sound s = Array.Find(sounds, sound => sound.name == name); s.source.UnPause(); } } BoundingBoxRenderer using UnityEngine; using Vuforia; /// <summary>

/// A component that renders a bounding box using lines. /// </summary>

public class BoundingBoxRenderer : MonoBehaviour {

#region PRIVATE_MEMBERS private Material mLineMaterial = null; #endregion // PRIVATE_MEMBERS

private void OnRenderObject() {

GL.PushMatrix();

GL.MultMatrix(transform.localToWorldMatrix); if (mLineMaterial == null)

{

// We "borrow" the default material from a primitive. // This ensures that, even on mobile platforms, // we always get a valid material at runtime,

// as on mobile Unity can strip away unused shaders at build-time. var tempObj = GameObject.CreatePrimitive(PrimitiveType.Cube); var cubeRenderer = tempObj.GetComponent<MeshRenderer>();

mLineMaterial = new Material(cubeRenderer.material); mLineMaterial.color = Color.white; Destroy(tempObj); } mLineMaterial.SetPass(0); mLineMaterial.color = Color.white; GL.Begin(GL.LINES); // Bottom XZ quad GL.Vertex3(-0.5f, -0.5f, -0.5f);

GL.Vertex3( 0.5f, -0.5f, -0.5f); GL.Vertex3(0.5f, -0.5f, -0.5f); GL.Vertex3(0.5f, -0.5f, 0.5f); GL.Vertex3( 0.5f, -0.5f, 0.5f); GL.Vertex3(-0.5f, -0.5f, 0.5f); GL.Vertex3(-0.5f, -0.5f, 0.5f); GL.Vertex3(-0.5f, -0.5f, -0.5f); // Top XZ quad GL.Vertex3(-0.5f, 0.5f, -0.5f); GL.Vertex3(0.5f, 0.5f, -0.5f); GL.Vertex3(0.5f, 0.5f, -0.5f); GL.Vertex3(0.5f, 0.5f, 0.5f); GL.Vertex3(0.5f, 0.5f, 0.5f); GL.Vertex3(-0.5f, 0.5f, 0.5f); GL.Vertex3(-0.5f, 0.5f, 0.5f); GL.Vertex3(-0.5f, 0.5f, -0.5f); // Side lines GL.Vertex3(-0.5f, -0.5f, -0.5f); GL.Vertex3(-0.5f, 0.5f, -0.5f); GL.Vertex3(0.5f, -0.5f, -0.5f); GL.Vertex3(0.5f, 0.5f, -0.5f); GL.Vertex3(0.5f, -0.5f, 0.5f); GL.Vertex3(0.5f, 0.5f, 0.5f); GL.Vertex3(-0.5f, -0.5f, 0.5f); GL.Vertex3(-0.5f, 0.5f, 0.5f); GL.End(); GL.PopMatrix(); } } CameraFocusController using UnityEngine; using System.Collections; using Vuforia;

private bool mVuforiaStarted = false; void Start ()

{

VuforiaARController vuforia = VuforiaARController.Instance; if (vuforia != null)

vuforia.RegisterVuforiaStartedCallback(StartAfterVuforia); }

private void StartAfterVuforia() {

mVuforiaStarted = true; SetAutofocus();

}

void OnApplicationPause(bool pause) { if (!pause) { // App resumed if (mVuforiaStarted) {

// App resumed and vuforia already started // but lets start it again...

SetAutofocus(); // This is done because some android devices lose the auto focus after resume

// this was a bug in vuforia 4 and 5. I haven't checked 6, but the code is harmless anyway

} } }

private void SetAutofocus() { if (CameraDevice.Instance.SetFocusMode(CameraDevice.FocusMode.FOCUS_MODE_C ONTINUOUSAUTO)) { Debug.Log("Autofocus set"); } else {

// never actually seen a device that doesn't support this, but just in case Debug.Log("this device doesn't support auto focus");

} } }

DefaultInitializationErrorHandler using UnityEngine;

using Vuforia; /// <summary>

/// A custom handler that registers for Vuforia initialization errors ///

/// Changes made to this file could be overwritten when upgrading the Vuforia version. /// When implementing custom error handler behavior, consider inheriting from this class instead.

/// </summary>

public class DefaultInitializationErrorHandler : VuforiaMonoBehaviour {

#region Vuforia_lifecycle_events

public void OnVuforiaInitializationError(VuforiaUnity.InitError initError) { if (initError != VuforiaUnity.InitError.INIT_SUCCESS) { SetErrorCode(initError); SetErrorOccurred(true); } } #endregion // Vuforia_lifecycle_events #region PRIVATE_MEMBER_VARIABLES string mErrorText = ""; bool mErrorOccurred;

const string headerLabel = "Vuforia Engine Initialization Error"; GUIStyle bodyStyle; GUIStyle headerStyle; GUIStyle footerStyle; Texture2D bodyTexture; Texture2D headerTexture; Texture2D footerTexture; #endregion // PRIVATE_MEMBER_VARIABLES #region UNTIY_MONOBEHAVIOUR_METHODS void Awake() {

// Check for an initialization error on start. VuforiaRuntime.Instance.RegisterVuforiaInitErrorCallback(OnVuforiaInitializationError ); } void Start() {

SetupGUIStyles(); }

void OnGUI() {

// On error, create a full screen window. if (mErrorOccurred)

GUI.Window(0, new Rect(0, 0, Screen.width, Screen.height), DrawWindowContent, "");

}

/// <summary>

/// When this game object is destroyed, it unregisters itself as event handler /// </summary> void OnDestroy() { VuforiaRuntime.Instance.UnregisterVuforiaInitErrorCallback(OnVuforiaInitializationErr or); } #endregion // UNTIY_MONOBEHAVIOUR_METHODS #region PRIVATE_METHODS

void DrawWindowContent(int id) {

var headerRect = new Rect(0, 0, Screen.width, Screen.height / 8);

var bodyRect = new Rect(0, Screen.height / 8, Screen.width, Screen.height / 8 * 6); var footerRect = new Rect(0, Screen.height - Screen.height / 8, Screen.width, Screen.height / 8);

GUI.Label(headerRect, headerLabel, headerStyle); GUI.Label(bodyRect, mErrorText, bodyStyle); if (GUI.Button(footerRect, "Close", footerStyle)) { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } }

void SetErrorCode(VuforiaUnity.InitError errorCode) {

switch (errorCode) {

case VuforiaUnity.InitError.INIT_EXTERNAL_DEVICE_NOT_DETECTED: mErrorText =

"Failed to initialize the Vuforia Engine because this " + "device is not docked with required external hardware.";

break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_MISSING_KEY: mErrorText =

"Vuforia Engine App key is missing. Please get a valid key " + "by logging into your account at developer.vuforia.com " + "and creating a new project.";

break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_INVALID_KEY: mErrorText =

"Vuforia Engine App key is invalid. " +

"Please get a valid key by logging into your account at " + "developer.vuforia.com and creating a new project. \n\n" + getKeyInfo();

break; case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT: mErrorText = "Unable to contact server. Please try again later.";

break; case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT: mErrorText = "No network available. Please make sure you are connected to the Internet.";

break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_CANCELED_KEY: mErrorText =

"This App license key has been cancelled and may no longer be used. " + "Please get a new license key. \n\n" +

getKeyInfo(); break;

case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH: mErrorText =

"Vuforia Engine App key is not valid for this product. Please get a valid key " +

"by logging into your account at developer.vuforia.com and choosing the " + "right product type during project creation. \n\n" +

getKeyInfo() + " \n\n" +

"Note that Universal Windows Platform (UWP) apps require " + "a license key created on or after August 9th, 2016.";

break;

case VuforiaUnity.InitError.INIT_NO_CAMERA_ACCESS: mErrorText =

"User denied Camera access to this app.\n" + "To restore, enable Camera access in Settings:\n" +

"Settings > Privacy > Camera > " + Application.productName + "\n" + "Also verify that the Camera is enabled in:\n" +

"Settings > General > Restrictions."; break;

case VuforiaUnity.InitError.INIT_DEVICE_NOT_SUPPORTED:

mErrorText = "Failed to initialize Vuforia Engine because this device is not supported.";

break;

mErrorText = "Failed to initialize Vuforia Engine."; break;

}

// Prepend the error code in red

mErrorText = "<color=red>" + errorCode.ToString().Replace("_", " ") + "</color>\n\n" + mErrorText;

// Remove rich text tags for console logging

var errorTextConsole = mErrorText.Replace("<color=red>", "").Replace("</color>", "");

Debug.LogError("Vuforia Engine initialization failed: " + errorCode + "\n\n" + errorTextConsole);

}

void SetErrorOccurred(bool errorOccurred) {

mErrorOccurred = errorOccurred; }

string getKeyInfo() {

string key = VuforiaConfiguration.Instance.Vuforia.LicenseKey; string keyInfo;

if (key.Length > 10) keyInfo =

"Your current key is <color=red>" + key.Length + "</color> characters in length. " +

"It begins with <color=red>" + key.Substring(0, 5) + "</color> " +

"and ends with <color=red>" + key.Substring(key.Length - 5, 5) + "</color>."; else

keyInfo =

"Your current key is <color=red>" + key.Length + "</color> characters in length. \n" +

"The key is: <color=red>" + key + "</color>."; return keyInfo;

}

void SetupGUIStyles() {

// Called from Start() to determine physical size of device for text sizing

var shortSidePixels = Screen.width < Screen.height ? Screen.width : Screen.height; var shortSideInches = shortSidePixels / Screen.dpi;

var physicalSizeMultiplier = shortSideInches > 4.0f ? 2 : 1;

// Create 1x1 pixel background textures for body, header, and footer bodyTexture = CreateSinglePixelTexture(Color.white);

headerTexture = CreateSinglePixelTexture(new Color( Mathf.InverseLerp(0, 255, 220),

Mathf.InverseLerp(0, 255, 220),

Mathf.InverseLerp(0, 255, 220))); // RGB(220) footerTexture = CreateSinglePixelTexture(new Color(

Mathf.InverseLerp(0, 255, 35), Mathf.InverseLerp(0, 255, 178),

Mathf.InverseLerp(0, 255, 0))); // RGB(35,178,0) // Create body style and set values

bodyStyle = new GUIStyle();

bodyStyle.normal.background = bodyTexture;

bodyStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");

bodyStyle.fontSize = (int) (18 * physicalSizeMultiplier * Screen.dpi / 160); bodyStyle.normal.textColor = Color.black;

bodyStyle.wordWrap = true;

bodyStyle.alignment = TextAnchor.MiddleCenter; bodyStyle.padding = new RectOffset(40, 40, 0, 0); // Duplicate body style and change necessary values headerStyle = new GUIStyle(bodyStyle);

headerStyle.normal.background = headerTexture;

headerStyle.fontSize = (int) (24 * physicalSizeMultiplier * Screen.dpi / 160); // Duplicate body style and change necessary values

footerStyle = new GUIStyle(bodyStyle);

footerStyle.normal.background = footerTexture; footerStyle.normal.textColor = Color.white;

footerStyle.fontSize = (int) (28 * physicalSizeMultiplier * Screen.dpi / 160); }

Texture2D CreateSinglePixelTexture(Color color) {

// Called by SetupGUIStyles() to create 1x1 texture

var texture = new Texture2D(1, 1, TextureFormat.ARGB32, false); texture.SetPixel(0, 0, color); texture.Apply(); return texture; } #endregion // PRIVATE_METHODS }

DefaultModelRecoEventHandler using UnityEngine;

using Vuforia; /// <summary>

/// A custom handler that registers for Vuforia initialization errors ///

/// Changes made to this file could be overwritten when upgrading the Vuforia version. /// When implementing custom error handler behavior, consider inheriting from this class instead.

/// </summary>

public class DefaultInitializationErrorHandler : VuforiaMonoBehaviour {

#region Vuforia_lifecycle_events

public void OnVuforiaInitializationError(VuforiaUnity.InitError initError) { if (initError != VuforiaUnity.InitError.INIT_SUCCESS) { SetErrorCode(initError); SetErrorOccurred(true); } } #endregion // Vuforia_lifecycle_events #region PRIVATE_MEMBER_VARIABLES string mErrorText = ""; bool mErrorOccurred;

const string headerLabel = "Vuforia Engine Initialization Error"; GUIStyle bodyStyle; GUIStyle headerStyle; GUIStyle footerStyle; Texture2D bodyTexture; Texture2D headerTexture; Texture2D footerTexture; #endregion // PRIVATE_MEMBER_VARIABLES #region UNTIY_MONOBEHAVIOUR_METHODS void Awake() {

// Check for an initialization error on start.

VuforiaRuntime.Instance.RegisterVuforiaInitErrorCallback(OnVuforiaInitializationError );

void Start() { SetupGUIStyles(); } void OnGUI() {

// On error, create a full screen window. if (mErrorOccurred)

GUI.Window(0, new Rect(0, 0, Screen.width, Screen.height), DrawWindowContent, "");

}

/// <summary>

/// When this game object is destroyed, it unregisters itself as event handler /// </summary> void OnDestroy() { VuforiaRuntime.Instance.UnregisterVuforiaInitErrorCallback(OnVuforiaInitializationErr or); } #endregion // UNTIY_MONOBEHAVIOUR_METHODS #region PRIVATE_METHODS

void DrawWindowContent(int id) {

var headerRect = new Rect(0, 0, Screen.width, Screen.height / 8);

var bodyRect = new Rect(0, Screen.height / 8, Screen.width, Screen.height / 8 * 6); var footerRect = new Rect(0, Screen.height - Screen.height / 8, Screen.width, Screen.height / 8);

GUI.Label(headerRect, headerLabel, headerStyle); GUI.Label(bodyRect, mErrorText, bodyStyle); if (GUI.Button(footerRect, "Close", footerStyle)) { #if UNITY_EDITOR UnityEditor.EditorApplication.isPlaying = false; #else Application.Quit(); #endif } }

void SetErrorCode(VuforiaUnity.InitError errorCode) {

switch (errorCode) {

mErrorText =

"Failed to initialize the Vuforia Engine because this " + "device is not docked with required external hardware."; break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_MISSING_KEY: mErrorText =

"Vuforia Engine App key is missing. Please get a valid key " + "by logging into your account at developer.vuforia.com " + "and creating a new project.";

break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_INVALID_KEY: mErrorText =

"Vuforia Engine App key is invalid. " +

"Please get a valid key by logging into your account at " + "developer.vuforia.com and creating a new project. \n\n" + getKeyInfo();

break; case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_NO_NETWORK_TRANSIENT: mErrorText = "Unable to contact server. Please try again later.";

break; case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_NO_NETWORK_PERMANENT: mErrorText = "No network available. Please make sure you are connected to the Internet.";

break;

case VuforiaUnity.InitError.INIT_LICENSE_ERROR_CANCELED_KEY: mErrorText =

"This App license key has been cancelled and may no longer be used. " + "Please get a new license key. \n\n" +

getKeyInfo(); break;

case

VuforiaUnity.InitError.INIT_LICENSE_ERROR_PRODUCT_TYPE_MISMATCH: mErrorText =

"Vuforia Engine App key is not valid for this product. Please get a valid key " +

"by logging into your account at developer.vuforia.com and choosing the " + "right product type during project creation. \n\n" +

getKeyInfo() + " \n\n" +

"Note that Universal Windows Platform (UWP) apps require " + "a license key created on or after August 9th, 2016.";

break;

case VuforiaUnity.InitError.INIT_NO_CAMERA_ACCESS: mErrorText =

"User denied Camera access to this app.\n" + "To restore, enable Camera access in Settings:\n" +

"Settings > Privacy > Camera > " + Application.productName + "\n" + "Also verify that the Camera is enabled in:\n" +

"Settings > General > Restrictions."; break;

mErrorText = "Failed to initialize Vuforia Engine because this device is not supported.";

break;

case VuforiaUnity.InitError.INIT_ERROR:

mErrorText = "Failed to initialize Vuforia Engine."; break;

}

// Prepend the error code in red

mErrorText = "<color=red>" + errorCode.ToString().Replace("_", " ") + "</color>\n\n" + mErrorText;

// Remove rich text tags for console logging

var errorTextConsole = mErrorText.Replace("<color=red>", "").Replace("</color>", "");

Debug.LogError("Vuforia Engine initialization failed: " + errorCode + "\n\n" + errorTextConsole);

}

void SetErrorOccurred(bool errorOccurred) {

mErrorOccurred = errorOccurred; }

string getKeyInfo() {

string key = VuforiaConfiguration.Instance.Vuforia.LicenseKey; string keyInfo;

if (key.Length > 10) keyInfo =

"Your current key is <color=red>" + key.Length + "</color> characters in length. " +

"It begins with <color=red>" + key.Substring(0, 5) + "</color> " +

"and ends with <color=red>" + key.Substring(key.Length - 5, 5) + "</color>."; else

keyInfo =

"Your current key is <color=red>" + key.Length + "</color> characters in length. \n" +

"The key is: <color=red>" + key + "</color>."; return keyInfo;

}

void SetupGUIStyles() {

// Called from Start() to determine physical size of device for text sizing

var shortSidePixels = Screen.width < Screen.height ? Screen.width : Screen.height; var shortSideInches = shortSidePixels / Screen.dpi;

var physicalSizeMultiplier = shortSideInches > 4.0f ? 2 : 1;

// Create 1x1 pixel background textures for body, header, and footer bodyTexture = CreateSinglePixelTexture(Color.white);

Mathf.InverseLerp(0, 255, 220), Mathf.InverseLerp(0, 255, 220),

Mathf.InverseLerp(0, 255, 220))); // RGB(220) footerTexture = CreateSinglePixelTexture(new Color( Mathf.InverseLerp(0, 255, 35),

Mathf.InverseLerp(0, 255, 178),

Mathf.InverseLerp(0, 255, 0))); // RGB(35,178,0) // Create body style and set values

bodyStyle = new GUIStyle();

bodyStyle.normal.background = bodyTexture;

bodyStyle.font = Resources.GetBuiltinResource<Font>("Arial.ttf");

bodyStyle.fontSize = (int) (18 * physicalSizeMultiplier * Screen.dpi / 160); bodyStyle.normal.textColor = Color.black;

bodyStyle.wordWrap = true;

bodyStyle.alignment = TextAnchor.MiddleCenter; bodyStyle.padding = new RectOffset(40, 40, 0, 0); // Duplicate body style and change necessary values headerStyle = new GUIStyle(bodyStyle);

headerStyle.normal.background = headerTexture;

headerStyle.fontSize = (int) (24 * physicalSizeMultiplier * Screen.dpi / 160); // Duplicate body style and change necessary values

footerStyle = new GUIStyle(bodyStyle);

footerStyle.normal.background = footerTexture; footerStyle.normal.textColor = Color.white;

footerStyle.fontSize = (int) (28 * physicalSizeMultiplier * Screen.dpi / 160); }

Texture2D CreateSinglePixelTexture(Color color) {

// Called by SetupGUIStyles() to create 1x1 texture

var texture = new Texture2D(1, 1, TextureFormat.ARGB32, false); texture.SetPixel(0, 0, color); texture.Apply(); return texture; } #endregion // PRIVATE_METHODS } DefaultTrackableEventHandler using UnityEngine; using Vuforia; /// <summary>

/// A custom handler that implements the ITrackableEventHandler interface. ///

/// Changes made to this file could be overwritten when upgrading the Vuforia version. /// When implementing custom event handler behavior, consider inheriting from this class instead.

/// </summary>

public class DefaultTrackableEventHandler : MonoBehaviour, ITrackableEventHandler {

#region PROTECTED_MEMBER_VARIABLES protected TrackableBehaviour mTrackableBehaviour; protected TrackableBehaviour.Status m_PreviousStatus; protected TrackableBehaviour.Status m_NewStatus; #endregion // PROTECTED_MEMBER_VARIABLES #region UNITY_MONOBEHAVIOUR_METHODS protected virtual void Start()

{

mTrackableBehaviour = GetComponent<TrackableBehaviour>(); if (mTrackableBehaviour)

mTrackableBehaviour.RegisterTrackableEventHandler(this); }

protected virtual void OnDestroy() { if (mTrackableBehaviour) mTrackableBehaviour.UnregisterTrackableEventHandler(this); } #endregion // UNITY_MONOBEHAVIOUR_METHODS #region PUBLIC_METHODS /// <summary>

/// Implementation of the ITrackableEventHandler function called when the /// tracking state changes.

/// </summary>

public void OnTrackableStateChanged( TrackableBehaviour.Status previousStatus, TrackableBehaviour.Status newStatus) { m_PreviousStatus = previousStatus; m_NewStatus = newStatus; Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " " + mTrackableBehaviour.CurrentStatus + " -- " + mTrackableBehaviour.CurrentStatusInfo); if (newStatus == TrackableBehaviour.Status.DETECTED || newStatus == TrackableBehaviour.Status.TRACKED || newStatus == TrackableBehaviour.Status.EXTENDED_TRACKED) { OnTrackingFound(); }

else if (previousStatus == TrackableBehaviour.Status.TRACKED && newStatus == TrackableBehaviour.Status.NO_POSE)

{

OnTrackingLost(); }

else {

// For combo of previousStatus=UNKNOWN + newStatus=UNKNOWN|NOT_FOUND

// Vuforia is starting, but tracking has not been lost or found yet // Call OnTrackingLost() to hide the augmentations

OnTrackingLost(); }

}

#endregion // PUBLIC_METHODS #region PROTECTED_METHODS protected virtual void OnTrackingFound() { if (mTrackableBehaviour) { var rendererComponents = mTrackableBehaviour.GetComponentsInChildren<Renderer>(true); var colliderComponents = mTrackableBehaviour.GetComponentsInChildren<Collider>(true); var canvasComponents = mTrackableBehaviour.GetComponentsInChildren<Canvas>(true); // Enable rendering:

foreach (var component in rendererComponents) component.enabled = true;

// Enable colliders:

foreach (var component in colliderComponents) component.enabled = true;

// Enable canvas':

foreach (var component in canvasComponents) component.enabled = true;

} }

protected virtual void OnTrackingLost() { if (mTrackableBehaviour) { var rendererComponents = mTrackableBehaviour.GetComponentsInChildren<Renderer>(true); var colliderComponents = mTrackableBehaviour.GetComponentsInChildren<Collider>(true); var canvasComponents = mTrackableBehaviour.GetComponentsInChildren<Canvas>(true);

// Disable rendering:

foreach (var component in rendererComponents) component.enabled = false;

// Disable colliders:

foreach (var component in colliderComponents) component.enabled = false;

// Disable canvas':

foreach (var component in canvasComponents) component.enabled = false; } } #endregion // PROTECTED_METHODS } FirstRunDetect using System.Collections; using System.Collections.Generic; using UnityEngine.SceneManagement; using UnityEngine;

public class firstRunDetect : MonoBehaviour {

int firstRun = 0;

public GameObject play; public GameObject stop; AudioSource audioSource;

// Start is called before the first frame update void Start() { firstRun = PlayerPrefs.GetInt("saveFirstRun"); if (firstRun == 0) { PlayerPrefs.SetInt("saveFirstRun", 1); SceneManager.LoadScene(5); } audioSource = FindObjectOfType<audioManager>().GetComponent<AudioSource>(); }

// Update is called once per frame void Update()

{

{ play.SetActive(true); stop.SetActive(false); } else { play.SetActive(false); stop.SetActive(true); } }

public void Play() {

audioSource.Play(); }

public void Stop() { audioSource.Stop(); } } InfoClick using UnityEngine; using System.Collections; using UnityEngine.SceneManagement; using UnityEngine.UI;

public class InfoKlik : MonoBehaviour {

public Transform target1; /* private Vector2 scrollPosition; * public Texture gambar,exit;

public string info;*/ public string nama;

public bool statusInfo=false; void Update(){

if(Input.GetMouseButton(0)){ Ray ray =

Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit;

if(Physics.Raycast(ray, out hit)){ // jika objek di sentuh if(hit.transform == target1){ /**statusInfo=true;*/ pindah(nama); } } } }

public void pindah(string sceneName) { SceneManager.LoadScene(sceneName); } void OnGUI(){ if (statusInfo==true){ } } } Modifier using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; [System.Serializable] public class modifier{ public Scrollbar scrl; public string name; public Transform objek; [Range(0f, 0.1f)] public float scale; } Navigasi using System.Collections; using System.Collections.Generic; using UnityEngine.SceneManagement; using UnityEngine;

public class navigasi : MonoBehaviour {

public void pindah(string SceneName) {

SceneManager.LoadScene(SceneName); }

public void keluar() {

Application.Quit(); }

} SizeManager using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI;

public class sizeManager : MonoBehaviour {

public modifier[] mody;

// Start is called before the first frame update private void Start()

{

foreach (modifier m in mody) {

m.objek.localScale = new Vector3(0.5f, 0.5f, 0.5f); m.scale = 0.5f;

m.scrl.value = m.scale; }

}

// Update is called once per frame void Update()

{

foreach (modifier m in mody) {

m.scale = m.scrl.value;

m.objek.localScale = new Vector3(m.scale, m.scale, m.scale); } } } Sound using UnityEngine.Audio; using UnityEngine; using UnityEngine.UI; [System.Serializable] public class Sound{ public string name;

public AudioClip clip; [Range(0f,1f)]

public float pitch; [Range(0f, 1f)] public float volume;

public bool loop; [HideInInspector]

public AudioSource source;

Dokumen terkait