public static void Postfix(GameObject go) { // First disable entirely if not activated if (!DangerousWorldOptions.Instance.AggroCrittersOption) { return; } PositionMonitor.PositionMonitorLayer layer = PositionMonitor.Instance.Layer("DW_Minions"); if (layer == null) { PUtil.LogDebug("Null layer"); layer = PositionMonitor.Instance.AddLayer("DW_Minions"); } Debug.Assert(layer != null, "Minion layer is null"); PositionMonitor.Instance.Add(go, Grid.CellToXY(Grid.PosToCell(go)).x, Grid.CellToXY(Grid.PosToCell(go)).y, layer); }
public void SetMaster(GameObject master) { PUtil.LogDebug(("In set Master: {0}").F(master)); m_master = master; PositionMonitor.PositionMonitorLayer layer = PositionMonitor.Instance.Layer("DW_Hatches"); if (layer == null) { PUtil.LogDebug("Null layer"); layer = PositionMonitor.Instance.AddLayer("DW_Hatches"); } Debug.Assert(layer != null, "Hatch layer is null"); PUtil.LogDebug(("Layer: {0}").F(layer.m_name.ToString())); m_entry = PositionMonitor.Instance.Add(m_master, Grid.CellToXY(Grid.PosToCell(m_master)).x, Grid.CellToXY(Grid.PosToCell(m_master)).y, layer); //Singleton<CellChangeMonitor>.Instance.RegisterCellChangedHandler(this.transform, new System.Action(this.OnCellChange), "AggroCritter.SetMaster"); //m_master.Subscribe(1088554450, (System.Action<object>)((component) => { PUtil.LogDebug("In update position callback"); PositionMonitor.Instance.UpdatePosition(Grid.CellToXY(Grid.PosToCell(component as GameObject)).x, //Grid.CellToXY(Grid.PosToCell(component as GameObject)).y, //m_entry); //})); }