public virtual void SendGObj(bool type, Packet packet, GObj gobj) { lock (gobj.m_lock) { _sightGObj obj = new _sightGObj { Object = this, Seen = false }; int idx = gobj.m_inSightGObjList.IndexOf(obj); if (idx != -1) { if (type) { obj.Seen = true; gobj.m_inSightGObjList[idx] = obj; OnEnterVisibility(gobj); gobj.OnEnterVisibility(this); } else { gobj.m_inSightGObjList.RemoveAt(idx); OnLeaveVisibility(gobj); gobj.OnLeaveVisibility(this); } } } }
public bool InSight(GObj obj) { lock (m_lock) { return(m_inSightGObjList.Exists(p => p.Object.m_uniqueId == obj.m_uniqueId)); } }
public GObj(GObjType type) { m_type = type; m_inSightGObjList = new List <_sightGObj>(); m_position = new Vector3(); m_movementTimer = new AsyncTimer(MovementTimer_Callback); m_disapperTimer = new AsyncTimer(DisappearTimer_Callback); m_selectedGObj = null; m_buffs = new _buff_item[10]; for (int i = 0; i < m_buffs.Length; i++) { m_buffs[i].IsFree = true; } m_rnd = new Random(); m_lock = new object(); m_lastEmoteTick = Environment.TickCount; }
public bool TryRemoveSightList(GObj obj) { lock (m_lock) { for (int i = 0; i < m_inSightGObjList.Count; i++) { var sight_obj = m_inSightGObjList[i]; if (sight_obj.Object.m_uniqueId == obj.m_uniqueId && sight_obj.Seen) { sight_obj.Seen = false; m_inSightGObjList[i] = sight_obj; return(true); } } } return(false); }
public bool TryAddSightList(GObj obj) { lock (m_lock) { if (!InSight(obj)) { var sight_item = new _sightGObj { Object = obj, Seen = false }; if (obj.IsCharacter) { sight_item.PacketQueue = new Queue <Packet>(); } m_inSightGObjList.Add(sight_item); return(true); } } return(false); }
public virtual void OnLeaveVisibility(GObj obj) { // }
public virtual void OnEnterVisibility(GObj obj) { // }