Created
October 10, 2018 00:55
-
-
Save nabesi777/7d3ce6c85640fcf0adaec07462472be4 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.Generic; | |
using UnityEngine; | |
using System; | |
class Trapcol : MonoBehaviour | |
{ | |
public ChaCon2 CC; //”ChaCon2”スクリプトがアタッチされたPlayerをインスペクター上で格納 | |
OnTriggerEnter(Collider collider) | |
{//トラップタグをもつオブジェクトへ当たった時 | |
if (collider.gameObject.CompareTag("Trap")) | |
{//指定したスクリプトを無効化 | |
CC = CC.GetComponent<ChaCon2>(); | |
CC.enabled = false; | |
//3秒後に無効にしたスクリプトを有効化 | |
Invoke("Restart", 3.0f); | |
} | |
} | |
void Restart() | |
{ | |
CC.enabled = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment