Madness check-in
This commit is contained in:
@@ -2,10 +2,9 @@ using Godot;
|
||||
|
||||
public partial class EnemyBullet : Projectile
|
||||
{
|
||||
public Vector3 Target;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
Translate(new Vector3(0, 0, -Speed * (float)delta));
|
||||
TranslateObjectLocal(new Vector3(0, 0, -Speed * (float)delta));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,19 +1,26 @@
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
|
||||
public partial class FireAtPlayer : Timer
|
||||
{
|
||||
[Export]
|
||||
private Node3D _enemy;
|
||||
private Area3D _enemy;
|
||||
[Export]
|
||||
private PackedScene _fireProjectile;
|
||||
|
||||
public void OnFireAtPlayer()
|
||||
{
|
||||
GD.Print("Fire at player");
|
||||
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
|
||||
projectile.Rotation = _enemy.Rotation;
|
||||
projectile.Position = _enemy.Position;
|
||||
GetParent().AddChild(projectile);
|
||||
var players = GetTree().GetNodesInGroup("Player");
|
||||
if (players.Any())
|
||||
{
|
||||
GD.Print("Fire at player");
|
||||
var convertedPlayers = players.Select(x => (Node3D)x);
|
||||
var target = convertedPlayers.OrderBy(x => _enemy.Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
var projectile = _fireProjectile.Instantiate<Projectile>() as EnemyBullet;
|
||||
projectile.Rotation = _enemy.Rotation;
|
||||
projectile.Position = _enemy.Position;
|
||||
GetParent().AddChild(projectile);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDied()
|
||||
|
||||
@@ -30,7 +30,7 @@ public partial class MainMenu : Node2D
|
||||
if (animationName == "FirstLevel")
|
||||
{
|
||||
var main = GetTree().Root.GetNode<Main>("/root/Main");
|
||||
main.LoadLevel(0);
|
||||
main.LoadLevel(7);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public partial class MeleeEnemy : BasicEnemy
|
||||
var convertedPlayers = players.Select(x => (Node3D)x);
|
||||
var target = convertedPlayers.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
Position = Position.MoveToward(target.Position, _speed * (float)delta);
|
||||
//MoveAndSlide();
|
||||
LookAt(-target.Position, Vector3.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,23 @@
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
|
||||
public partial class RangedEnemy : BasicEnemy
|
||||
{
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
var players = GetTree().GetNodesInGroup("Player");
|
||||
if (players.Any())
|
||||
{
|
||||
GD.Print("Fire at player");
|
||||
var convertedPlayers = players.Select(x => (Node3D)x);
|
||||
var target = convertedPlayers.OrderBy(x => Position.DistanceTo(x.Position)).FirstOrDefault();
|
||||
var area = GetChildren().OfType<Area3D>().Single();
|
||||
area.LookAt(target.Position, Vector3.Up);
|
||||
}
|
||||
}
|
||||
public void OnHit(Node node)
|
||||
{
|
||||
GD.Print("Hit detected");
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ public partial class TestEnemy : RigidBody3D
|
||||
{
|
||||
[Export]
|
||||
private float _speed;
|
||||
[Export]
|
||||
private PathFollow3D _pathFollow;
|
||||
//[Export]
|
||||
//private PathFollow3D _pathFollow;
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
@@ -16,7 +16,7 @@ public partial class TestEnemy : RigidBody3D
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_pathFollow.Progress += _speed * (float)delta;
|
||||
//_pathFollow.Progress += _speed * (float)delta;
|
||||
}
|
||||
|
||||
public void OnHit(Node node)
|
||||
|
||||
Reference in New Issue
Block a user