mirror of
https://github.com/All-Of-Us-Mods/MiraAPI.git
synced 2026-10-20 01:46:15 +00:00
targeting action button
This commit is contained in:
1 parent
70320d7c19
commit
b62d1b6565
4 files changed
+116
-23
No files matched your search
@@ -0,0 +1,40 @@
|
||||
using MiraAPI.Hud;
|
||||
using MiraAPI.Utilities.Assets;
|
||||
using UnityEngine;
|
||||
|
||||
namespace MiraAPI.Example.Buttons;
|
||||
|
||||
public class ExampleTargetButton : CustomActionButton<PlayerControl>
|
||||
{
|
||||
public override string Name => "Shoot";
|
||||
public override float Cooldown => 0f;
|
||||
public override float EffectDuration => 0f;
|
||||
public override int MaxUses => 0;
|
||||
public override LoadableAsset<Sprite> Sprite => ExampleAssets.ExampleButton;
|
||||
|
||||
protected override void OnClick()
|
||||
{
|
||||
PlayerControl.LocalPlayer.CmdCheckMurder(Target);
|
||||
}
|
||||
|
||||
public override PlayerControl GetTarget()
|
||||
{
|
||||
return PlayerControl.LocalPlayer.Data.Role.FindClosestTarget();
|
||||
}
|
||||
|
||||
public override void SetOutline(bool active)
|
||||
{
|
||||
Target?.cosmetics.SetOutline(active, new Il2CppSystem.Nullable<Color>(Color.red));
|
||||
}
|
||||
|
||||
public override bool IsTargetValid(PlayerControl target)
|
||||
{
|
||||
return PlayerControl.LocalPlayer.Data.Role.IsValidTarget(target.Data);
|
||||
}
|
||||
|
||||
public override bool Enabled(RoleBehaviour role)
|
||||
{
|
||||
return role.IsImpostor;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user