using System; using System.Collections.Generic; using System.Numerics; namespace ET { public class AoiNode:Entity { public Vector2 Position; public AoiInfo AoiInfo; public AoiLink Link; public AoiNode(){} public AoiNode Init(long id, float x, float y) { Id = id; Position = new Vector2(x, y); if (AoiInfo.MovesSet == null) AoiInfo.MovesSet = new HashSet(); if (AoiInfo.MoveOnlySet == null) AoiInfo.MoveOnlySet = new HashSet(); if (AoiInfo.EntersSet == null) AoiInfo.EntersSet = new HashSet(); if (AoiInfo.LeavesSet == null) AoiInfo.LeavesSet = new HashSet(); return this; } public void SetPosition(float x, float y) { Position.X = x; Position.Y = y; } public override void Dispose() { Id = 0; AoiPool.Instance.Recycle(Link.XNode); AoiPool.Instance.Recycle(Link.YNode); Link.XNode = null; Link.YNode = null; AoiInfo.MovesSet.Clear(); AoiInfo.MoveOnlySet.Clear(); AoiPool.Instance.Recycle(this); } } }