//We wish to set the coordinates without triggering any Entry/Exit events protected void InitializeMapPosition() { Vector3 pos = BlockUtilities.GetMathematicalCoordinates(parentMap, eTransform.position); this.x = (int)pos.x; this.y = (int)pos.y; this.z = (int)pos.z; controller.ReserveBlock(entityType, new Vector3(x, y, z)); }
//We need to check if we have changed position public void UpdateMapPosition() { Vector3 pos = BlockUtilities.GetMathematicalCoordinates(parentMap, eTransform.position); //We temporarily store these values and will check against changes int t_x = (int)pos.x; int t_y = (int)pos.y; int t_z = (int)pos.z; //If our position has changed at all if (t_x != x || t_y != y || t_z != z) { HandleBlockExit(x, y, z); HandleBlockEntry(t_x, t_y, t_z); } }