激光大修改
This commit is contained in:
parent
5f41effd6e
commit
2e62ccf66e
|
@ -23099,7 +23099,7 @@ PrefabInstance:
|
|||
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 10
|
||||
value: 15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
|
||||
type: 3}
|
||||
|
@ -23109,7 +23109,7 @@ PrefabInstance:
|
|||
- target: {fileID: 5698306997877693391, guid: 91b685a7f0a6f7643b8ae61842f883de,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 10
|
||||
value: 15
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8500934962979638684, guid: 91b685a7f0a6f7643b8ae61842f883de,
|
||||
type: 3}
|
||||
|
|
|
@ -1907,7 +1907,7 @@ Camera:
|
|||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
orthographic size: 10
|
||||
m_Depth: 0
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
|
@ -10088,7 +10088,10 @@ MonoBehaviour:
|
|||
CumulativeActionTimeOfDamageTarget: 1
|
||||
InterferenceDistance: 1
|
||||
InterferenceAngle: 1
|
||||
Receivingdistance: 0
|
||||
timepiece: 5
|
||||
isLasing: 0
|
||||
isLasings: 0
|
||||
LaserModer: {fileID: 7615181138790815506}
|
||||
LaserPoint: {fileID: 7615181139587479128}
|
||||
targetPoint: {fileID: 0}
|
||||
|
@ -10108,6 +10111,7 @@ MonoBehaviour:
|
|||
Front: 1
|
||||
Detection: {fileID: 3494968556799403172, guid: c20b9fea41a9bce4e8780bab3d0e13f9,
|
||||
type: 3}
|
||||
Receivingposin: {fileID: 0}
|
||||
--- !u!114 &7615181139496386323
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
|
@ -35,7 +35,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 420, y: 330}
|
||||
m_SizeDelta: {x: 400, y: 400}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1586417954742020053
|
||||
CanvasRenderer:
|
||||
|
@ -108,7 +108,7 @@ RectTransform:
|
|||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 420, y: 330}
|
||||
m_SizeDelta: {x: 400, y: 400}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &1586417954866262514
|
||||
CanvasRenderer:
|
||||
|
@ -131,7 +131,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_Color: {r: 0.14173195, g: 0.6132076, b: 0.15074104, a: 0.65882355}
|
||||
m_RaycastTarget: 1
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
|
@ -171,6 +171,7 @@ GameObject:
|
|||
- component: {fileID: 1586417955185665353}
|
||||
- component: {fileID: 1586417955185665355}
|
||||
- component: {fileID: 1586417955185665352}
|
||||
- component: {fileID: 5625461230196841852}
|
||||
m_Layer: 5
|
||||
m_Name: Minimap
|
||||
m_TagString: Untagged
|
||||
|
@ -190,6 +191,7 @@ RectTransform:
|
|||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1586417954866262513}
|
||||
- {fileID: 8295591216700450604}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -235,3 +237,168 @@ MonoBehaviour:
|
|||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!95 &5625461230196841852
|
||||
Animator:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1586417955185665358}
|
||||
m_Enabled: 1
|
||||
m_Avatar: {fileID: 0}
|
||||
m_Controller: {fileID: 9100000, guid: 1bcafaff71ab94f44b5f493699d1f431, type: 2}
|
||||
m_CullingMode: 0
|
||||
m_UpdateMode: 0
|
||||
m_ApplyRootMotion: 0
|
||||
m_LinearVelocityBlending: 0
|
||||
m_WarningMessage:
|
||||
m_HasTransformHierarchy: 1
|
||||
m_AllowConstantClipSamplingOptimization: 1
|
||||
m_KeepAnimatorControllerStateOnDisable: 0
|
||||
--- !u!1001 &2854750051717222595
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 1586417955185665353}
|
||||
m_Modifications:
|
||||
- target: {fileID: 5792952501764384510, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: -5719797979667371551, guid: 21f18eeb9c7a8e34aa2c8ac5d1a572ce,
|
||||
type: 3}
|
||||
- target: {fileID: 5792952501764384510, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Color.r
|
||||
value: 0.043878667
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5792952501764384510, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Color.g
|
||||
value: 0.9716981
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 5792952501764384510, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Color.b
|
||||
value: 0.03208439
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 390
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 390
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6612989792782812400, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: "\u626B\u63CF\u533A\u57DF"
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 27b14bebf99279747a2a4c8e57fd66a7, type: 3}
|
||||
--- !u!224 &8295591216700450604 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 6089359614475106287, guid: 27b14bebf99279747a2a4c8e57fd66a7,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2854750051717222595}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
|
|
@ -1149,7 +1149,7 @@ public class Scenariopage : MonoBehaviour
|
|||
aircraft.think_device_id = strlist[3];
|
||||
aircraft.para_name = laserlist[i].text;
|
||||
//aircraft.para_type = "";
|
||||
aircraft.para_value = laserquantitylist[i].value.ToString("0");
|
||||
aircraft.para_value = laserquantitylist[i].value.ToString("f1");
|
||||
aircraft.para_unit = laserunitlists[i];
|
||||
aircraft.r1 = Laserunitlist[i].text;
|
||||
//aircraft.r2 = "";
|
||||
|
@ -2189,7 +2189,7 @@ public class Scenariopage : MonoBehaviour
|
|||
{
|
||||
Aircraft aircraft = new Aircraft();
|
||||
aircraft.para_name = laserlist[i].text;
|
||||
aircraft.para_value = laserquantitylist[i].value.ToString("0");
|
||||
aircraft.para_value = laserquantitylist[i].value.ToString("f1");
|
||||
aircraft.para_unit = laserunitlists[i];
|
||||
aircraft.r1 = Laserunitlist[i].text;
|
||||
aircrafts.Add(aircraft);
|
||||
|
|
|
@ -38,7 +38,7 @@ RenderSettings:
|
|||
m_ReflectionIntensity: 1
|
||||
m_CustomReflection: {fileID: 0}
|
||||
m_Sun: {fileID: 0}
|
||||
m_IndirectSpecularColor: {r: 0.165218, g: 0.3075422, b: 0.6572481, a: 1}
|
||||
m_IndirectSpecularColor: {r: 0.16521391, g: 0.30764452, b: 0.6578343, a: 1}
|
||||
m_UseRadianceAmbientProbe: 0
|
||||
--- !u!157 &3
|
||||
LightmapSettings:
|
||||
|
@ -95782,6 +95782,21 @@ PrefabInstance:
|
|||
propertyPath: m_Name
|
||||
value: angle1_text
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4723123646946089641, guid: 2ac9048583d0af747848ea5faaf1843a,
|
||||
type: 3}
|
||||
propertyPath: m_MinValue
|
||||
value: 0.1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4723123646946089641, guid: 2ac9048583d0af747848ea5faaf1843a,
|
||||
type: 3}
|
||||
propertyPath: m_WholeNumbers
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4723123646946089641, guid: 2ac9048583d0af747848ea5faaf1843a,
|
||||
type: 3}
|
||||
propertyPath: m_Value
|
||||
value: 0.039
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4723123647038005820, guid: 2ac9048583d0af747848ea5faaf1843a,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
|
@ -106459,7 +106474,7 @@ MonoBehaviour:
|
|||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
randSeed: 1860173453
|
||||
randSeed: -2003133703
|
||||
isDoingTransition: 0
|
||||
minimumHeight: 0
|
||||
--- !u!114 &1820978574
|
||||
|
|
|
@ -9,7 +9,7 @@ using Newtonsoft.Json.Linq;
|
|||
public static class InterfaceManager
|
||||
{
|
||||
|
||||
private static string _IP = "172.16.1.41";
|
||||
private static string _IP = "172.16.1.128";
|
||||
public static string IP
|
||||
{
|
||||
get { return _IP; }
|
||||
|
|
|
@ -64,7 +64,7 @@ public class EquipmentCommon : MonoBehaviour
|
|||
/// </summary>
|
||||
public GameObject explodePrefab;
|
||||
|
||||
void Start()
|
||||
void Awake()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
DeviceManager.Instance.devices.Add(this);
|
||||
|
|
|
@ -8,6 +8,7 @@ using Newtonsoft.Json;
|
|||
using static InterfaceManager;
|
||||
using DG.Tweening.Core.Easing;
|
||||
using UnityEngine.EventSystems;
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// 激光火控平台
|
||||
|
@ -43,6 +44,14 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 协程对象
|
||||
/// </summary>
|
||||
private Coroutine coroutinetime;
|
||||
/// <summary>
|
||||
/// 定时器运行状态
|
||||
/// </summary>
|
||||
private bool islaser = false;
|
||||
/// <summary>
|
||||
/// 协程对象
|
||||
/// </summary>
|
||||
private Coroutine timerCoroutine;
|
||||
/// <summary>
|
||||
/// 定时器运行状态
|
||||
|
@ -72,14 +81,24 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// 干扰角度
|
||||
/// </summary>
|
||||
public string InterferenceAngle;
|
||||
|
||||
/// <summary>
|
||||
/// 接收干扰距离
|
||||
/// </summary>
|
||||
public float Receivingdistance;
|
||||
/// <summary>
|
||||
/// 计时器
|
||||
/// </summary>
|
||||
public float timepiece = 5;
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 激光
|
||||
/// <summary>
|
||||
/// 是否这在攻击无人机
|
||||
/// </summary>
|
||||
public bool isLasing = false;
|
||||
public bool isLasing = false;//判断看向无人机
|
||||
public bool isLasings = false;//判断时候需要攻击
|
||||
public GameObject LaserModer;
|
||||
public GameObject LaserPoint;
|
||||
public Transform targetPoint; // 锁定目标点的Transform组件
|
||||
|
@ -111,16 +130,20 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// <summary>
|
||||
/// 显示十字准星开关
|
||||
/// </summary>
|
||||
public bool Front=true;
|
||||
public bool Front = true;
|
||||
/// <summary>
|
||||
/// 点击空白处碰撞器
|
||||
/// </summary>
|
||||
public GameObject Detection;
|
||||
/// <summary>
|
||||
/// 接收检测到的无人机位置
|
||||
/// </summary>
|
||||
public Transform Receivingposin;
|
||||
void Start()
|
||||
{
|
||||
equipmentCommon = GetComponent<EquipmentCommon>();
|
||||
laserFireControlPlatformMangers.Add(this);
|
||||
Camera =transform.GetChild(1).GetComponent<Camera>();
|
||||
Camera = transform.GetChild(1).GetComponent<Camera>();
|
||||
//weaponitemones = Newtonsoft.Json.JsonConvert.DeserializeObject<Weaponitemone>(msg);
|
||||
//FillInTheData(weaponitemones);//测试写入
|
||||
// 订阅布尔值变化事件
|
||||
|
@ -135,8 +158,9 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
InnerLaserlineRenderer.positionCount = 2; // 设置线段的端点数量为2
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(1, LaserPoint.transform.position); // 设置线段终点为目标点
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
GameObject _OuterLaserlineRenderer = Instantiate(OuterLaserlineRendererPrefab);
|
||||
_OuterLaserlineRenderer.transform.position = Vector3.zero;
|
||||
|
@ -161,24 +185,75 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
Front = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 导条变化调用
|
||||
/// 开启暂停激光发射武器
|
||||
/// </summary>
|
||||
/// <param name="newValue"></param>
|
||||
void OnActivationChangedHandler(bool newValue)
|
||||
void OnActivationChangedHandler(bool bos)
|
||||
{
|
||||
if (newValue)
|
||||
if (bos)
|
||||
{
|
||||
Debug.Log("导条开启时调用");
|
||||
Debug.LogError("开启协程");
|
||||
starttimer();
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("导条暂停时调用");
|
||||
Debug.LogError("暂停协程");
|
||||
stoptimer();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 开启协程
|
||||
/// </summary>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private void starttimer()
|
||||
{
|
||||
if (equipmentCommon.isPlayer && coroutinetime == null)
|
||||
{
|
||||
coroutinetime = StartCoroutine(Timer());
|
||||
islaser = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 关闭协程
|
||||
/// </summary>
|
||||
private void stoptimer()
|
||||
{
|
||||
if (equipmentCommon.isPlayer && coroutinetime != null)
|
||||
{
|
||||
StopCoroutine(coroutinetime);
|
||||
islaser = false;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 协程
|
||||
/// </summary>
|
||||
IEnumerator Timer()
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
yield return new WaitForSeconds(timepiece);
|
||||
if (timepiece!=0)
|
||||
{
|
||||
Laserattack();
|
||||
}
|
||||
}
|
||||
}
|
||||
void LateUpdate()
|
||||
{
|
||||
////激光发射的方法
|
||||
//Laserattack();
|
||||
if (isLasings == true)
|
||||
{
|
||||
CastRayAndRender();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#region 创建场景激光发射
|
||||
|
||||
/// <summary>
|
||||
|
@ -193,12 +268,16 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
{
|
||||
case "储能间隔时间:":
|
||||
StorageIntervalTime = weaponitemone[i].para_value;
|
||||
Debug.LogError("打击间隔时间:" + StorageIntervalTime);
|
||||
//timepiece = float.Parse(StorageIntervalTime);
|
||||
break;
|
||||
case "毁伤目标累积作用时间:":
|
||||
CumulativeActionTimeOfDamageTarget = weaponitemone[i].para_value;
|
||||
break;
|
||||
case "干扰距离:":
|
||||
InterferenceDistance = weaponitemone[i].para_value;
|
||||
Debug.LogError(InterferenceDistance);
|
||||
Receivingdistance = float.Parse(InterferenceDistance) * 1000;
|
||||
break;
|
||||
case "干扰角度:":
|
||||
InterferenceAngle = weaponitemone[i].para_value;
|
||||
|
@ -210,18 +289,57 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 发射激光
|
||||
/// 激光发起攻击
|
||||
/// </summary>
|
||||
public void Laserattack()
|
||||
{
|
||||
if (Receivingdistance > 0)
|
||||
{
|
||||
Collider[] colliders = Physics.OverlapSphere(transform.position, Receivingdistance);//检查是否在打击的范围内
|
||||
Debug.LogError("范围打击距离:" + Receivingdistance);
|
||||
for (int i = 0; i < colliders.Length; i++)
|
||||
{
|
||||
if (colliders[i].gameObject.tag == "WRJ")
|
||||
{
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = null;
|
||||
if (colliders[i].GetComponent<UnmannedAerialVehicle>())
|
||||
{
|
||||
unmannedAerialVehicle = colliders[i].GetComponent<UnmannedAerialVehicle>();
|
||||
}
|
||||
if (unmannedAerialVehicle != null)
|
||||
{
|
||||
Vector3 Angle = unmannedAerialVehicle.transform.position - transform.position;
|
||||
float Angle1 = Vector3.Angle(Angle, transform.forward);
|
||||
Debug.LogError("角度大小:" + Angle1);
|
||||
if (float.Parse(InterferenceAngle) >= Angle1)
|
||||
{
|
||||
Debug.LogError("角度没有问题进来了" + InterferenceAngle);
|
||||
Debug.Log("计时器的时间:" + timepiece);
|
||||
Receivingposin = unmannedAerialVehicle.transform;
|
||||
isLasings = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 看向无人机
|
||||
/// </summary>
|
||||
public void Lasing()
|
||||
{
|
||||
if (targetPoint != null)
|
||||
if (targetPoint != null)
|
||||
{
|
||||
LaserModer.transform.DOLookAt(targetPoint.position, 0.5f).OnComplete(()=> {
|
||||
Debug.Log("目标点位..:"+targetPoint.position);
|
||||
CastRayAndRender();
|
||||
LaserModer.transform.DOLookAt(targetPoint.position, 0.1f).OnComplete(() =>
|
||||
{
|
||||
Debug.Log("目标点位..:" + targetPoint.position);
|
||||
isLasing = false;
|
||||
//CastRayAndRender();
|
||||
});
|
||||
var nowData = GetSyncData();
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
//var nowData = GetSyncData();
|
||||
//_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -233,32 +351,32 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// </summary>
|
||||
public void Crosshair()
|
||||
{
|
||||
if (targetPoint !=null)
|
||||
if (targetPoint != null)
|
||||
{
|
||||
Camera.transform.DOLookAt(targetPoint.position,0.5f).SetEase(Ease.Linear);
|
||||
Camera.transform.DOLookAt(targetPoint.position, 0.1f).SetEase(Ease.Linear);
|
||||
isLasing = false;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("没有目标出现");
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 激光显示
|
||||
/// </summary>
|
||||
public void CastRayAndRender()
|
||||
{
|
||||
var nowData = GetSyncData();
|
||||
_ = SyncCreateRoom.SendMessageAsync(string.Format("send2room {0}", nowData));
|
||||
if (InnerLaserlineRenderer)
|
||||
{
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(1, targetPoint.position); // 设置线段终点为目标点
|
||||
InnerLaserlineRenderer.SetPosition(1, Receivingposin.position); // 设置线段终点为目标点
|
||||
}
|
||||
if (OuterLaserlineRenderer)
|
||||
{
|
||||
OuterLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
OuterLaserlineRenderer.SetPosition(1, targetPoint.position); // 设置线段终点为目标点
|
||||
OuterLaserlineRenderer.SetPosition(1, Receivingposin.position); // 设置线段终点为目标点
|
||||
}
|
||||
StrikeDrone(targetPoint.transform);
|
||||
StrikeDrone(Receivingposin);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -274,6 +392,46 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
StartCoroutine(LaserExtinction());
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 激光打击位置未打中
|
||||
/// </summary>
|
||||
public void Lasering()
|
||||
{
|
||||
if (targetPoint != null)
|
||||
{
|
||||
targetPoint.position = new Vector3(targetPoint.position.x + 5, targetPoint.position.y, transform.position.z);
|
||||
LaserModer.transform.DOLookAt(targetPoint.position, 0.5f);
|
||||
CastRayAndRender1();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 十字准星架为打中视角
|
||||
/// </summary>
|
||||
public void Crosshair1()
|
||||
{
|
||||
if (targetPoint != null)
|
||||
{
|
||||
targetPoint.position = new Vector3(targetPoint.position.x + 5, targetPoint.position.y, transform.position.z);
|
||||
Camera.transform.DOLookAt(targetPoint.position, 0.1f).SetEase(Ease.Linear);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 激光显示为打中
|
||||
/// </summary>
|
||||
public void CastRayAndRender1()
|
||||
{
|
||||
if (InnerLaserlineRenderer)
|
||||
{
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(1, targetPoint.position); // 设置线段终点为目标点
|
||||
}
|
||||
if (OuterLaserlineRenderer)
|
||||
{
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(1, targetPoint.position); // 设置线段终点为目标点
|
||||
}
|
||||
StartCoroutine(LaserExtinction());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 销毁单体无人机
|
||||
|
@ -312,7 +470,8 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
WWWForm wWWForm = new WWWForm();
|
||||
wWWForm.AddField("data", uploadLogMainJson);
|
||||
Debug.Log(uploadLogMainJson);
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data => {
|
||||
StartCoroutine(PostString(Url_Addpracticelog, wWWForm, data =>
|
||||
{
|
||||
Debug.Log(data);
|
||||
}));
|
||||
}
|
||||
|
@ -343,7 +502,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
OuterLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
OuterLaserlineRenderer.SetPosition(1, LaserPoint.transform.position); // 设置线段终点为目标点
|
||||
}
|
||||
isLasing = false;
|
||||
isLasings = false;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -355,8 +514,8 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// <returns></returns>
|
||||
protected string GetSyncData()
|
||||
{
|
||||
Debug.Log("目标点位..:" + targetPoint.position);
|
||||
return string.Format("{0},{1},{2},{3},{4}", "Lasing", equipmentCommon.deviceID, targetPoint.position.x, targetPoint.position.y, targetPoint.position.z);
|
||||
Debug.Log("目标点位..:" + Receivingposin.position);
|
||||
return string.Format("{0},{1},{2},{3},{4}", "Lasing", equipmentCommon.deviceID, Receivingposin.position.x, Receivingposin.position.y, Receivingposin.position.z);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -366,10 +525,11 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
public void NonSelfGeneratedEmissionLaser(string[] data)
|
||||
{
|
||||
Vector3 vector3 = new Vector3(float.Parse(data[2]), float.Parse(data[3]), float.Parse(data[4]));
|
||||
LaserModer.transform.DOLookAt(vector3, 0.1f).OnComplete(() => {
|
||||
LaserModer.transform.DOLookAt(vector3, 0.1f).OnComplete(() =>
|
||||
{
|
||||
if (InnerLaserlineRenderer)
|
||||
{
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(0, LaserPoint.transform.position); // 设置线段起点为物体位置
|
||||
InnerLaserlineRenderer.SetPosition(1, vector3); // 设置线段终点为目标点
|
||||
}
|
||||
if (OuterLaserlineRenderer)
|
||||
|
@ -385,7 +545,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// </summary>
|
||||
public void OnMouseEnter()
|
||||
{
|
||||
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId)!="0")
|
||||
if (UIBootstrap.Instance.GetRoleByIDPracticeId(GlobalFlag.practiceSeatId) != "0")
|
||||
{
|
||||
Transform Canvas = GameObject.Find("Canvas").transform;
|
||||
if (Canvas && Front)
|
||||
|
@ -400,7 +560,7 @@ public class LaserFireControlPlatformManger : MonoBehaviour
|
|||
/// </summary>
|
||||
public void OnMouseExit()
|
||||
{
|
||||
Front =false;
|
||||
Front = false;
|
||||
}
|
||||
private void OnDestroy()
|
||||
{
|
||||
|
|
|
@ -136,7 +136,7 @@ public class RadarManger : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
RetrievalUAV();//看向无人机
|
||||
}
|
||||
#region 启动暂停
|
||||
/// <summary>
|
||||
|
@ -164,7 +164,7 @@ public class RadarManger : MonoBehaviour
|
|||
{
|
||||
//Debug.Log("Timer fired at: " + Time.time);
|
||||
yield return new WaitForSeconds(interval); // 等待一段时间后继续执行
|
||||
RetrievalUAV();
|
||||
//RetrievalUAV();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -175,11 +175,11 @@ public class RadarManger : MonoBehaviour
|
|||
{
|
||||
if (equipmentCommon.isPlayer && timerCoroutine == null)
|
||||
{
|
||||
timerCoroutine = StartCoroutine(Timer());
|
||||
//timerCoroutine = StartCoroutine(Timer());
|
||||
isTimerRunning = true;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// <summary>s
|
||||
/// 停止
|
||||
/// </summary>
|
||||
public void StopTimer()
|
||||
|
@ -294,28 +294,25 @@ public class RadarManger : MonoBehaviour
|
|||
Mincamera.orthographicSize = detectionRadius;
|
||||
if (colliders2.Count > 0)
|
||||
{
|
||||
if (Random.value > (1 - float.Parse(DetectionSuccessRate) / 100))
|
||||
for (int i = 0; i < colliders2.Count; i++)
|
||||
{
|
||||
for (int i = 0; i < colliders2.Count; i++)
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = colliders2[i].GetComponent<UnmannedAerialVehicle>();
|
||||
if (unmannedAerialVehicle)
|
||||
{
|
||||
UnmannedAerialVehicle unmannedAerialVehicle = colliders2[i].GetComponent<UnmannedAerialVehicle>();
|
||||
if (unmannedAerialVehicle)
|
||||
LaserFireControlPlatformManger laserFireControlPlatformManger = LaserFireControlPlatformManger.laserFireControlPlatformMangers.Find(x => (x != null && x.isLasing == false));
|
||||
if (laserFireControlPlatformManger)
|
||||
{
|
||||
LaserFireControlPlatformManger laserFireControlPlatformManger = LaserFireControlPlatformManger.laserFireControlPlatformMangers.Find(x => (x != null && x.isLasing == false));
|
||||
if (laserFireControlPlatformManger)
|
||||
{
|
||||
laserFireControlPlatformManger.isLasing = true;
|
||||
Debug.Log(laserFireControlPlatformManger.transform.name + "攻击无人机: " + unmannedAerialVehicle.transform.name);
|
||||
laserFireControlPlatformManger.targetPoint = unmannedAerialVehicle.transform;
|
||||
laserFireControlPlatformManger.Crosshair();
|
||||
laserFireControlPlatformManger.Lasing();
|
||||
}
|
||||
number++;
|
||||
laserFireControlPlatformManger.isLasing=true;
|
||||
//Debug.Log(laserFireControlPlatformManger.transform.name + "攻击无人机: " + unmannedAerialVehicle.transform.name);
|
||||
laserFireControlPlatformManger.targetPoint = unmannedAerialVehicle.transform;
|
||||
laserFireControlPlatformManger.Crosshair();
|
||||
laserFireControlPlatformManger.Lasing();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
number++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue