Example #1
0
        private WeaponController[] weapons;             //武器

        #region Function

        /// <summary>
        /// 武器の角度を更新
        /// </summary>
        public void UpdateAngle(Transform target)
        {
            Vector3 targetPos = target.position;
            Vector3 d;
            float   angle;

            //mainAxisの角度
            d     = targetPos - mainAxis.transform.position;
            angle = Mathf.Atan2(d.y, d.x) * Mathf.Rad2Deg;
            mainAxis.SetAngle(angle);

            //武器の角度
            foreach (var w in weapons)
            {
                d     = targetPos - w.transform.position;
                angle = Mathf.Atan2(d.y, d.x) * Mathf.Rad2Deg;
                w.SetAngle(angle);
            }
        }
Example #2
0
 /// <summary>
 /// 発射角の設定
 /// </summary>
 public void SetAngle(float angle)
 {
     axis.SetAngle(angle);
 }