Exemple #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);
            }
        }
 public void ApplyDamage(float damage)
 {
     if (this.currentHealth > 0f)
     {
         this.currentHealth -= damage;
         if (this.theCombatSystem.onPlayerDamaged != null)
         {
             this.theCombatSystem.onPlayerDamaged(base.GetComponent <VRC_PlayerApi>());
         }
         if (this.theCombatSystem.onPlayerDamagedTrigger != null)
         {
             VRC_Trigger.TriggerCustom(this.theCombatSystem.onPlayerDamagedTrigger);
         }
         if (this.currentHealth <= 0f)
         {
             this.currentHealth = 0f;
             if (this.DeathCoroutine == null)
             {
                 this.DeathCoroutine = base.StartCoroutine(this.Die());
             }
             if (this.theCombatSystem.onPlayerKilledTrigger != null)
             {
                 VRC_Trigger.TriggerCustom(this.theCombatSystem.onPlayerKilledTrigger);
             }
         }
         this.localVisualDamage.SetDamagePercent(1f - this.currentHealth / this.maxHealth);
     }
 }
Exemple #3
0
 // Token: 0x06004DA2 RID: 19874 RVA: 0x001A0D28 File Offset: 0x0019F128
 private void OnTimerDone()
 {
     if (VRC.Network.IsMaster && this.onTimerDoneTrigger != null && !string.IsNullOrEmpty(this.onTimerDoneEvent.ParameterString))
     {
         VRC_Trigger.TriggerCustom(this.onTimerDoneTrigger.gameObject, this.onTimerDoneEvent.ParameterString);
     }
     if (this.resetAndStopTimerWhenDone)
     {
         this.ResetTimer();
         this.StopTimer();
         if (this.repeat)
         {
             this.StartTimer();
         }
     }
 }
Exemple #4
0
        public static void SetupCombat()
        {
            VRCSDK2.VRC_CombatSystem combatSystem = FindObjectOfType <VRCSDK2.VRC_CombatSystem>();
            if (combatSystem != null)
            {
                combatSystem.gameObject.AddComponent <CyanEmuCombatSystemHelper>();

                CyanEmuCombatSystemHelper.CombatSetMaxHitpoints(null, combatSystem.maxPlayerHealth);
                CyanEmuCombatSystemHelper.CombatSetRespawn(null, combatSystem.respawnOnDeath, combatSystem.respawnTime, combatSystem.respawnPoint);
                CyanEmuCombatSystemHelper.CombatSetDamageGraphic(null, combatSystem.visualDamagePrefab);

                CyanEmuCombatSystemHelper.CombatSetActions(
                    () => VRC_Trigger.TriggerCustom(combatSystem.onPlayerDamagedTrigger),
                    () => VRC_Trigger.TriggerCustom(combatSystem.onPlayerKilledTrigger),
                    () => VRC_Trigger.TriggerCustom(combatSystem.onPlayerHealedTrigger)
                    );
            }
        }
 public void ApplyHealing(float healing)
 {
     if (this.currentHealth < this.maxHealth)
     {
         this.currentHealth += healing;
         if (this.theCombatSystem.onPlayerHealed != null)
         {
             this.theCombatSystem.onPlayerHealed(base.GetComponent <VRC_PlayerApi>());
         }
         if (this.theCombatSystem.onPlayerHealedTrigger != null)
         {
             VRC_Trigger.TriggerCustom(this.theCombatSystem.onPlayerHealedTrigger);
         }
         if (this.currentHealth >= this.maxHealth)
         {
             this.currentHealth = this.maxHealth;
         }
     }
     this.localVisualDamage.SetDamagePercent(1f - this.currentHealth / this.maxHealth);
 }
Exemple #6
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);
            }
        }
 public void OnStationExit(VRC.SDKBase.VRCStation station)
 {
     VRC_Trigger.TriggerCustom((station as VRCSDK2.VRC_Station).OnLocalPlayerExitStation);
     Trigger.ExecuteTriggerType(VRC_Trigger.TriggerType.OnStationExited);
 }