Fixed bullet through wall issue.
修复子弹穿墙的问题。
This commit is contained in:
parent
f4660fe581
commit
d143cf8dbf
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ColdMint.scripts.bubble;
|
using ColdMint.scripts.bubble;
|
||||||
using ColdMint.scripts.camp;
|
using ColdMint.scripts.camp;
|
||||||
|
using ColdMint.scripts.debug;
|
||||||
using ColdMint.scripts.inventory;
|
using ColdMint.scripts.inventory;
|
||||||
using ColdMint.scripts.stateMachine;
|
using ColdMint.scripts.stateMachine;
|
||||||
using ColdMint.scripts.utils;
|
using ColdMint.scripts.utils;
|
||||||
|
@ -210,7 +211,7 @@ public sealed partial class AiCharacter : CharacterTemplate
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddInitialWeapon(string? initWeaponRes)
|
private void AddInitialWeapon(string? initWeaponRes)
|
||||||
{
|
{
|
||||||
if (initWeaponRes == null)
|
if (string.IsNullOrEmpty(initWeaponRes))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -403,7 +403,6 @@ public partial class CharacterTemplate : CharacterBody2D
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeUtils.CallDeferredReparent(ItemMarker2D, pickAbleItemNode2D);
|
NodeUtils.CallDeferredReparent(ItemMarker2D, pickAbleItemNode2D);
|
||||||
pickAbleItemNode2D.Position = Vector2.Zero;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -130,6 +130,6 @@ public partial class SplashScreenLoader : UiLoaderTemplate
|
||||||
ModLoader.LoadAllMods(modPath);
|
ModLoader.LoadAllMods(modPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
await Task.CompletedTask;
|
await Task.Yield();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -105,7 +105,7 @@ public partial class ProjectileTemplate : CharacterBody2D
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target is TileMap)
|
if (target is TileMapLayer)
|
||||||
{
|
{
|
||||||
//When we hit the tile, we return true to prevent the bullet from penetrating the tile.
|
//When we hit the tile, we return true to prevent the bullet from penetrating the tile.
|
||||||
//撞击到瓦片时,我们返回true,是为了防止子弹穿透瓦片。
|
//撞击到瓦片时,我们返回true,是为了防止子弹穿透瓦片。
|
||||||
|
|
|
@ -1,36 +0,0 @@
|
||||||
using Godot;
|
|
||||||
|
|
||||||
namespace ColdMint.scripts.utils;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// <para>TileMapUtils</para>
|
|
||||||
/// <para>TileMap工具</para>
|
|
||||||
/// </summary>
|
|
||||||
public static class TileMapUtils
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// <para>Get the layer number corresponding to LayerName in TileMap</para>
|
|
||||||
/// <para>在TileMap内获取LayerName所对应的图层序号</para>
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="tileMap"></param>
|
|
||||||
/// <param name="layerName"></param>
|
|
||||||
/// <returns>
|
|
||||||
///<para>− 1 is returned after obtaining failure</para>
|
|
||||||
///<para>获取失败返回-1</para>
|
|
||||||
/// </returns>
|
|
||||||
public static int GetTileMapLayer(TileMap tileMap, string layerName)
|
|
||||||
{
|
|
||||||
var count = tileMap.GetLayersCount();
|
|
||||||
for (var i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
var currentLayerName = tileMap.GetLayerName(i);
|
|
||||||
if (currentLayerName == layerName)
|
|
||||||
{
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -82,7 +82,7 @@ public abstract partial class WeaponTemplate : PickAbleTemplate
|
||||||
var forceX = Math.Abs(_recoil.X);
|
var forceX = Math.Abs(_recoil.X);
|
||||||
if (Math.Abs(RotationDegrees) < 90)
|
if (Math.Abs(RotationDegrees) < 90)
|
||||||
{
|
{
|
||||||
//The weapon goes to the right and we apply a recoil to the left
|
//The weapon goes to the right, and we apply a recoil to the left
|
||||||
//武器朝向右边我们向左施加后坐力
|
//武器朝向右边我们向左施加后坐力
|
||||||
forceX = -forceX;
|
forceX = -forceX;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user