Debug.Log("L31 doorControl.cs right rot: " + doorRight.transform.localEulerAngles.z);
SoundManager.Instance.PlaySE(23); // ドアの開閉動時のギーーという音
float z = 180f;
float t = 5f;
float zz = 10f; // ドアの上下動の量
if(doorRight.transform.localEulerAngles.z == 180f){ // 開く
iTween.RotateTo(doorLeft, iTween.Hash("time", t, "z", -z,
"oncomplete", "onDoorRotateComplete", "oncompletetarget", this.gameObject));
iTween.MoveBy (doorLeft, iTween.Hash("time", t, "z", -zz));
iTween.RotateTo(doorRight, iTween.Hash("time", t, "z", z));
iTween.MoveBy (doorRight, iTween.Hash("time", t, "z", -zz));
}else if(doorRight.transform.localEulerAngles.z < 1f ){ // 閉じる
iTween.RotateTo(doorLeft, iTween.Hash("time", t, "z", z,"oncomplete",
"onDoorRotateComplete", "oncompletetarget", this.gameObject));
iTween.MoveBy (doorLeft, iTween.Hash("time", t, "z", -zz));
iTween.RotateTo(doorRight, iTween.Hash("time", t, "z", -z));
iTween.MoveBy (doorRight, iTween.Hash("time", t, "z", -zz));
}
}
void onDoorRotateComplete(){
SoundManager.Instance.PlaySE(24); // ドアが開閉終了時のバッタンという音
float t = 0.75f;
float zz = 10f;
iTween.MoveBy (doorLeft, iTween.Hash("time", t, "z", zz));
iTween.MoveBy (doorRight, iTween.Hash("time", t, "z", zz));
}