// Token: 0x0600129A RID: 4762 RVA: 0x0005B1D9 File Offset: 0x000593D9
        public static OnDestroyCallback AddCallback(GameObject gameObject, Action <OnDestroyCallback> callback)
        {
            OnDestroyCallback onDestroyCallback = gameObject.AddComponent <OnDestroyCallback>();

            onDestroyCallback.callback = callback;
            return(onDestroyCallback);
        }
Exemple #2
0
        // Token: 0x06001783 RID: 6019 RVA: 0x0006F578 File Offset: 0x0006D778
        public override void OnServerTeleporterPlaced(SceneDirector sceneDirector, GameObject teleporter)
        {
            base.OnServerTeleporterPlaced(sceneDirector, teleporter);
            DirectorPlacementRule directorPlacementRule = new DirectorPlacementRule();

            directorPlacementRule.placementMode = DirectorPlacementRule.PlacementMode.Random;
            int num = 0;

            while ((long)num < (long)((ulong)this.crystalCount))
            {
                GameObject gameObject = DirectorCore.instance.TrySpawnObject(this.crystalSpawnCard, directorPlacementRule, this.stageRng);
                if (gameObject)
                {
                    DeathRewards component3 = gameObject.GetComponent <DeathRewards>();
                    if (component3)
                    {
                        component3.goldReward = this.crystalRewardValue;
                    }
                }
                this.crystalActiveList.Add(OnDestroyCallback.AddCallback(gameObject, delegate(OnDestroyCallback component)
                {
                    this.crystalActiveList.Remove(component);
                }));
                num++;
            }
            if (TeleporterInteraction.instance)
            {
                ChildLocator component2 = TeleporterInteraction.instance.GetComponent <ModelLocator>().modelTransform.GetComponent <ChildLocator>();
                if (component2)
                {
                    component2.FindChild("TimeCrystalProps").gameObject.SetActive(true);
                    component2.FindChild("TimeCrystalBeaconBlocker").gameObject.SetActive(true);
                }
            }
        }
Exemple #3
0
        public void AddMember(CharacterMaster memberMaster)
        {
            if (!NetworkServer.active)
            {
                Debug.LogWarning("[Server] function 'System.Void RoR2.CombatSquad::AddMember(RoR2.CharacterMaster)' called on client");
                return;
            }
            if (this.membersList.Count >= 255)
            {
                Debug.LogFormat("Cannot add character {0} to CombatGroup! Limit of {1} members already reached.", new object[]
                {
                    memberMaster,
                    byte.MaxValue
                });
                return;
            }
            this.membersList.Add(memberMaster);
            base.SetDirtyBit(1U);
            this.onDestroyCallbacksServer.Add(OnDestroyCallback.AddCallback(memberMaster.gameObject, new Action <OnDestroyCallback>(this.OnMemberDestroyedServer)));
            Action <CharacterMaster> action = this.onMemberAddedServer;

            if (action != null)
            {
                action(memberMaster);
            }
            Action <CharacterMaster> action2 = this.onMemberDiscovered;

            if (action2 == null)
            {
                return;
            }
            action2(memberMaster);
        }
Exemple #4
0
 public void OnMemberDestroyed(OnDestroyCallback onDestroyCallback)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.BossGroup::OnMemberDestroyed(RoR2.OnDestroyCallback)' called on client");
         return;
     }
     if (onDestroyCallback)
     {
         GameObject      gameObject      = onDestroyCallback.gameObject;
         CharacterMaster characterMaster = gameObject ? gameObject.GetComponent <CharacterMaster>() : null;
         if (characterMaster)
         {
             this.membersList.Remove(characterMaster);
         }
     }
 }
Exemple #5
0
 public void AddMember(CharacterMaster memberMaster)
 {
     if (!NetworkServer.active)
     {
         Debug.LogWarning("[Server] function 'System.Void RoR2.BossGroup::AddMember(RoR2.CharacterMaster)' called on client");
         return;
     }
     if (this.membersList.Count >= 255)
     {
         Debug.LogFormat("Cannot add character {0} to BossGroup! Limit of {1} members already reached.", new object[]
         {
             memberMaster,
             byte.MaxValue
         });
         return;
     }
     this.membersList.Add(memberMaster);
     memberMaster.isBoss           = true;
     BossGroup.totalBossCountDirty = true;
     base.SetDirtyBit(1u);
     this.onDestroyCallbacks.Add(OnDestroyCallback.AddCallback(memberMaster.gameObject, new Action <OnDestroyCallback>(this.OnMemberDestroyed)));
     Run.instance.OnServerBossAdded(this, memberMaster);
 }
 // Token: 0x0600129B RID: 4763 RVA: 0x0005B1E8 File Offset: 0x000593E8
 public static void RemoveCallback(OnDestroyCallback callbackComponent)
 {
     callbackComponent.callback = null;
     UnityEngine.Object.Destroy(callbackComponent);
 }