海淀天下城电子沙盘单机版
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.
 
 
 
 

45 lines
1.2 KiB

using AX.InputSystem;
using AX.MessageSystem;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CloneRanging : MonoBehaviour
{
public GameObject clonePrefab;//绑定的预制体
public CloneObjType cloneObjType;//克隆类型
protected int number = 0;//计数
public string ResourcesName;
[HideInInspector]
public GameObject cloneObj;//克隆出的物体
void OnEnable()
{
MessageDispatcher.AddListener("CLONE_COMMAND", Execute);
}
void OnDisable()
{
MessageDispatcher.RemoveListener("CLONE_COMMAND", Execute);
}
void OnDestroy()
{
MessageDispatcher.RemoveListener("CLONE_COMMAND", Execute);
}
private void Execute(IMessage obj)
{
var gameObjID = (long)obj.Sender;
var data = ((CloneCmdArgs)obj.Data);
if (data.cloneObjType == cloneObjType)
{
var hitPoint = data.hitPos;
var HitID = data.gameObjID;
this.GetComponent<RangingLineType>().DrawLineOperation(hitPoint, HitID, gameObjID);
}
else
{
this.GetComponent<RangingLineType>().ResetData();
}
}
}