96 lines
2.4 KiB
C#
96 lines
2.4 KiB
C#
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using Godot;
|
|
using Godot.Bridge;
|
|
using Godot.NativeInterop;
|
|
|
|
[ScriptPath("res://Scripts/Bullets/AxisSphereSphere.cs")]
|
|
public class AxisSphereSphere : MoveAhead
|
|
{
|
|
public new class MethodName : MoveAhead.MethodName
|
|
{
|
|
public static readonly StringName WallHit = "WallHit";
|
|
}
|
|
|
|
public new class PropertyName : MoveAhead.PropertyName
|
|
{
|
|
}
|
|
|
|
public new class SignalName : MoveAhead.SignalName
|
|
{
|
|
}
|
|
|
|
public AxisSphere.Sphere data;
|
|
|
|
public void WallHit(Node other)
|
|
{
|
|
if (!other.HasMeta("Side"))
|
|
{
|
|
return;
|
|
}
|
|
if (!data.inside)
|
|
{
|
|
data.inside = true;
|
|
return;
|
|
}
|
|
Audio.PlaySound("snd_impact_ch1.wav", 1f, 1.1f);
|
|
switch ((DWMenu.BoardSides)(int)other.GetMeta("Side"))
|
|
{
|
|
case DWMenu.BoardSides.Up:
|
|
case DWMenu.BoardSides.Down:
|
|
speed = new Vector2(speed.X, 0f - speed.Y);
|
|
break;
|
|
case DWMenu.BoardSides.Left:
|
|
case DWMenu.BoardSides.Right:
|
|
speed = new Vector2(0f - speed.X, speed.Y);
|
|
break;
|
|
}
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
internal new static List<MethodInfo> GetGodotMethodList()
|
|
{
|
|
return new List<MethodInfo>(1)
|
|
{
|
|
new MethodInfo(MethodName.WallHit, new PropertyInfo(Variant.Type.Nil, "", PropertyHint.None, "", PropertyUsageFlags.Default, exported: false), MethodFlags.Normal, new List<PropertyInfo>
|
|
{
|
|
new PropertyInfo(Variant.Type.Object, "other", PropertyHint.None, "", PropertyUsageFlags.Default, new StringName("Node"), exported: false)
|
|
}, null)
|
|
};
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
|
|
{
|
|
if (method == MethodName.WallHit && args.Count == 1)
|
|
{
|
|
WallHit(VariantUtils.ConvertTo<Node>(in args[0]));
|
|
ret = default(godot_variant);
|
|
return true;
|
|
}
|
|
return base.InvokeGodotClassMethod(in method, args, out ret);
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
protected override bool HasGodotClassMethod(in godot_string_name method)
|
|
{
|
|
if (method == MethodName.WallHit)
|
|
{
|
|
return true;
|
|
}
|
|
return base.HasGodotClassMethod(in method);
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
protected override void SaveGodotObjectData(GodotSerializationInfo info)
|
|
{
|
|
base.SaveGodotObjectData(info);
|
|
}
|
|
|
|
[EditorBrowsable(EditorBrowsableState.Never)]
|
|
protected override void RestoreGodotObjectData(GodotSerializationInfo info)
|
|
{
|
|
base.RestoreGodotObjectData(info);
|
|
}
|
|
}
|