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.
35 lines
865 B
35 lines
865 B
3 years ago
|
using AX.NetworkSystem;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using AX.Network.Protocols;
|
||
|
using System;
|
||
|
using AX.Serialization;
|
||
|
|
||
|
public class ObjectDeleteSync : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start ()
|
||
|
{
|
||
|
NetworkMessageDispatcher.AddListener("DELETE_SYNC", ObjDeleted);
|
||
|
}
|
||
|
private void OnDestroy()
|
||
|
{
|
||
|
NetworkMessageDispatcher.RemoveListener("DELETE_SYNC", ObjDeleted);
|
||
|
}
|
||
|
|
||
|
private void ObjDeleted(BinaryMessage obj)
|
||
|
{
|
||
|
var deleteID = obj.Body.Deserialize<long>();
|
||
|
var gameObjectID = GetComponent<BaseGameObjInfo>().GameObjID;
|
||
|
if (deleteID == gameObjectID)
|
||
|
{
|
||
|
EntitiesManager.Instance.DeleteObj(gameObject);
|
||
|
}
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
}
|