public override void Postspawn(EnemyAgent agent) { var onDetectionSpawn = new Action <EnemyAgent, ScoutAntennaDetection>((EnemyAgent eventAgent, ScoutAntennaDetection detection) => { if (eventAgent.GlobalID == agent.GlobalID) { OnDetectionSpawn(eventAgent, detection); } }); var onAntennaSpawn = new Action <EnemyAgent, ScoutAntennaDetection, ScoutAntenna>((EnemyAgent eventAgent, ScoutAntennaDetection detection, ScoutAntenna ant) => { if (eventAgent.GlobalID == agent.GlobalID) { OnAntennaSpawn(eventAgent, detection, ant); } }); ScoutAntennaSpawnEvent.OnDetectionSpawn += onDetectionSpawn; ScoutAntennaSpawnEvent.OnAntennaSpawn += onAntennaSpawn; agent.add_OnDeadCallback(new Action(() => { ScoutAntennaSpawnEvent.OnDetectionSpawn -= onDetectionSpawn; ScoutAntennaSpawnEvent.OnAntennaSpawn -= onAntennaSpawn; })); }
public override void Postspawn(EnemyAgent agent) { var id = agent.GlobalID; if (id == ushort.MaxValue) { return; } if (!_EnemyList.Contains(id)) { _EnemyList.Add(id); agent.add_OnDeadCallback(new Action(() => { OnDead(id); })); } }
public static void RegisterOnMarked(EnemyAgent agent, Action <EnemyAgent, NavMarker> onMarked) { var id = agent.GlobalID; var onMarkedWrapper = new Action <EnemyAgent, NavMarker>((EnemyAgent eventAgent, NavMarker mark) => { if (eventAgent.GlobalID == id) { onMarked?.Invoke(eventAgent, mark); } }); OnMarked += onMarkedWrapper; agent.add_OnDeadCallback(new Action(() => { OnMarked -= onMarkedWrapper; })); }
public void Awake() { enemyAgent = GetComponent <EnemyAgent>(); exploderConfig = ConfigManager.ExploderConfigDictionary[enemyAgent.EnemyDataID]; glowColor = Util.GetUnityColor(exploderConfig.ColorData); enemyAgent.MaterialHandler.m_defaultGlowColor = glowColor; if (staticValuesLoaded == false) { s_explodeFXPool = FX_Manager.GetPreloadedEffectPool("FX_InfectionSpit"); staticValuesLoaded = true; } enemyAgent.add_OnDeadCallback((Action)(() => { Explode(); })); }