You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
76 lines
1.9 KiB
76 lines
1.9 KiB
4 years ago
|
using AX.InputSystem;
|
||
|
using AX.MessageSystem;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using AX.NetworkSystem;
|
||
|
|
||
|
public class SafeAreaMessage : MonoBehaviour {
|
||
|
|
||
|
public float sideLength = 20;//安全区边长
|
||
|
private bool flag;
|
||
|
public int hasWounderNum=0;
|
||
|
|
||
|
public int HasWounderNum
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return hasWounderNum;
|
||
|
}
|
||
|
|
||
|
set
|
||
|
{
|
||
|
hasWounderNum = value;
|
||
|
SafeAreaWounderNumSyncData arg = new SafeAreaWounderNumSyncData();
|
||
|
arg.SendUserID = CurrentUserInfo.mySelf.Id;
|
||
|
arg.gameObjID = GetComponent<BaseGameObjInfo>().gameObjID;
|
||
|
arg.HasSaveNum = value;
|
||
|
NetworkManager.Default.SendAsync("SAVEAREA_WOUNDER_NUM_SYNC",arg);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
if (!CurrentUserInfo.generalCommanding)
|
||
|
{//如果从总指挥变为不是总指挥,取消之前安全区的选中,防止还能拖动,删除,旋转安全区
|
||
|
if (!flag)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("CANCEL_SELECTED_COMMAND", new CmdArgs());
|
||
|
flag = true;
|
||
|
}
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
flag = false;
|
||
|
}
|
||
|
}
|
||
|
/// <summary>
|
||
|
/// 根据已经营救伤员数量或者偏移量
|
||
|
/// </summary>
|
||
|
/// <param name="num"></param>
|
||
|
/// <returns></returns>
|
||
|
public Vector3 GetoffestPos(int num)
|
||
|
{
|
||
|
Vector3 pos = Vector3.zero;
|
||
|
if (num > 49 || num < 0)
|
||
|
{
|
||
|
pos = Vector3.zero;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
int tens = Mathf.FloorToInt(num/10);
|
||
|
int units = num - tens;
|
||
|
//z与行数线性相关
|
||
|
float z = 2 * tens - 4f;
|
||
|
float x = (-1) * units + 4.5f;
|
||
|
pos = new Vector3(2*x,0.25f,2*z);
|
||
|
}
|
||
|
return pos;
|
||
|
}
|
||
|
}
|