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
//コントローラー用(別々のスクリプト) | |
int score = 0; | |
GameObject scoreText; | |
public void AddScore(){ | |
this.score += 10; | |
} | |
void Start () { | |
this.scoreText = GameObject.Find ("Score"); |
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
bool ShootBool = false; | |
void Update () { | |
//タッチしたら再生されないようにする(連続再生させない) | |
if (Input.GetMouseButtonDown(0) && !ShootBool) { | |
ShootBool = true; | |
iTweenEvent.GetEvent(gameObject,"shoot").Play(); | |
Debug.Log ("Shoot"); | |
} | |
}//Update |
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
// Use this for initialization | |
void Start () | |
{ | |
Animation anim = gameObject.GetComponent<Animation> (); | |
PlayAnimation (anim); | |
} | |
void PlayAnimation (Animation anim) | |
{ | |
anim.Play (); |
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
// 左クリックしたオブジェクトを取得する関数(3D) | |
public GameObject getClickObject() { | |
GameObject result = null; | |
// 左クリックされた場所のオブジェクトを取得 | |
if(Input.GetMouseButtonDown(0)) { | |
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); | |
RaycastHit hit = new RaycastHit(); | |
if (Physics.Raycast(ray, out hit)){ | |
result = hit.collider.gameObject; | |
} |
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
transform.Rotate(X * Time.deltaTime, Y * Time.deltaTime, Z * Time.deltaTime); |
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
// 現在時刻の取得 | |
System.DateTime now = System.DateTime.Now; | |
int nowMonth; | |
int nowDay; | |
now = System.DateTime.Now; | |
nowMonth = now.Month; | |
nowDay = now.Day; |
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
Shader "DoubleSide" { | |
Properties { | |
_Color ("Main Color", Color) = (1,1,1,1) | |
_MainTex ("Base (RGB)", 2D) = "white" {} | |
} | |
SubShader { | |
Tags { "RenderType"="Opaque" } | |
LOD 200 | |
Cull off | |
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
// ボタンの設定 | |
function OnGUI () { | |
// バッググラウンドと名前設定 | |
GUI.Box (Rect (10,10,100,90), "メニュー"); | |
// ボタンの位置と名前設定 | |
if (GUI.Button (Rect (20,40,80,20), "Script ON")) { | |
// ボタン押した時に実行したいもの | |
GetComponent(スクリプト名).enabled = true; | |
} | |
if (GUI.Button (Rect (20,70,80,20), "Script OFF")) { |
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
public GameObject[] Num_spline = new GameObject[10]; | |
public bool parchk=true; | |
void Start () { | |
} | |
void Update () { | |
if (Input.GetMouseButtonDown(0)) { |
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
1.現在のシーン名を判定 | |
if(Application.loadedLevelName == "main"){ | |
scene = true; | |
}else{ | |
scene = false; | |
} | |
2.回転させる | |
this.transform.Rotate (new Vector3 (0, 0, 5 * Time.deltaTime)); |