Compare commits
5 Commits
059753b9ab
...
9e07cd71db
Author | SHA1 | Date | |
---|---|---|---|
9e07cd71db | |||
6649e3220e | |||
|
65c151ea47 | ||
|
f006bccf3a | ||
|
4bfb6a68fd |
Binary file not shown.
Binary file not shown.
|
@ -34,5 +34,20 @@
|
|||
"CooldownTime": 0,
|
||||
"IsConsumables": true,
|
||||
"MaxCount": 10
|
||||
},
|
||||
{
|
||||
"Id": "0003",
|
||||
"Remark": "\u732A\u732A\u5B58\u94B1\u7F50",
|
||||
"__Activity": "prop5002",
|
||||
"Buff": null,
|
||||
"Condition": null,
|
||||
"Effect": {
|
||||
"PiggyBank": [
|
||||
2
|
||||
]
|
||||
},
|
||||
"CooldownTime": 0,
|
||||
"IsConsumables": true,
|
||||
"MaxCount": 1
|
||||
}
|
||||
]
|
|
@ -671,6 +671,20 @@
|
|||
"Icon": "res://resource/sprite/prop/active/ActiveProp5001.png",
|
||||
"ShowInMapEditor": true
|
||||
},
|
||||
{
|
||||
"Id": "prop5002",
|
||||
"Name": "\u732A\u732A\u5B58\u94B1\u7F50",
|
||||
"Type": 9,
|
||||
"Quality": 1,
|
||||
"Price": 0,
|
||||
"Intro": "",
|
||||
"Details": "\u62FE\u8D77\u8BE5\u9053\u5177\u540E\u73A9\u5BB6\u6361\u5230\u7684\u6240\u6709\u91D1\u5E01\u5C06\u4F1A\u88AB\u5B58\u5165\u5230\u5B58\u94B1\u7F50\u4E2D, \u4F7F\u7528\u8BE5\u9053\u5177, \u4F1A\u6467\u6BC1\u5B58\u94B1\u7F50, \u5E76\u8FD4\u56DE\u53CC\u500D\u7684\u91D1\u5E01,",
|
||||
"IsStatic": false,
|
||||
"__Material": "",
|
||||
"Prefab": "res://prefab/prop/ActiveProp.tscn",
|
||||
"Icon": "res://resource/sprite/prop/active/ActiveProp5002.png",
|
||||
"ShowInMapEditor": true
|
||||
},
|
||||
{
|
||||
"Id": "treasure_box0001",
|
||||
"Name": "\u6728\u8D28\u5B9D\u7BB1",
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 675 B |
Binary file not shown.
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 925 B |
Binary file not shown.
After Width: | Height: | Size: 314 B |
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dxffht13og4ag"
|
||||
path="res://.godot/imported/ActiveProp5002.png-add857fab665afd62103e2bff145b98c.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://resource/sprite/prop/active/ActiveProp5002.png"
|
||||
dest_files=["res://.godot/imported/ActiveProp5002.png-add857fab665afd62103e2bff145b98c.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
|
@ -123,7 +123,7 @@ DefaultLayer = 1
|
|||
ShowOffset = Vector2(2.08165e-12, 2)
|
||||
CollisionVisible = false
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0006" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0006" index="1"]
|
||||
position = Vector2(-10, -3)
|
||||
texture = ExtResource("7_30qwa")
|
||||
|
||||
|
@ -135,7 +135,7 @@ DefaultLayer = 1
|
|||
ShowOffset = Vector2(2.08165e-12, 2)
|
||||
CollisionVisible = false
|
||||
|
||||
[node name="ActivityInstance" type="Node2D" parent="ItemRoot/Item0008" index="0"]
|
||||
[node name="ActivityInstance" type="Node2D" parent="ItemRoot/Item0008" index="1"]
|
||||
position = Vector2(2.5, -12)
|
||||
script = ExtResource("5_lowqi")
|
||||
Id = "item_0031"
|
||||
|
@ -151,7 +151,7 @@ DefaultLayer = 1
|
|||
ShowOffset = Vector2(2.08165e-12, 2)
|
||||
CollisionVisible = false
|
||||
|
||||
[node name="Item26" type="Sprite2D" parent="ItemRoot/Item0013" index="0"]
|
||||
[node name="Item26" type="Sprite2D" parent="ItemRoot/Item0013" index="1"]
|
||||
position = Vector2(18, -2)
|
||||
texture = ExtResource("8_61dkg")
|
||||
|
||||
|
@ -163,19 +163,19 @@ DefaultLayer = 1
|
|||
ShowOffset = Vector2(2.08165e-12, 2)
|
||||
CollisionVisible = false
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0017" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0017" index="1"]
|
||||
position = Vector2(-2, -13)
|
||||
texture = ExtResource("8_u3vry")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0017" index="1"]
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0017" index="2"]
|
||||
position = Vector2(18, -11)
|
||||
texture = ExtResource("9_lhdr8")
|
||||
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0017" index="2"]
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0017" index="3"]
|
||||
position = Vector2(-16, -2)
|
||||
texture = ExtResource("10_4eqn0")
|
||||
|
||||
[node name="Sprite2D4" type="Sprite2D" parent="ItemRoot/Item0017" index="3"]
|
||||
[node name="Sprite2D4" type="Sprite2D" parent="ItemRoot/Item0017" index="4"]
|
||||
position = Vector2(10, -1)
|
||||
texture = ExtResource("11_tg3jo")
|
||||
|
||||
|
@ -201,11 +201,11 @@ Id = "item_0002"
|
|||
DefaultLayer = 1
|
||||
CollisionVisible = false
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0002" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0002" index="1"]
|
||||
position = Vector2(32, -2)
|
||||
texture = ExtResource("12_agfji")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0002" index="1"]
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0002" index="2"]
|
||||
material = SubResource("ShaderMaterial_i7git")
|
||||
position = Vector2(0, -15)
|
||||
scale = Vector2(1, -1)
|
||||
|
@ -223,7 +223,7 @@ script = ExtResource("5_lowqi")
|
|||
Id = "item_0004"
|
||||
DefaultLayer = 1
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0004" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0004" index="1"]
|
||||
position = Vector2(0, -17)
|
||||
texture = ExtResource("13_unnpl")
|
||||
|
||||
|
@ -258,15 +258,15 @@ script = ExtResource("5_lowqi")
|
|||
Id = "item_0009"
|
||||
DefaultLayer = 1
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0009" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0009" index="1"]
|
||||
position = Vector2(-24, -10)
|
||||
texture = ExtResource("15_h7524")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0009" index="1"]
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0009" index="2"]
|
||||
position = Vector2(1, -10)
|
||||
texture = ExtResource("15_h7524")
|
||||
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0009" index="2"]
|
||||
[node name="Sprite2D3" type="Sprite2D" parent="ItemRoot/Item0009" index="3"]
|
||||
position = Vector2(37, -10)
|
||||
texture = ExtResource("15_h7524")
|
||||
|
||||
|
@ -300,7 +300,7 @@ script = ExtResource("5_lowqi")
|
|||
Id = "item_0015"
|
||||
DefaultLayer = 1
|
||||
|
||||
[node name="Slice04" type="Sprite2D" parent="ItemRoot/Item0015" index="0"]
|
||||
[node name="Slice04" type="Sprite2D" parent="ItemRoot/Item0015" index="1"]
|
||||
position = Vector2(16, -9)
|
||||
texture = ExtResource("15_h7524")
|
||||
|
||||
|
@ -322,11 +322,11 @@ script = ExtResource("5_lowqi")
|
|||
Id = "item_0019"
|
||||
DefaultLayer = 1
|
||||
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0019" index="0"]
|
||||
[node name="Sprite2D" type="Sprite2D" parent="ItemRoot/Item0019" index="1"]
|
||||
position = Vector2(-23, -7)
|
||||
texture = ExtResource("16_xj0e1")
|
||||
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0019" index="1"]
|
||||
[node name="Sprite2D2" type="Sprite2D" parent="ItemRoot/Item0019" index="2"]
|
||||
position = Vector2(24, -8)
|
||||
texture = ExtResource("17_gwwce")
|
||||
|
||||
|
@ -470,7 +470,7 @@ position = Vector2(-158, -161)
|
|||
texture = ExtResource("43_x1gko")
|
||||
|
||||
[node name="Item-14" type="Sprite2D" parent="Node2D" index="18"]
|
||||
position = Vector2(-209, -117)
|
||||
position = Vector2(-209, -120)
|
||||
texture = ExtResource("44_yhrf0")
|
||||
|
||||
[node name="Item-15" type="Sprite2D" parent="Node2D" index="19"]
|
||||
|
@ -482,7 +482,7 @@ position = Vector2(-201, -206)
|
|||
texture = ExtResource("47_mf13m")
|
||||
|
||||
[node name="Item-20" type="Sprite2D" parent="Node2D" index="21"]
|
||||
position = Vector2(-39, 27)
|
||||
position = Vector2(135, -140)
|
||||
texture = ExtResource("48_2erjm")
|
||||
|
||||
[node name="Item-21" type="Sprite2D" parent="Node2D" index="22"]
|
||||
|
@ -499,15 +499,15 @@ texture = ExtResource("49_j5ytr")
|
|||
|
||||
[node name="Item06" type="Sprite2D" parent="Node2D" index="25"]
|
||||
z_index = -1
|
||||
position = Vector2(-73, -135)
|
||||
position = Vector2(-71, -114)
|
||||
texture = ExtResource("7_42rdc")
|
||||
|
||||
[node name="Item07" type="Sprite2D" parent="Node2D" index="26"]
|
||||
position = Vector2(-110, 19)
|
||||
position = Vector2(-99, 10)
|
||||
texture = ExtResource("49_yocgq")
|
||||
|
||||
[node name="Item12" type="Sprite2D" parent="Node2D" index="27"]
|
||||
position = Vector2(-101, -75)
|
||||
position = Vector2(134, -70)
|
||||
texture = ExtResource("52_1n1p3")
|
||||
flip_h = true
|
||||
|
||||
|
|
|
@ -249,6 +249,11 @@ public partial class ActivityObject
|
|||
/// </summary>
|
||||
public const string Id_prop5001 = "prop5001";
|
||||
/// <summary>
|
||||
/// 名称: 猪猪存钱罐 <br/>
|
||||
/// 简介:
|
||||
/// </summary>
|
||||
public const string Id_prop5002 = "prop5002";
|
||||
/// <summary>
|
||||
/// 名称: 木质宝箱 <br/>
|
||||
/// 简介: 木质宝箱
|
||||
/// </summary>
|
||||
|
|
|
@ -481,6 +481,16 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
|
|||
{
|
||||
buffFragment.OnPickUpItem();
|
||||
}
|
||||
|
||||
foreach (var conditionFragment in _conditionFragment)
|
||||
{
|
||||
conditionFragment.OnPickUpItem();
|
||||
}
|
||||
|
||||
foreach (var effectFragment in _effectFragment)
|
||||
{
|
||||
effectFragment.OnPickUpItem();
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoveItem()
|
||||
|
@ -489,6 +499,16 @@ public partial class ActiveProp : PropActivity, IPackageItem<Role>
|
|||
{
|
||||
buffFragment.OnRemoveItem();
|
||||
}
|
||||
|
||||
foreach (var conditionFragment in _conditionFragment)
|
||||
{
|
||||
conditionFragment.OnRemoveItem();
|
||||
}
|
||||
|
||||
foreach (var effectFragment in _effectFragment)
|
||||
{
|
||||
effectFragment.OnRemoveItem();
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void OnActiveItem()
|
||||
|
|
|
@ -1296,7 +1296,7 @@ public abstract partial class Role : ActivityObject
|
|||
/// </summary>
|
||||
public virtual void AddGold(int goldCount)
|
||||
{
|
||||
RoleState.Gold += goldCount;
|
||||
RoleState.Gold += RoleState.CalcGetGold(goldCount);
|
||||
//播放音效
|
||||
SoundManager.PlaySoundByConfig(ExcelConfig.Sound_Map["gold"], Position, this);
|
||||
}
|
||||
|
|
|
@ -226,4 +226,20 @@ public class RoleState
|
|||
|
||||
return distance;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算获取的金币
|
||||
/// </summary>
|
||||
public event Action<int, RefValue<int>> CalcGetGoldEvent;
|
||||
public int CalcGetGold(int gold)
|
||||
{
|
||||
if (CalcGetGoldEvent != null)
|
||||
{
|
||||
var result = new RefValue<int>(gold);
|
||||
CalcGetGoldEvent(gold, result);
|
||||
return result.Value;
|
||||
}
|
||||
|
||||
return gold;
|
||||
}
|
||||
}
|
|
@ -6,13 +6,4 @@ using System;
|
|||
/// </summary>
|
||||
public abstract class BuffFragment : PropFragment
|
||||
{
|
||||
/// <summary>
|
||||
/// 当道具被拾起时调用 (在 Master 赋值之后调用)
|
||||
/// </summary>
|
||||
public abstract void OnPickUpItem();
|
||||
|
||||
/// <summary>
|
||||
/// 当道具被移除时调用 (在 Master 置为 null 之前调用)
|
||||
/// </summary>
|
||||
public abstract void OnRemoveItem();
|
||||
}
|
|
@ -8,4 +8,12 @@ public abstract class ConditionFragment : PropFragment
|
|||
/// 当检测是否可以使用时调用
|
||||
/// </summary>
|
||||
public abstract bool OnCheckUse();
|
||||
|
||||
public override void OnPickUpItem()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnRemoveItem()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -8,4 +8,12 @@ public abstract class EffectFragment : PropFragment
|
|||
/// 使用道具的回调
|
||||
/// </summary>
|
||||
public abstract void OnUse();
|
||||
|
||||
public override void OnPickUpItem()
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnRemoveItem()
|
||||
{
|
||||
}
|
||||
}
|
|
@ -9,6 +9,16 @@ public abstract class PropFragment : Component<PropActivity>
|
|||
/// </summary>
|
||||
public Role Role => Master?.Master;
|
||||
|
||||
/// <summary>
|
||||
/// 当道具被拾起时调用 (在 Master 赋值之后调用)
|
||||
/// </summary>
|
||||
public abstract void OnPickUpItem();
|
||||
|
||||
/// <summary>
|
||||
/// 当道具被移除时调用 (在 Master 置为 null 之前调用)
|
||||
/// </summary>
|
||||
public abstract void OnRemoveItem();
|
||||
|
||||
/// <summary>
|
||||
/// 初始化被动属性参数
|
||||
/// </summary>
|
||||
|
|
52
DungeonShooting_Godot/src/game/buff/buff/Buff_GetGold.cs
Normal file
52
DungeonShooting_Godot/src/game/buff/buff/Buff_GetGold.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
|
||||
using Godot;
|
||||
|
||||
[BuffFragment("GetGold", "计算获取的金币buff, " +
|
||||
"参数‘1’为金币数量添加类型, 1: 具体数量, 2:百分比(小数), " +
|
||||
"参数‘2’为增加金币的数量值")]
|
||||
public class Buff_GetGold : BuffFragment
|
||||
{
|
||||
private int _type;
|
||||
private float _value;
|
||||
|
||||
public override void InitParam(float arg1, float arg2)
|
||||
{
|
||||
_type = (int)arg1;
|
||||
_value = arg2;
|
||||
}
|
||||
|
||||
public override void OnPickUpItem()
|
||||
{
|
||||
if (_type == 1)
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent += OnCalcGetGoldEvent1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent += OnCalcGetGoldEvent2;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRemoveItem()
|
||||
{
|
||||
if (_type == 1)
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent -= OnCalcGetGoldEvent1;
|
||||
}
|
||||
else
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent -= OnCalcGetGoldEvent2;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnCalcGetGoldEvent1(int origin, RefValue<int> refValue)
|
||||
{
|
||||
refValue.Value += Mathf.CeilToInt(_value);
|
||||
}
|
||||
|
||||
private void OnCalcGetGoldEvent2(int origin, RefValue<int> refValue)
|
||||
{
|
||||
refValue.Value += Mathf.CeilToInt(origin * _value);
|
||||
}
|
||||
|
||||
}
|
47
DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs
Normal file
47
DungeonShooting_Godot/src/game/buff/effect/Eff_PiggyBank.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
|
||||
using Godot;
|
||||
|
||||
[EffectFragment("PiggyBank", "存钱罐, 使用后返还存入的金币, 参数1为返还金币的倍率(小数)")]
|
||||
public class Eff_PiggyBank : EffectFragment
|
||||
{
|
||||
private float _value;
|
||||
//当前存入的金币数量
|
||||
private float _currValue;
|
||||
|
||||
public override void InitParam(float arg1)
|
||||
{
|
||||
_value = arg1;
|
||||
}
|
||||
|
||||
public override void OnUse()
|
||||
{
|
||||
Debug.Log("存入了: " + _currValue);
|
||||
var goldList = Utils.GetGoldList(Mathf.FloorToInt(_currValue * _value));
|
||||
foreach (var id in goldList)
|
||||
{
|
||||
var o = ObjectManager.GetActivityObject<Gold>(id);
|
||||
o.Position = Role.Position;
|
||||
o.Throw(0,
|
||||
Utils.Random.RandomRangeInt(50, 110),
|
||||
new Vector2(Utils.Random.RandomRangeInt(-20, 20), Utils.Random.RandomRangeInt(-20, 20)),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnPickUpItem()
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent += OnCalcGetGoldEvent;
|
||||
}
|
||||
|
||||
public override void OnRemoveItem()
|
||||
{
|
||||
Role.RoleState.CalcGetGoldEvent -= OnCalcGetGoldEvent;
|
||||
}
|
||||
|
||||
private void OnCalcGetGoldEvent(int origin, RefValue<int> refValue)
|
||||
{
|
||||
_currValue += refValue.Value;
|
||||
refValue.Value = 0;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user