mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:35:34 +00:00
Prisms and hit buttons
This commit is contained in:
parent
1a898cb7b8
commit
dbca78c0b7
8 changed files with 141 additions and 6 deletions
23
Scripts/Actors/Prism.cs
Normal file
23
Scripts/Actors/Prism.cs
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
using Godot;
|
||||
|
||||
namespace Cirno.Scripts.Actors;
|
||||
|
||||
public partial class Prism : Area2D
|
||||
{
|
||||
[Export] public float ReflectionAngle { get; set; } = 90f;
|
||||
[Export] public float RotationAngle { get; set; }
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
this.AreaEntered += OnCollision;
|
||||
}
|
||||
|
||||
private void OnCollision(Area2D other)
|
||||
{
|
||||
if (other is not Bullet bullet) return;
|
||||
|
||||
bullet.RotateBullet(ReflectionAngle);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
1
Scripts/Actors/Prism.cs.uid
Normal file
1
Scripts/Actors/Prism.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://yf367y2o5oyh
|
||||
Loading…
Add table
Add a link
Reference in a new issue