added debug script to disable enemies
This commit is contained in:
@@ -31,6 +31,10 @@ namespace Beyond
|
||||
|
||||
public override void Awake()
|
||||
{
|
||||
#if ENEMIES_DISABLED && UNITY_EDITOR
|
||||
enabled = false;
|
||||
return;
|
||||
#endif
|
||||
base.Awake();
|
||||
//m_spawned = false;
|
||||
m_spawnData = new SaveData();
|
||||
@@ -54,6 +58,7 @@ namespace Beyond
|
||||
|
||||
public override void Start()
|
||||
{
|
||||
|
||||
base.Start();
|
||||
if (Player.Instance != null)
|
||||
m_distanceFrom = Player.Instance.transform;
|
||||
@@ -111,6 +116,7 @@ namespace Beyond
|
||||
{
|
||||
if (m_prefab == null)
|
||||
return;
|
||||
|
||||
Vector3 pos;
|
||||
const float RAY_OFFSET = 30f;
|
||||
const float Y_OFFSET = .1f;
|
||||
|
||||
92
Assets/Scripts/Debug/DebugDisableEnemies.cs
Normal file
92
Assets/Scripts/Debug/DebugDisableEnemies.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Beyond {
|
||||
public class DebugDisableEnemies
|
||||
{
|
||||
[MenuItem("Debug/Enemies/Enable")]
|
||||
private static void Enable()
|
||||
{
|
||||
SetDefineSymbol("ENEMIES_DISABLED", false);
|
||||
EditorUtility.DisplayDialog("Enemies Debug", "Enemies have been enabled.", "OK");
|
||||
}
|
||||
|
||||
[MenuItem("Debug/Enemies/Enable", true)]
|
||||
private static bool EnableValidate()
|
||||
{
|
||||
return IsDefineSymbolSet("ENEMIES_DISABLED");
|
||||
}
|
||||
|
||||
[MenuItem("Debug/Enemies/Disable")]
|
||||
private static void Disable()
|
||||
{
|
||||
SetDefineSymbol("ENEMIES_DISABLED", true);
|
||||
EditorUtility.DisplayDialog("Enemies Debug", "Enemies have been disabled.", "OK");
|
||||
}
|
||||
|
||||
[MenuItem("Debug/Enemies/Disable", true)]
|
||||
private static bool DisableValidate()
|
||||
{
|
||||
return !IsDefineSymbolSet("ENEMIES_DISABLED");
|
||||
}
|
||||
|
||||
private static void SetDefineSymbol(string defineName, bool enable)
|
||||
{
|
||||
BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
|
||||
{
|
||||
BuildTargetGroup.Standalone,
|
||||
BuildTargetGroup.Android,
|
||||
BuildTargetGroup.iOS
|
||||
};
|
||||
|
||||
foreach (var group in buildTargetGroups)
|
||||
{
|
||||
var defines = GetDefinesList(group);
|
||||
if (enable)
|
||||
{
|
||||
if (!defines.Contains(defineName))
|
||||
{
|
||||
defines.Add(defineName);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (defines.Contains(defineName))
|
||||
{
|
||||
defines.Remove(defineName);
|
||||
}
|
||||
}
|
||||
|
||||
string definesString = string.Join(";", defines.ToArray());
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
|
||||
}
|
||||
}
|
||||
|
||||
private static List<string> GetDefinesList(BuildTargetGroup group)
|
||||
{
|
||||
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
|
||||
}
|
||||
|
||||
private static bool IsDefineSymbolSet(string defineName)
|
||||
{
|
||||
BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
|
||||
{
|
||||
BuildTargetGroup.Standalone,
|
||||
BuildTargetGroup.Android,
|
||||
BuildTargetGroup.iOS
|
||||
};
|
||||
|
||||
foreach (var group in buildTargetGroups)
|
||||
{
|
||||
var defines = GetDefinesList(group);
|
||||
if (defines.Contains(defineName))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/Debug/DebugDisableEnemies.cs.meta
Normal file
2
Assets/Scripts/Debug/DebugDisableEnemies.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2e4b2c5ead19e4e6c9ba19e35882a2de
|
||||
Reference in New Issue
Block a user