Oops big commit
This commit is contained in:
@@ -12,7 +12,7 @@ public partial class BasicEnemy : Node3D
|
||||
public void OnEnemyHit(Node3D node)
|
||||
{
|
||||
var currentLevel = (Level)GetTree().GetFirstNodeInGroup("Level");
|
||||
currentLevel.OnEnemyDefeated((Node3D)GetParent());
|
||||
currentLevel.OnEnemyDefeated(this);
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ public partial class Capricorn : Character1
|
||||
[Export]
|
||||
private float _speed = 3.0f;
|
||||
|
||||
public bool CanShoot { get; private set; }
|
||||
|
||||
public bool IsShooting = false;
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
@@ -19,8 +19,6 @@ public partial class Capricorn2 : Character2
|
||||
[Export]
|
||||
private float _speed = 3.0f;
|
||||
|
||||
public bool CanShoot { get; private set; }
|
||||
|
||||
public bool IsShooting = false;
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
@@ -10,7 +10,7 @@ public partial class Character1 : Character
|
||||
[Export]
|
||||
private float _speed = 3.0f;
|
||||
|
||||
public bool CanShoot { get; private set; }
|
||||
public bool CanShoot { get; protected set; }
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
@@ -47,7 +47,8 @@ public partial class Character1 : Character
|
||||
{
|
||||
velocity.X = direction.X * _speed;
|
||||
velocity.Z = direction.Z * _speed;
|
||||
GetNode<Node3D>("Pivot").LookAt(Position + direction, Vector3.Up);
|
||||
GetNode<Node3D>("Pivot").LookAt(new Vector3(Position.X + direction.X, 0, Position.Z + direction.Z), Vector3.Up);
|
||||
GetNode<Node3D>("CollisionShape3D").LookAt(new Vector3(Position.X + direction.X, 0, Position.Z + direction.Z), Vector3.Up);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@ public partial class Character2 : Character
|
||||
[Export]
|
||||
private float _speed = 3.0f;
|
||||
|
||||
public bool CanShoot { get; private set; }
|
||||
public bool CanShoot { get; protected set; }
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
@@ -47,7 +47,8 @@ public partial class Character2 : Character
|
||||
{
|
||||
velocity.X = direction.X * _speed;
|
||||
velocity.Z = direction.Z * _speed;
|
||||
GetNode<Node3D>("Pivot").LookAt(Position + direction, Vector3.Up);
|
||||
GetNode<Node3D>("Pivot").LookAt(new Vector3(Position.X + direction.X, 0, Position.Z + direction.Z), Vector3.Up);
|
||||
GetNode<Node3D>("CollisionShape3D").LookAt(new Vector3(Position.X + direction.X, 0, Position.Z + direction.Z), Vector3.Up);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -9,6 +9,7 @@ public partial class CutterShot : Projectile
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_pathFollow = GetNode<PathFollow3D>("Path3D/PathFollow3D");
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ public partial class FinalLevel : Node3D
|
||||
var finalBossGUI = GetTree().GetFirstNodeInGroup("BossGUI") as Control;
|
||||
finalBossGUI.Show();
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/lb.wav");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/BossTheme.wav");
|
||||
bgmPlayer.PlayBGM();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public partial class GameManager : Node
|
||||
public void OnCharacterSelected(Player player)
|
||||
{
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
var audioStream = ResourceLoader.Load<AudioStream>("Audio/SFX/select.wav");
|
||||
var audioStream = ResourceLoader.Load<AudioStream>("Audio/SFX/Select.wav");
|
||||
sfxPlayer.Stream = audioStream;
|
||||
sfxPlayer.Play();
|
||||
GD.Print("Instancing...");
|
||||
|
||||
@@ -1,36 +1,26 @@
|
||||
using Godot;
|
||||
using Godot.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Level : Node3D
|
||||
{
|
||||
[Export]
|
||||
private Array<PackedScene> _enemyScenes;
|
||||
[Export]
|
||||
private Array<Node3D> _spawnPoints;
|
||||
|
||||
private Array<Node3D> _enemies = new Array<Node3D>();
|
||||
|
||||
private List<BasicEnemy> _enemies;
|
||||
private GameManager _gameManager;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
_gameManager = GetTree().Root.GetNode<GameManager>("Main/GameManager");
|
||||
for (var i = 0; i < _enemyScenes.Count; i++)
|
||||
{
|
||||
var enemy = _enemyScenes[i].Instantiate();
|
||||
var convertedNode = (Node3D)enemy;
|
||||
GetTree().Root.AddChild(convertedNode);
|
||||
_enemies.Add(convertedNode);
|
||||
//convertedNode.Transform = _spawnPoints[i].Transform;
|
||||
}
|
||||
_enemies = GetNode("Enemies").GetChildren().OfType<BasicEnemy>().ToList();
|
||||
}
|
||||
|
||||
public void OnEnemyDefeated(Node3D enemyDefeated)
|
||||
public void OnEnemyDefeated(BasicEnemy enemy)
|
||||
{
|
||||
GD.Print("On enemy defeated");
|
||||
_enemies.Remove(enemyDefeated);
|
||||
if (!_enemies.Any())
|
||||
_gameManager.OnAllEnemiesDefeated();
|
||||
if (_enemies.Contains(enemy))
|
||||
{
|
||||
GD.Print("On enemy defeated " + enemy.Name);
|
||||
_enemies.Remove(enemy);
|
||||
if (!_enemies.Any())
|
||||
_gameManager.OnAllEnemiesDefeated();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
using Godot;
|
||||
|
||||
public partial class Level3 : Node3D
|
||||
public partial class Level3 : Level
|
||||
{
|
||||
private int _numberOfHits = 3;
|
||||
private MeshInstance3D _door;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
base._Ready();
|
||||
_door = GetNode<MeshInstance3D>("Door");
|
||||
}
|
||||
|
||||
@@ -16,9 +17,7 @@ public partial class Level3 : Node3D
|
||||
GD.Print(_numberOfHits);
|
||||
if (_numberOfHits == 0)
|
||||
{
|
||||
_door.Hide();
|
||||
_door.QueueFree();
|
||||
_door = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public partial class Main : Node
|
||||
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.ProcessMode = ProcessModeEnum.Always;
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/level theme.wav");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/LevelTheme.wav");
|
||||
bgmPlayer.PlayBGM();
|
||||
|
||||
GetTree().Paused = true;
|
||||
|
||||
@@ -13,7 +13,7 @@ public partial class MainMenu : Node2D
|
||||
_animationPlayer = GetTree().Root.GetNode<AnimationPlayer>("/root/Main/MainMenu/UIAnimations/AnimationPlayer");
|
||||
_animationPlayer.Queue("IntroLore");
|
||||
var bgmPlayer = GetTree().Root.GetNode<BGMPlayer>("BgmPlayer");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/titlemusic.wav");
|
||||
bgmPlayer.SetBGMFromFilepath("Audio/BGM/TitleTheme.wav");
|
||||
bgmPlayer.PlayBGM();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,31 @@
|
||||
using Godot;
|
||||
using System.Linq;
|
||||
|
||||
public partial class MegamiBeamShot : Projectile
|
||||
{
|
||||
[Export]
|
||||
private PathFollow3D _pathFollow;
|
||||
[Export]
|
||||
public new AudioStream _soundEffect;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
Rotation = ParentCharacter.Rotation;
|
||||
GD.Print(Rotation);
|
||||
_pathFollow = GetNode<PathFollow3D>("Path3D/PathFollow3D");
|
||||
_pathFollow.GetParentNode3D().Rotation = ParentCharacter.GetNode<Node3D>("Pivot").Rotation;
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
sfxPlayer.Stream = _soundEffect;
|
||||
sfxPlayer.Play();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
Translate(new Vector3(0, 0, -Speed * (float)delta));
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_pathFollow.Progress += 10f * (float)delta;
|
||||
if (Mathf.IsEqualApprox(_pathFollow.ProgressRatio, 1.0f))
|
||||
QueueFree();
|
||||
}
|
||||
|
||||
private void OnBulletHitObject(Node node)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
LookAt(-target.Position, Vector3.Up);
|
||||
LookAt(new Vector3(-target.Position.X, 0, -target.Position.Z), Vector3.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
using Godot;
|
||||
using System.IO;
|
||||
|
||||
public partial class Projectile : Node3D
|
||||
{
|
||||
[Export]
|
||||
public double Cooldown { get; protected set; }
|
||||
[Export]
|
||||
public AudioStream _soundEffect;
|
||||
|
||||
public Character ParentCharacter;
|
||||
|
||||
@@ -15,8 +16,7 @@ public partial class Projectile : Node3D
|
||||
{
|
||||
Speed = _projectileSpeed;
|
||||
var sfxPlayer = GetTree().Root.GetNode<AudioStreamPlayer>("Main/SFXPlayer");
|
||||
var audioStream = ResourceLoader.Load<AudioStream>("Audio/SFX/shooting.wav");
|
||||
sfxPlayer.Stream = audioStream;
|
||||
sfxPlayer.Stream = _soundEffect;
|
||||
sfxPlayer.Play();
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ public partial class RangedEnemy : BasicEnemy
|
||||
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);
|
||||
area.LookAt(new Vector3(target.Position.X, 0, target.Position.Z), Vector3.Up);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,4 @@ public partial class SingleShot : Projectile
|
||||
var pellet = GetChildren().OfType<RigidBody3D>().Single();
|
||||
pellet.Translate(new Vector3(0, 0, Speed * -(float)delta));
|
||||
}
|
||||
|
||||
private void OnBulletHitObject(Node node)
|
||||
{
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user