/// <summary> /// Start /// </summary> public void Start( Turret turret, BulletBase bulletBase, Vector2 dropPosition, BulletCollider.IReceiver stayEventReceiver, Action onFinished) { this.turret = turret; this.bulletBase = bulletBase; this.rectTransform = this.bulletBase.transform as RectTransform; this.startPosition = this.rectTransform.anchoredPosition; this.dropPosition = dropPosition; this.stayEventReceiver = stayEventReceiver; this.onFinished = onFinished; //爆発するまでコライダを切っておく this.bulletBase.bulletCollider.enabled = false; //射出アニメーション this.turret.PlayBulletFiringAnimation(); SoundManager.Instance.PlaySe(this.turret.barrelData.seName); //砲弾アニメーション更新は手動で行う this.bulletBase.animator.enabled = false; this.bulletBase.animator.Update(0); this.bulletBase.GetComponent<AnimationEventReceiver>().onFinished = this.OnFinishedAnimation; //移動開始 this.stateAction = this.MoveState; }
/// <summary> /// 移動ステート /// </summary> private void MoveState(float deltaTime) { //移動 this.rectTransform.anchoredPosition = Vector2.Lerp(this.startPosition, this.dropPosition, this.moveTime); if (this.moveTime >= 1f) { //爆破 this.bulletBase.animator.Play("explosion", 0, 0f); this.bulletBase.bulletCollider.enabled = true; this.bulletBase.bulletCollider.stayEventReceiver = this.stayEventReceiver; this.stateAction = null; SoundManager.Instance.PlaySe(SeName.FVATTACK_BOMB); } this.moveTime += deltaTime; }