BITFALL/Assets/Artists/Scripts/Editor/BITFALLDebuger.cs

80 lines
2.0 KiB
C#
Raw Normal View History

2023-08-27 02:58:19 +08:00
using System;
using System.Collections;
using System.Collections.Generic;
using System.Security;
2024-02-21 01:40:53 +08:00
using BITFALL.Entities.Equipment;
using BITKit;
2023-08-27 02:58:19 +08:00
using BITKit.Entities;
using BITKit.Entities.Player;
using UnityEngine;
using UnityEngine.InputSystem;
namespace BITFALL.Editor
{
public class BITFALLDebuger : MonoBehaviour
{
[SerializeReference,SubclassSelector]
private IPlayerService playerService;
2024-04-06 16:33:57 +08:00
[SerializeField] private ScriptableItem forceItem;
2024-02-21 01:40:53 +08:00
[SerializeReference, SubclassSelector] private IReference noclipEnv;
2023-08-27 02:58:19 +08:00
private void Update()
{
if (Keyboard.current.numpad0Key.wasPressedThisFrame)
{
playerService.LocalPlayer.Get<IHealth>().HealthPoint = 100;
}
if (Keyboard.current.numpad1Key.wasPressedThisFrame)
{
playerService.LocalPlayer.Get<IHealth>().HealthPoint = -1;
}
2023-10-20 19:31:12 +08:00
if (Keyboard.current.numpad2Key.wasPressedThisFrame)
{
playerService.LocalPlayer.Invoke(new DamageMessage()
{
2023-10-24 23:37:59 +08:00
Target = playerService.LocalPlayer,
Damage = 101,
2023-10-20 19:31:12 +08:00
});
}
2023-08-27 02:58:19 +08:00
if (Keyboard.current.numpadPlusKey.wasPressedThisFrame)
{
Time.timeScale = Mathf.Clamp(Time.timeScale + 0.2f, 0, 2);
Debug.Log(Time.timeScale);
}
if (Keyboard.current.numpadMinusKey.wasPressedThisFrame)
{
Time.timeScale = Mathf.Clamp(Time.timeScale - 0.2f, 0, 2);
Debug.Log(Time.timeScale);
}
if(Keyboard.current.slashKey.wasPressedThisFrame)
{
var noclip = Data.Get<bool>(noclipEnv.Value);
Data.Set(noclipEnv.Value, !noclip);
}
2024-02-21 01:40:53 +08:00
if (Keyboard.current.numpad4Key.wasPressedThisFrame)
{
var equipment = playerService.LocalPlayer.GetComponent<IEntityEquipment>();
var index = equipment.FindIndex(x => x == forceItem.AddressablePath);
if(index != -1)
{
equipment.SetEquipPriority(int.MaxValue, index);
}
}
if (Keyboard.current.numpad5Key.wasPressedThisFrame)
{
var equipment = playerService.LocalPlayer.GetComponent<IEntityEquipment>();
equipment.RemoveEquipPriority(int.MaxValue);
}
2023-08-27 02:58:19 +08:00
}
private void OnDestroy()
{
Time.timeScale = 1;
}
}
}