Example #1
0
 /// <summary>
 /// 対象との角度の調整
 /// </summary>
 private void SetTargetAngle()
 {
     if (detector && detector.GetDetectCount() > 0)
     {
         //距離計算
         float d1 = 0f, d2 = float.MaxValue;
         DetectableObject2D near = null;
         foreach (var obj in detector.Objects)
         {
             d1 = Vector2.Distance(trans.position, obj.transform.position);
             if (d1 < d2)
             {
                 d2   = d1;
                 near = obj;
             }
         }
         weapon.SetTargetAngle(near.transform);
     }
 }
Example #2
0
        /// <summary>
        /// 検出
        /// </summary>
        private void OnDetect(DetectableObject2D obj)
        {
            Debug.Log("OnDetect : " + obj);
            //ターゲッティングの優先順位の更新

            //カメラサイズの変更
            if (cameraSize)
            {
                cameraSize.SetCameraSize(detector.GetDetectCount() * 1f + 20f);
            }

            //仮
            target      = obj;
            targetTrans = obj.transform;
            wManager.Activate();
        }