Skip to content

Commit

Permalink
Fix for new SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
GotoFinal committed May 12, 2020
1 parent 4b5b2d8 commit 03a33b5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 69 deletions.
4 changes: 2 additions & 2 deletions Assets/GotoUdon/Editor/GotoUdonEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

public class GotoUdonEditor : EditorWindow
{
public const string VERSION = "v1.1.2";
public const string ImplementedSDKVersion = "2020.04.25.12.49";
public const string VERSION = "v1.1.3";
public const string ImplementedSDKVersion = "2020.05.06.12.14";
public static string CurrentSDKVersion => VRC.Core.SDKClientUtilities.GetSDKVersionDate();

[MenuItem("Window/GotoUdon/Debugger Tools")]
Expand Down
3 changes: 3 additions & 0 deletions Assets/GotoUdon/Editor/UpdaterEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ private void DrawSdkUpdateComponent()
string newestSdkVersion = NormalizeVrChatSDKVersion(releaseInfo.Version);
string currentSdkVersion = NormalizeVrChatSDKVersion(GotoUdonEditor.CurrentSDKVersion);

// I give up
if (currentSdkVersion.EndsWith("05.06") && newestSdkVersion.EndsWith("05.12")) return;

if (releaseInfo.UnityPackage != null &&
SimpleGUI.InfoBox(
VersionUtils.IsRightNewerThanLeft(currentSdkVersion, newestSdkVersion),
Expand Down
67 changes: 2 additions & 65 deletions Assets/GotoUdon/VRC/VRCDestructible.cs
Original file line number Diff line number Diff line change
@@ -1,71 +1,8 @@
using System;
using UnityEngine;
using VRC.SDKBase;
using VRC.SDKBase;

namespace GotoUdon.VRC
{
public class VRCDestructible : MonoBehaviour, IVRC_Destructible
public class VRCDestructible : VRC_DestructibleStandard
{
private VRC_CombatSystem _vrcCombatSystem;
public float maxHealth;
public float currentHealth;
public object[] state;
private VRCPlayer _vrcPlayer;
private bool _setup = false;

public void Setup()
{
state = new object[0];
_vrcCombatSystem = VRC_CombatSystem.GetInstance();
maxHealth = _vrcCombatSystem.maxPlayerHealth;
currentHealth = _vrcCombatSystem.maxPlayerHealth;
SimulatedVRCPlayer simulatedVrcPlayer = GetComponent<SimulatedVRCPlayer>();
if (simulatedVrcPlayer != null)
{
_vrcPlayer = simulatedVrcPlayer.VRCPlayer;
_vrcCombatSystem.onSetupPlayer(_vrcPlayer);
}
}

public object[] GetState()
{
return state;
}

public void SetState(object[] state)
{
this.state = state;
}

public float GetMaxHealth()
{
return maxHealth;
}

public float GetCurrentHealth()
{
return currentHealth;
}

public void ApplyDamage(float damage)
{
if (!_setup) return;
currentHealth -= damage;
if (_vrcPlayer != null)
{
_vrcCombatSystem.onPlayerDamaged(_vrcPlayer);
if (currentHealth <= 0)
{
_vrcCombatSystem.onPlayerKilled(_vrcPlayer);
}
}
}

public void ApplyHealing(float healing)
{
if (!_setup) return;
currentHealth = Math.Min(currentHealth + healing, maxHealth);
_vrcCombatSystem.onPlayerHealed(_vrcPlayer);
}
}
}
2 changes: 0 additions & 2 deletions Assets/GotoUdon/VRC/VRCPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,6 @@ private static void CombatSetup(VRCPlayer player)
{
vrcDestructible = player.gameObject.AddComponent<VRCDestructible>();
}

vrcDestructible.Setup();
}

private static float GetGravityStrength(VRCPlayer player)
Expand Down

0 comments on commit 03a33b5

Please sign in to comment.