示例#1
0
    private IEnumerator Rotation()
    {
        if (!_isRotation)
        {
            _isRotation = true;
            float angle = Random.Range(-20.0f, 0.0f);
            float timer = 0.0f;

            float start = _Fortress.cannon.transform.eulerAngles.z;
            while (180.0f < start)
            {
                start -= 360;
            }

            while (timer < 1.0f)
            {
                //時間加算
                timer = Mathf.Min(1.0f, timer + Time.deltaTime);
                _Fortress.cannon.transform.eulerAngles = new Vector3(0, 0, Mathf.Lerp(start, angle, timer));

                yield return(new WaitForEndOfFrame());
            }
            //回転終了したら発射。
            _Fortress.Shot(Data.GetBulletInfo(_Fortress.armory[0]), Vector3.left * 100);

            _isRotation = false;
        }
    }
示例#2
0
 //要塞から弾を発射する。
 public void Shot(BulletInfo info)
 {
     //発射。
     _Fortress.Shot(info, Vector3.right * 100);
 }