Last active
August 6, 2017 08:33
-
-
Save flushpot1125/7091d111d0af449c8946102a70177e23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
using HoloToolkit.Unity.SpatialMapping; | |
public class ObjectManipulator : MonoBehaviour { | |
private GameObject CGModelObj; | |
private AudioSource CGModelAudioSource; | |
[SerializeField] | |
SpatialMappingManager sManager; | |
private bool CGModelAudioFlag = false; | |
void Start(){ | |
CGModelObj = GameObject.Find("CGModel"); | |
CGModelAudioSource = CGModelObj.GetComponent<AudioSource>(); | |
} | |
void Update() { | |
//メッシュ情報の表示/非表示 | |
if (Input.GetKeyDown(KeyCode.K)) { | |
if (sManager.DrawVisualMeshes == false) { | |
sManager.DrawVisualMeshes =true; | |
} else { | |
sManager.DrawVisualMeshes = false; | |
} | |
} | |
CGModelObj.transform.position = new Vector3(CGModelObj.transform.position.x + Input.GetAxis("Horizontal") / 50, CGModelObj.transform.position.y, CGModelObj.transform.position.z + Input.GetAxis("Vertical") / 50); | |
//CGModelを動かしている間だけ効果音を再生。CGモデルの駆動音再現につかえる | |
if (((Input.GetAxis("Horizontal") != 0) || (Input.GetAxis("Vertical") != 0)) && (CGModelAudioFlag== true)) { | |
CGModelAudioSource.Play(); | |
CGModelAudioFlag = false; | |
} else if (((Input.GetAxis("Horizontal") == 0) && (Input.GetAxis("Vertical") == 0)) && (bulldozerAudioFlag == false)) { | |
CGModelAudioSource.Stop(); | |
CGModelAudioFlag = true; | |
} else { | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment