private void Awake() { if (instance != null) { this.LogWarning("Duplicate combat system helper! " + VRC.Tools.GetGameObjectPath(gameObject)); DestroyImmediate(this); return; } instance = this; }
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) ); } }