added fixed dash targets and can dash towards enemies to hit them, get a knockback or dash through if killed
This commit is contained in:
31
scenes/FixedDashTarget/FixedDashthroughTarget.cs
Normal file
31
scenes/FixedDashTarget/FixedDashthroughTarget.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using Godot;
|
||||
using System;
|
||||
using Movementtests.interfaces;
|
||||
|
||||
[GlobalClass]
|
||||
public partial class FixedDashthroughTarget : AnimatableBody3D, ITargetable, IStunnable
|
||||
{
|
||||
public Vector3 GetTargetGlobalPosition()
|
||||
{
|
||||
return GlobalPosition;
|
||||
}
|
||||
|
||||
private uint _defaultCollisionMask;
|
||||
public override void _Ready()
|
||||
{
|
||||
_defaultCollisionMask = CollisionMask;
|
||||
}
|
||||
|
||||
public bool IsStunned { get; set; }
|
||||
public float StunDuration { get; set; } = 0.1f;
|
||||
public void Stun()
|
||||
{
|
||||
_defaultCollisionMask = 0;
|
||||
GetTree().CreateTimer(StunDuration).Timeout += Unstun;
|
||||
}
|
||||
|
||||
public void Unstun()
|
||||
{
|
||||
_defaultCollisionMask = CollisionMask;
|
||||
}
|
||||
}
|
||||
1
scenes/FixedDashTarget/FixedDashthroughTarget.cs.uid
Normal file
1
scenes/FixedDashTarget/FixedDashthroughTarget.cs.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c10qfkvmrm6uq
|
||||
30
scenes/FixedDashTarget/fixed_dashthrough_target.tscn
Normal file
30
scenes/FixedDashTarget/fixed_dashthrough_target.tscn
Normal file
@@ -0,0 +1,30 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://qup00a7x2sji"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://c10qfkvmrm6uq" path="res://scenes/FixedDashTarget/FixedDashthroughTarget.cs" id="1_r0j7a"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_nkm8n"]
|
||||
radius = 1.0
|
||||
|
||||
[sub_resource type="SphereMesh" id="SphereMesh_r0j7a"]
|
||||
radius = 1.0
|
||||
height = 2.0
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_kgb3i"]
|
||||
albedo_color = Color(5.1018596e-06, 0.6818665, 0.7627612, 1)
|
||||
metallic = 0.8
|
||||
metallic_specular = 0.6
|
||||
roughness = 0.1
|
||||
emission_enabled = true
|
||||
emission = Color(0, 0.68968636, 0.7473501, 1)
|
||||
|
||||
[node name="FixedDashthroughTarget" type="AnimatableBody3D"]
|
||||
collision_layer = 288
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_r0j7a")
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
shape = SubResource("SphereShape3D_nkm8n")
|
||||
|
||||
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||
mesh = SubResource("SphereMesh_r0j7a")
|
||||
surface_material_override/0 = SubResource("StandardMaterial3D_kgb3i")
|
||||
Reference in New Issue
Block a user