LISTING PROGRAM
UserInterface
using UnityEngine;
using System.Collections;
public class UserInterface : MonoBehaviour {
public GameObject menuutama; public GameObject pilihan; public GameObject jenisvirus; public GameObject jenisbakteri; public GameObject influenzavirus; public GameObject herpessimplexvirus;
public GameObject humanimmunodificiencyvirus; public GameObject mycobacteriumtuberculosis; public GameObject vibriocholera;
public GameObject salmonellathyposa; public GameObject about;
void mulai(){
menuutama.SetActive (true); about.SetActive (false); }
Application.LoadLevel (scene); }
public void klikabout(){
menuutama.SetActive (false); about.SetActive (true); }
public void klikvirus(){
pilihan.SetActive (false); jenisvirus.SetActive (true); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (false); }
public void klikbakteri(){
pilihan.SetActive (false); jenisvirus.SetActive (false); jenisbakteri.SetActive (true); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
}
public void klikinfluenza(){ pilihan.SetActive (false); jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (true); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (false); }
public void klikherpes(){
pilihan.SetActive (false); jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (true);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (false); }
public void klikhiv(){
jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (true); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (false); }
public void kliktbc(){
pilihan.SetActive (false); jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (true); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (false); }
public void klikcholera(){
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (true);
salmonellathyposa.SetActive (false); }
public void kliktyphosa(){
pilihan.SetActive (false); jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
humanimmunodificiencyvirus.SetActive (false); mycobacteriumtuberculosis.SetActive (false); vibriocholera.SetActive (false);
salmonellathyposa.SetActive (true); }
public void kembalipilihan(){ pilihan.SetActive (true); jenisvirus.SetActive (false); jenisbakteri.SetActive (false); influenzavirus.SetActive (false); herpessimplexvirus.SetActive (false);
salmonellathyposa.SetActive (false); }
public void menukembali(){
menuutama.SetActive (true); about.SetActive (false); }
public void kembalihome(int scene){ Application.LoadLevel (scene); }
public void keluar(){ Application.Quit (); }
public void AR(int scene){
Application.LoadLevel (scene); }
Zoom dan Rotate
Simple Select Transform
using UnityEngine;
// This script allows you to transform the GameObject selected by SimpleSelect
public class SimpleSelectTransform : SimpleSelect {
public bool AllowTranslate = true;
public bool AllowRotate = true;
public bool AllowScale = true;
protected virtual void Update() {
// Make sure we have something selected if (SelectedGameObject != null)
{
// Make sure the main camera exists if (Camera.main != null)
{
if (AllowTranslate == true) {
}
if (AllowRotate == true) {
Rotate(SelectedGameObject.transform, Lean.LeanTouch.TwistDegrees);
}
if (AllowScale == true) {
Scale(SelectedGameObject.transform, Lean.LeanTouch.PinchScale);
} }
} }
public void Translate(Transform transform, Vector2 screenPositionDelta)
{
// Screen position of the transform var screenPosition =
Camera.main.WorldToScreenPoint(transform.position);
// Add the deltaPosition
screenPosition += (Vector3)screenPositionDelta;
// Convert back to world space transform.position =
}
public void Rotate(Transform transform, float angleDelta) {
transform.rotation *= Quaternion.Euler(0.0f, 0.0f, angleDelta);
}
public void Scale(Transform transform, float scale) {
// Make sure the scale is valid if (scale > 0.0f)
{
// Grow the local scale by scale transform.localScale *= scale; }
} }
Simple Select
using UnityEngine;
// This script allows you to select a GameObject using any finger, as long it has a collider
public class SimpleSelect : MonoBehaviour {
public LayerMask LayerMask =
UnityEngine.Physics.DefaultRaycastLayers;
[Tooltip("The previously selected GameObject")] public GameObject SelectedGameObject;
protected virtual void OnEnable() {
// Hook into the OnFingerTap event
Lean.LeanTouch.OnFingerTap += OnFingerTap; }
protected virtual void OnDisable() {
// Unhook from the OnFingerTap event
Lean.LeanTouch.OnFingerTap -= OnFingerTap; }
public void OnFingerTap(Lean.LeanFinger finger) {
// Raycast information var ray = finger.GetRay(); var hit = default(RaycastHit);
// Was this finger pressed down on a collider?
if (Physics.Raycast(ray, out hit, float.PositiveInfinity, LayerMask) == true)
// Remove the color from the currently selected one? if (SelectedGameObject != null)
{
ColorGameObject(SelectedGameObject, Color.white);
}
SelectedGameObject = hit.collider.gameObject;
ColorGameObject(SelectedGameObject, Color.green); }
}
private static void ColorGameObject(GameObject gameObject, Color color)
{
// Make sure the GameObject exists if (gameObject != null)
{
// Get renderer from this GameObject
var renderer = gameObject.GetComponent<Renderer>();
// Make sure the Renderer exists if (renderer != null)
{
// Make sure the material exists if (material != null)
{
// Set new color
material.color = color; }
} }