예제 #1
0
        // Token: 0x06004D44 RID: 19780 RVA: 0x0019E2B0 File Offset: 0x0019C6B0
        private void OnItemDestroyed(SpawnableObject so)
        {
            switch (this.spawnType)
            {
            case ObjectSpawner.SpawnType.OnDespawned:
                this.timer.ResetTimer();
                this.timer.StartTimer();
                break;

            case ObjectSpawner.SpawnType.OnPickedUp:
                if (this.mLastSpawnedObject != null)
                {
                    this.timer.ResetTimer();
                    this.timer.StartTimer();
                }
                break;
            }
            if (this.mLastSpawnedObject == so)
            {
                this.mLastSpawnedObject = null;
            }
            this.mSpawnedObjects.Remove(so);
            if (this.onObjectDespawnedTrigger != null && !string.IsNullOrEmpty(this.onObjectDespawnedEvent.ParameterString))
            {
                VRC_Trigger.TriggerCustom(this.onObjectDespawnedTrigger.gameObject, this.onObjectDespawnedEvent.ParameterString);
            }
        }
예제 #2
0
        private void SetupLastSpawnedObject(GameObject spawnedObject, VRC.Player instigator)
        {
            if (this.spawnType == ObjectSpawner.SpawnType.OnTimer)
            {
                this.timer.ResetTimer();
                this.timer.StartTimer();
            }
            else
            {
                this.timer.StopTimer();
                this.timer.ResetTimer();
            }
            this.mLastSpawnedObject = spawnedObject;
            if (this.mLastSpawnedObject.GetComponent <VRC_Pickup>() != null)
            {
                SpawnablePickup spawnablePickup = spawnedObject.AddComponent <SpawnablePickup>();
                spawnablePickup.SetupSpawnedObject(this.despawnType, this.despawnTime, this.autoDespawnDistance, new Action <SpawnablePickup>(this.OnItemPickedUp), null, new Action <SpawnableObject>(this.OnItemDestroyed), this);
            }
            else
            {
                SpawnableObject spawnableObject = spawnedObject.AddComponent <SpawnableObject>();
                spawnableObject.SetupSpawnedObject(this.despawnType, this.despawnTime, this.autoDespawnDistance, new Action <SpawnableObject>(this.OnItemDestroyed), this);
            }
            VRC_DestructibleStandard component = this.mLastSpawnedObject.GetComponent <VRC_DestructibleStandard>();

            if (component != null)
            {
                this.SetupDestructibleStandard(component);
            }
            SpawnableObject component2 = spawnedObject.GetComponent <SpawnableObject>();

            this.mSpawnedObjects.Add(component2);
            if (this.onItemSpawned != null)
            {
                this.onItemSpawned(spawnedObject);
            }
            if (this.onObjectSpawnedTrigger != null && !string.IsNullOrEmpty(this.onObjectSpawnedEvent.ParameterString))
            {
                VRC_Trigger.TriggerCustom(this.onObjectSpawnedTrigger.gameObject, this.onObjectSpawnedEvent.ParameterString);
            }
        }