添加组代码

This commit is contained in:
YangHua 2024-02-20 23:58:42 +08:00
parent db416cbfd5
commit f2877ee0ee
4 changed files with 22 additions and 5 deletions

View File

@ -1 +1 @@
172.16.1.254:48888 127.0.0.1:48888

View File

@ -1 +1 @@
172.16.1.156 127.0.0.1

View File

@ -1,6 +1,7 @@
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI; using UnityEngine.UI;
/// <summary> /// <summary>
@ -11,7 +12,7 @@ public class FormationManager : MonoBehaviour
public Button startFormationBtn; public Button startFormationBtn;
public Button submitFormationBtn; public Button submitFormationBtn;
public bool isStartFormation; public bool isStartFormation;
public List<UnmannedAerialVehicleManage> uavm = new List<UnmannedAerialVehicleManage>();
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -24,9 +25,21 @@ public class FormationManager : MonoBehaviour
{ {
if (isStartFormation) if (isStartFormation)
{ {
if (Input.GetKeyDown(KeyCode.LeftControl) && Input.GetMouseButtonDown(0)) if (Input.GetKey(KeyCode.LeftControl) && Input.GetMouseButtonDown(0))
{ {
Debug.Log("拾取"); if (EventSystem.current.IsPointerOverGameObject()) return;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hitInfo;
if (Physics.Raycast(ray, out hitInfo, 1000))
{
if (hitInfo.collider.gameObject.tag == "WRJ")
{
if (!uavm.Contains(hitInfo.collider.gameObject.GetComponent<UnmannedAerialVehicleManage>()))
uavm.Add(hitInfo.collider.gameObject.GetComponent<UnmannedAerialVehicleManage>());
Debug.Log("拾取");
}
}
} }
} }
} }

View File

@ -14,6 +14,10 @@ public class EquipmentCommon : MonoBehaviour
{ {
public EquipmentCommon equipmentCommon; public EquipmentCommon equipmentCommon;
/// <summary> /// <summary>
/// 打组ID
/// </summary>
public string groupId;
/// <summary>
/// 场景所在方 /// 场景所在方
/// </summary> /// </summary>
public SelectedSide selectedSide = SelectedSide.Other; public SelectedSide selectedSide = SelectedSide.Other;