mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 10:45:33 +00:00
Automatic resizing shadows
This commit is contained in:
parent
34ea128693
commit
e416b3d8cd
4 changed files with 896 additions and 819 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -1,7 +1,8 @@
|
|||
[gd_scene load_steps=4 format=3 uid="uid://byc67yxbkefyk"]
|
||||
[gd_scene load_steps=5 format=3 uid="uid://byc67yxbkefyk"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cg6y36s7buapp" path="res://Scripts/Weapons/Bullet3D.cs" id="1_48dvc"]
|
||||
[ext_resource type="Texture2D" uid="uid://cybpmpb0d8yva" path="res://Sprites/Projectile.png" id="2_pklkt"]
|
||||
[ext_resource type="Texture2D" uid="uid://dq60rr6ejqd2t" path="res://Sprites/Actors/Shadow-Blob_001.png" id="3_pklkt"]
|
||||
|
||||
[sub_resource type="SphereShape3D" id="SphereShape3D_pklkt"]
|
||||
radius = 0.172059
|
||||
|
|
@ -24,6 +25,14 @@ shape = SubResource("SphereShape3D_pklkt")
|
|||
|
||||
[node name="VisibleOnScreenNotifier" type="VisibleOnScreenNotifier3D" parent="."]
|
||||
|
||||
[node name="Shadow" type="Decal" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.36669922, 0)
|
||||
size = Vector3(0.5, 1.2333984, 0.5)
|
||||
texture_albedo = ExtResource("3_pklkt")
|
||||
modulate = Color(1, 1, 1, 0.5)
|
||||
normal_fade = 0.5
|
||||
cull_mask = 1048574
|
||||
|
||||
[connection signal="area_entered" from="." to="." method="_on_area_entered"]
|
||||
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
|
||||
[connection signal="screen_exited" from="VisibleOnScreenNotifier" to="." method="_on_visible_on_screen_notifier_2d_screen_exited"]
|
||||
|
|
|
|||
|
|
@ -47,6 +47,8 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
|
||||
private Sprite3D _sprite;
|
||||
|
||||
private Decal _shadow;
|
||||
|
||||
private readonly Vector3 _defaultRotation = new(
|
||||
Mathf.DegToRad(-45f),
|
||||
Mathf.DegToRad(45f),
|
||||
|
|
@ -79,6 +81,8 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
_collisionShape = GetNode<CollisionShape3D>("CollisionShape");
|
||||
|
||||
_sprite = GetNodeOrNull<Sprite3D>("Sprite");
|
||||
|
||||
_shadow = GetNodeOrNull<Decal>("Shadow");
|
||||
}
|
||||
|
||||
public void Initialize(BulletInfo bulletInfo)
|
||||
|
|
@ -105,6 +109,12 @@ public partial class Bullet3D : Area3D, IBullet
|
|||
IsGrazed = false;
|
||||
IsFrozen = false;
|
||||
|
||||
if (_shadow is not null)
|
||||
{
|
||||
var shadowSize = _bulletInfo.OriginalBulletResource.BulletSize * 3;
|
||||
_shadow.Size = new Vector3(shadowSize, _shadow.Size.Y, shadowSize);
|
||||
}
|
||||
|
||||
// Need to clone them here
|
||||
// _modifiers = _bulletInfo.TimeModifiers.Select(x => x.MakeClone()).ToList();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue