//ふぃるむし着地時揺れ public void SwayLanding() { selectFlag = true; swayFlag = true; nowTime = 0; swaySpeed = swayDegreeMax / swayTime1; swayStatus = SWAYSTATUS.SWAY1; stageSelectPlayer.transform.SetParent(tf); }
// Update is called once per frame private void Update() { if (swayFlag) { nowTime += Time.deltaTime; switch (swayStatus) { case SWAYSTATUS.SWAY1: if (nowTime >= swayTime1) { tf.RotateAround(clipPosition, Vector3.forward, swaySpeed * (Time.deltaTime - (nowTime - swayTime1))); nowTime = 0; swaySpeed = (swayDegreeMin - swayDegreeMax) / swayTime2; swayStatus = SWAYSTATUS.SWAY2; break; } tf.RotateAround(clipPosition, Vector3.forward, swaySpeed * Time.deltaTime); break; case SWAYSTATUS.SWAY2: if (nowTime >= swayTime2) { tf.RotateAround(clipPosition, Vector3.forward, swaySpeed * (Time.deltaTime - (nowTime - swayTime2))); nowTime = 0; swaySpeed = -swayDegreeMin / swayTime3; swayStatus = SWAYSTATUS.SWAY3; break; } tf.RotateAround(clipPosition, Vector3.forward, swaySpeed * Time.deltaTime); break; case SWAYSTATUS.SWAY3: if (nowTime >= swayTime3) { tf.position = defaultPosition; tf.rotation = defaultRotation; swayStatus = SWAYSTATUS.NOT_SWAY; stageSelectManager.ChangeStageDetail(); break; } tf.RotateAround(clipPosition, Vector3.forward, swaySpeed * Time.deltaTime); break; default: break; } } }
// Use this for initialization private void Start() { stageSelectManager = GameObject.Find("StageSelectManager").GetComponent <StageSelectManager>(); stageSelectPlayer = GameObject.Find("StageSelectPlayer").GetComponent <StageSelectPlayer>(); swayDegreeMax = stageSelectManager.swayDegreeMax; swayDegreeMin = stageSelectManager.swayDegreeMin; swayTime1 = stageSelectManager.swayTime1; swayTime2 = stageSelectManager.swayTime2; swayTime3 = stageSelectManager.swayTime3; swaySpeed = 0; swayStatus = SWAYSTATUS.NOT_SWAY; defaultPosition = tf.position; defaultRotation = tf.rotation; nowPos = tf.position; clipPosition = tf.parent.position; this.audioClip = new CustomAudioClip[(int)AudioList.AUDIO_MAX]; this.audioClip[0].Clip = Resources.Load("Audio/SE/Button_Yes", typeof(AudioClip)) as AudioClip; this.audioClip[0].Vol = 1.0f; this.sourceAudio = this.gameObject.AddComponent <SourceAudio>(); this.sourceAudio.m_Audio = this.audioClip; }