Upgrade to 4.3.
升级到4.3。
This commit is contained in:
parent
5d9643476f
commit
8c02a0548c
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Godot.NET.Sdk/4.3.0-rc.3">
|
||||
<Project Sdk="Godot.NET.Sdk/4.3.0">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework>
|
||||
|
|
|
@ -15,12 +15,6 @@ slide_on_ceiling = false
|
|||
platform_floor_layers = 4294967042
|
||||
platform_wall_layers = 32
|
||||
script = ExtResource("1_ib3qh")
|
||||
Life = 30000
|
||||
Durability = 3.0
|
||||
MaxDamage = 3
|
||||
MinDamage = 10
|
||||
DamageType = 2
|
||||
KnockbackForce = Vector2(2, -3)
|
||||
Speed = 300.0
|
||||
IgnoreWall = true
|
||||
EnableTracking = true
|
||||
|
|
|
@ -1,25 +1,21 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://c01av43yk1q71"]
|
||||
[gd_scene load_steps=4 format=3 uid="uid://c01av43yk1q71"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/projectile/Projectile.cs" id="1_ib3qh"]
|
||||
[ext_resource type="Texture2D" uid="uid://bbcjkyrsx88av" path="res://sprites/projectile/curseOfTheUndead.png" id="1_k8el6"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_dgro2"]
|
||||
|
||||
[sub_resource type="CircleShape2D" id="CircleShape2D_8117d"]
|
||||
radius = 11.0
|
||||
|
||||
[node name="curseOfTheUndead" type="CharacterBody2D"]
|
||||
collision_layer = 0
|
||||
collision_mask = 0
|
||||
script = ExtResource("1_ib3qh")
|
||||
Life = 30000
|
||||
Durability = 1.0
|
||||
MaxDamage = 3
|
||||
MinDamage = 10
|
||||
DamageType = 2
|
||||
KnockbackForce = Vector2(2, -3)
|
||||
_life = 5000
|
||||
_durability = 1.0
|
||||
_maxDamage = 10
|
||||
_minDamage = 1
|
||||
_damageType = 2
|
||||
_knockbackForce = Vector2(60, 0)
|
||||
Speed = 500.0
|
||||
IgnoreWall = true
|
||||
|
||||
[node name="CurseOfTheUndead" type="Sprite2D" parent="."]
|
||||
texture = ExtResource("1_k8el6")
|
||||
|
@ -27,13 +23,6 @@ texture = ExtResource("1_k8el6")
|
|||
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
|
||||
shape = SubResource("CircleShape2D_dgro2")
|
||||
|
||||
[node name="CollisionDetectionArea" type="Area2D" parent="."]
|
||||
collision_layer = 16
|
||||
collision_mask = 206
|
||||
|
||||
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollisionDetectionArea"]
|
||||
shape = SubResource("CircleShape2D_8117d")
|
||||
|
||||
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
|
||||
bus = &"SoundEffect"
|
||||
area_mask = 16
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
[ext_resource type="Texture2D" uid="uid://wt50kx6bup51" path="res://sprites/weapon/StaffNecromancy.png" id="1_ms3us"]
|
||||
[ext_resource type="Script" path="res://scripts/weapon/ProjectileWeapon.cs" id="1_w8hhv"]
|
||||
[ext_resource type="PackedScene" uid="uid://c01av43yk1q71" path="res://prefab/projectile/curseOfTheUndead.tscn" id="2_mwli5"]
|
||||
[ext_resource type="Texture2D" uid="uid://dg5vwprt66w4j" path="res://sprites/weapon/StaffNecromancy_Icon.png" id="3_31iau"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdxgx5vcof8em" path="res://prefab/projectile/Catapult.tscn" id="3_hk5nr"]
|
||||
[ext_resource type="AudioStream" uid="uid://cak6chjjsu7wo" path="res://sounds/fire.wav" id="4_ffr2k"]
|
||||
|
||||
[sub_resource type="RectangleShape2D" id="RectangleShape2D_obcq2"]
|
||||
|
@ -18,7 +18,7 @@ collision_mask = 34
|
|||
angular_damp = -1.0
|
||||
script = ExtResource("1_w8hhv")
|
||||
OffsetAngle = 0.087
|
||||
ProjectileScenes = [ExtResource("3_hk5nr")]
|
||||
ProjectileScenes = [ExtResource("2_mwli5")]
|
||||
Sequentially = true
|
||||
FiringIntervalAsMillisecond = 300
|
||||
UniqueIcon = ExtResource("3_31iau")
|
||||
|
|
|
@ -27,7 +27,7 @@ public partial class DamageNumber : CharacterBody2D
|
|||
|
||||
private bool _enableGravity;
|
||||
|
||||
public void SetVelocity(Vector2 velocity)
|
||||
public new void SetVelocity(Vector2 velocity)
|
||||
{
|
||||
Velocity = velocity;
|
||||
_enableGravity = true;
|
||||
|
|
|
@ -9,7 +9,9 @@ namespace ColdMint.scripts.database;
|
|||
/// </summary>
|
||||
public class GameDbContext(DbContextOptions<GameDbContext> options) : DbContext(options)
|
||||
{
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
public DbSet<ErrorRecord> ErrorRecords { get; set; }
|
||||
// ReSharper restore UnusedAutoPropertyAccessor.Global
|
||||
|
||||
/// <summary>
|
||||
/// <para>Async add error record</para>
|
||||
|
|
|
@ -291,14 +291,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
|
||||
if (_nodeBinding.TagLineEdit != null)
|
||||
{
|
||||
if (_hasStartNode)
|
||||
{
|
||||
_nodeBinding.TagLineEdit.Text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
_nodeBinding.TagLineEdit.Text = Config.RoomDataTag.StartingRoom;
|
||||
}
|
||||
_nodeBinding.TagLineEdit.Text = _hasStartNode ? string.Empty : Config.RoomDataTag.StartingRoom;
|
||||
}
|
||||
|
||||
if (_nodeBinding.HBoxContainer != null)
|
||||
|
@ -316,6 +309,7 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
GetTree().ChangeSceneToPacked(_mainMenu);
|
||||
};
|
||||
}
|
||||
|
@ -534,11 +528,6 @@ public partial class LevelGraphEditorLoader : UiLoaderTemplate
|
|||
{
|
||||
foreach (var dictionary in connectionList)
|
||||
{
|
||||
if (dictionary == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var keys = dictionary.Keys;
|
||||
if (keys.Count == 0)
|
||||
{
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.Loader;
|
||||
using ColdMint.scripts.debug;
|
||||
using ColdMint.scripts.utils;
|
||||
|
|
|
@ -19,17 +19,17 @@ public partial class Projectile : CharacterBody2D
|
|||
/// <para>life(ms)</para>
|
||||
/// <para>子弹的存在时间(毫秒)</para>
|
||||
/// </summary>
|
||||
[Export] public long Life;
|
||||
[Export] private long _life;
|
||||
|
||||
//The durability of the projectile
|
||||
//抛射体的耐久度
|
||||
//When the projectile hits the object, the durability will be reduced, and when the durability is less than or equal to 0, the projectile will be destroyed
|
||||
//当抛射体撞击到物体时,会减少耐久度,当耐久度小于等于0时,销毁抛射体
|
||||
[Export] public double Durability;
|
||||
[Export] private double _durability;
|
||||
|
||||
[Export] public int MaxDamage;
|
||||
[Export] public int MinDamage;
|
||||
[Export] public int DamageType;
|
||||
[Export] private int _maxDamage;
|
||||
[Export] private int _minDamage;
|
||||
[Export] private int _damageType;
|
||||
|
||||
/// <summary>
|
||||
/// <para>After this time destroy the projectile</para>
|
||||
|
@ -38,14 +38,14 @@ public partial class Projectile : CharacterBody2D
|
|||
private DateTime? _destructionTime;
|
||||
|
||||
/// <summary>
|
||||
/// <para>knockback</para>
|
||||
/// <para>knockBack</para>
|
||||
/// <para>击退</para>
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
///<para>How much force does it have when hitting the character? Unit: Number of cells,The X direction of the force is inferred automatically.</para>
|
||||
///<para>当击中角色时带有多大的力?单位:格数,力的X方向是自动推断的。</para>
|
||||
/// </remarks>
|
||||
[Export] public Vector2 KnockbackForce;
|
||||
[Export] private Vector2 _knockBackForce;
|
||||
|
||||
[Export] public float Speed;
|
||||
|
||||
|
@ -53,25 +53,25 @@ public partial class Projectile : CharacterBody2D
|
|||
/// <para>Whether it bounces back after hitting an enemy or a wall</para>
|
||||
/// <para>是否撞到敌人或墙壁后反弹</para>
|
||||
/// </summary>
|
||||
[Export] public bool EnableBounce;
|
||||
[Export] private bool _enableBounce;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Can it penetrate the wall</para>
|
||||
/// <para>是否可以穿透墙壁</para>
|
||||
/// </summary>
|
||||
[Export] public bool IgnoreWall;
|
||||
[Export] private bool _ignoreWall;
|
||||
|
||||
/// <summary>
|
||||
/// <para>Enable the tracking of the enemy</para>
|
||||
/// <para>启用追踪敌人的功能</para>
|
||||
/// </summary>
|
||||
[Export] public bool EnableTracking;
|
||||
[Export] private bool _enableTracking;
|
||||
|
||||
/// <summary>
|
||||
/// <para>The target</para>
|
||||
/// <para>设置目标</para>
|
||||
/// </summary>
|
||||
public Node2D? Target { get; set; }
|
||||
private Node2D? Target { get; set; }
|
||||
|
||||
private List<IProjectileDecorator>? _projectileDecorators;
|
||||
|
||||
|
@ -86,14 +86,17 @@ public partial class Projectile : CharacterBody2D
|
|||
{
|
||||
//If the existence time is less than or equal to 0, then it is set to exist for 10 seconds, and projectiles that exist indefinitely are prohibited
|
||||
//如果存在时间小于等于0,那么设置为存在10秒,禁止无限期存在的抛射体
|
||||
if (Life <= 0)
|
||||
if (_life <= 0)
|
||||
{
|
||||
Life = 10000;
|
||||
_life = 10000;
|
||||
}
|
||||
|
||||
_destructionTime = DateTime.Now.AddMilliseconds(Life);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Wall, !IgnoreWall);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Floor, !IgnoreWall);
|
||||
_destructionTime = DateTime.Now.AddMilliseconds(_life);
|
||||
SetCollisionLayerValue(Config.LayerNumber.Projectile, true);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Wall, !_ignoreWall);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Floor, !_ignoreWall);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Player, true);
|
||||
SetCollisionMaskValue(Config.LayerNumber.Mob, true);
|
||||
//Platform collision layer is not allowed to collide
|
||||
//平台碰撞层不可碰撞
|
||||
SetCollisionMaskValue(Config.LayerNumber.Platform, false);
|
||||
|
@ -189,12 +192,12 @@ public partial class Projectile : CharacterBody2D
|
|||
var damage = new Damage
|
||||
{
|
||||
Attacker = owner,
|
||||
MaxDamage = MaxDamage,
|
||||
MinDamage = MinDamage
|
||||
MaxDamage = _maxDamage,
|
||||
MinDamage = _minDamage
|
||||
};
|
||||
damage.CreateDamage();
|
||||
damage.MoveLeft = Velocity.X < 0;
|
||||
damage.Type = DamageType;
|
||||
damage.Type = _damageType;
|
||||
var dead = characterTemplate.Damage(damage);
|
||||
if (dead)
|
||||
{
|
||||
|
@ -203,12 +206,12 @@ public partial class Projectile : CharacterBody2D
|
|||
InvokeDecorators(decorator => { decorator.OnKillCharacter(owner, characterTemplate); });
|
||||
}
|
||||
|
||||
if (KnockbackForce != Vector2.Zero)
|
||||
if (_knockBackForce != Vector2.Zero)
|
||||
{
|
||||
//If we set the attack force, then apply the force to the object
|
||||
//如果我们设置了攻退力,那么将力应用到对象上
|
||||
var force = new Vector2();
|
||||
var forceX = Math.Abs(KnockbackForce.X);
|
||||
var forceX = Math.Abs(_knockBackForce.X);
|
||||
if (Velocity.X < 0)
|
||||
{
|
||||
//Beat back to port
|
||||
|
@ -217,18 +220,18 @@ public partial class Projectile : CharacterBody2D
|
|||
}
|
||||
|
||||
force.X = forceX * Config.CellSize;
|
||||
force.Y = KnockbackForce.Y * Config.CellSize;
|
||||
force.Y = _knockBackForce.Y * Config.CellSize;
|
||||
characterTemplate.AddForce(force);
|
||||
}
|
||||
}
|
||||
else if (target is PickAbleTemplate pickAbleTemplate)
|
||||
{
|
||||
if (KnockbackForce != Vector2.Zero)
|
||||
if (_knockBackForce != Vector2.Zero)
|
||||
{
|
||||
//If we set the attack force, then apply the force to the object
|
||||
//如果我们设置了攻退力,那么将力应用到对象上
|
||||
var force = new Vector2();
|
||||
var forceX = Math.Abs(KnockbackForce.X);
|
||||
var forceX = Math.Abs(_knockBackForce.X);
|
||||
if (Velocity.X < 0)
|
||||
{
|
||||
//Beat back to port
|
||||
|
@ -237,7 +240,7 @@ public partial class Projectile : CharacterBody2D
|
|||
}
|
||||
|
||||
force.X = forceX * Config.CellSize;
|
||||
force.Y = KnockbackForce.Y * Config.CellSize;
|
||||
force.Y = _knockBackForce.Y * Config.CellSize;
|
||||
pickAbleTemplate.ApplyImpulse(force);
|
||||
}
|
||||
}
|
||||
|
@ -287,7 +290,7 @@ public partial class Projectile : CharacterBody2D
|
|||
{
|
||||
//No collision.
|
||||
//没有撞到任何东西。
|
||||
if (EnableTracking && Target != null)
|
||||
if (_enableTracking && Target != null)
|
||||
{
|
||||
//Track the target
|
||||
//追踪目标
|
||||
|
@ -303,7 +306,7 @@ public partial class Projectile : CharacterBody2D
|
|||
{
|
||||
//Bump into other objects.
|
||||
//撞到其他对象。
|
||||
if (EnableBounce)
|
||||
if (_enableBounce)
|
||||
{
|
||||
Velocity = Velocity.Bounce(collisionInfo.GetNormal());
|
||||
}
|
||||
|
@ -323,8 +326,8 @@ public partial class Projectile : CharacterBody2D
|
|||
//请在Mask内配置子弹会和谁碰撞
|
||||
//When a bullet hits an object, its durability decreases
|
||||
//子弹撞击到物体时,耐久度减少
|
||||
Durability--;
|
||||
if (Durability <= 0)
|
||||
_durability--;
|
||||
if (_durability <= 0)
|
||||
{
|
||||
//When the durability is less than or equal to 0, destroy the bullet
|
||||
//当耐久度小于等于0时,销毁子弹
|
||||
|
|
|
@ -29,6 +29,6 @@ public static class TranslationServerUtils
|
|||
/// <returns></returns>
|
||||
public static string? Translate(string? key)
|
||||
{
|
||||
return TranslationServer.Translate(key);
|
||||
return key == null ? null : TranslationServer.Translate(key);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user