mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-13 23:05:55 +00:00
Bullet resource
This commit is contained in:
parent
76221ca7a6
commit
07f6e58ebd
19 changed files with 236 additions and 50 deletions
|
|
@ -2,6 +2,7 @@ using Godot;
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using Cirno.Scripts;
|
||||
using Cirno.Scripts.Resources;
|
||||
|
||||
public partial class Barrel : Area2D, IDestructible
|
||||
{
|
||||
|
|
@ -14,8 +15,7 @@ public partial class Barrel : Area2D, IDestructible
|
|||
[Export] public PackedScene DebrisScene { get; set; }
|
||||
|
||||
[Export] public PackedScene ExplosionParticles { get; set; }
|
||||
|
||||
[Export] public PackedScene ExplosionScene { get; set; }
|
||||
[Export] public BulletResource ExplosionData { get; set; }
|
||||
|
||||
private float _currentHealth = 0f;
|
||||
|
||||
|
|
@ -43,11 +43,12 @@ public partial class Barrel : Area2D, IDestructible
|
|||
|
||||
private void CreateExplosion()
|
||||
{
|
||||
if (ExplosionScene == null) return;
|
||||
if (ExplosionData == null) return;
|
||||
|
||||
var explosion = this.CreateSibling<Bullet>(ExplosionScene);
|
||||
var explosion = this.CreateSibling<Bullet>(ExplosionData.BulletScene);
|
||||
explosion.Speed = 0;
|
||||
|
||||
explosion.Initialize(ExplosionData.MakeBullet(this.GlobalPosition));
|
||||
}
|
||||
|
||||
private void ApplyExplosionDamage()
|
||||
|
|
|
|||
23
Scenes/Particles/IceBulletParticle.tscn
Normal file
23
Scenes/Particles/IceBulletParticle.tscn
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
[gd_scene load_steps=3 format=3 uid="uid://dfbmny3s4rili"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scripts/Components/AutodeleteParticle.cs" id="1_rk44q"]
|
||||
|
||||
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_f8iyl"]
|
||||
particle_flag_disable_z = true
|
||||
radial_velocity_min = -2.23517e-05
|
||||
radial_velocity_max = 30.38
|
||||
gravity = Vector3(0, 0, 0)
|
||||
linear_accel_min = -23.2
|
||||
linear_accel_max = -2.23517e-06
|
||||
scale_min = 0.5
|
||||
scale_max = 0.5
|
||||
color = Color(0.054902, 0.494118, 1, 1)
|
||||
|
||||
[node name="IceBulletParticle" type="GPUParticles2D"]
|
||||
emitting = false
|
||||
amount = 4
|
||||
process_material = SubResource("ParticleProcessMaterial_f8iyl")
|
||||
lifetime = 0.4
|
||||
one_shot = true
|
||||
script = ExtResource("1_rk44q")
|
||||
LifeTime = 1.0
|
||||
|
|
@ -1,10 +1,21 @@
|
|||
[gd_scene load_steps=9 format=3 uid="uid://bj28qiai2x2ar"]
|
||||
[gd_scene load_steps=11 format=3 uid="uid://bj28qiai2x2ar"]
|
||||
|
||||
[ext_resource type="Script" path="res://Scenes/Barrel.cs" id="1_avwdx"]
|
||||
[ext_resource type="Texture2D" uid="uid://d2f16ke8c7vwx" path="res://Sprites/Barrel.png" id="1_e66t6"]
|
||||
[ext_resource type="PackedScene" uid="uid://clyyl3jgpfoo7" path="res://Scenes/Props/Broken_Barrel.tscn" id="2_f145b"]
|
||||
[ext_resource type="PackedScene" uid="uid://jmijre3eaf8m" path="res://Scenes/Explosion.tscn" id="3_sm378"]
|
||||
[ext_resource type="PackedScene" uid="uid://h11o0et1y54v" path="res://Scenes/Weapons/Bullets/explosion.tscn" id="4_epbro"]
|
||||
[ext_resource type="Script" path="res://Scripts/Resources/BulletResource.cs" id="5_xl8uf"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_kqink"]
|
||||
script = ExtResource("5_xl8uf")
|
||||
BulletScene = ExtResource("4_epbro")
|
||||
BulletSpeed = 0.0
|
||||
BulletDamage = 8.0
|
||||
LifeTime = 1.0
|
||||
Owner = 0
|
||||
DamageType = 4
|
||||
TimeModifiers = null
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_2ewfl"]
|
||||
size = Vector2(11, 14)
|
||||
|
|
@ -25,7 +36,7 @@ ExplosionRadius = 4.0
|
|||
ExplosionDamage = 3.0
|
||||
DebrisScene = ExtResource("2_f145b")
|
||||
ExplosionParticles = ExtResource("3_sm378")
|
||||
ExplosionScene = ExtResource("4_epbro")
|
||||
ExplosionData = SubResource("Resource_kqink")
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
|
|
|
|||
|
|
@ -4,14 +4,13 @@
|
|||
[ext_resource type="Texture2D" uid="uid://b2bp03a70cpyd" path="res://Sprites/Explosion1.png" id="2_gmwb3"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_jxptd"]
|
||||
radius = 12.0
|
||||
radius = 17.0
|
||||
|
||||
[node name="Bullet" type="Area2D" groups=["bullets"]]
|
||||
collision_layer = 136
|
||||
collision_mask = 87
|
||||
script = ExtResource("1_f0epf")
|
||||
Speed = 0.0
|
||||
Damage = 10.0
|
||||
metadata/_edit_group_ = true
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="."]
|
||||
|
|
|
|||
|
|
@ -212,11 +212,9 @@ position = Vector2(-710, -459)
|
|||
|
||||
[node name="Barrel" parent="Factory Tilemaps" instance=ExtResource("18_vy02r")]
|
||||
position = Vector2(-711, -395)
|
||||
ExplosionScene = null
|
||||
|
||||
[node name="Barrel2" parent="Factory Tilemaps" instance=ExtResource("18_vy02r")]
|
||||
position = Vector2(-700, -381)
|
||||
ExplosionScene = null
|
||||
|
||||
[node name="CameraController" type="Camera2D" parent="."]
|
||||
script = ExtResource("6_t8ide")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue