开始重构buff系统
This commit is contained in:
parent
d8f56beee7
commit
5ca5d1d12d
|
@ -627,6 +627,20 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
|
|||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 添加组件时调用
|
||||
/// </summary>
|
||||
public virtual void OnAddComponent(Component component)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 移除组件时调用
|
||||
/// </summary>
|
||||
public virtual void OnRemoveComponent(Component component)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 返回当物体 CollisionLayer 是否能与 mask 层碰撞
|
||||
/// </summary>
|
||||
|
@ -773,6 +787,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
|
|||
component.Master = this;
|
||||
component.Ready();
|
||||
component.OnEnable();
|
||||
OnAddComponent(component);
|
||||
return component;
|
||||
}
|
||||
|
||||
|
@ -794,6 +809,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
|
|||
component.Master = this;
|
||||
component.Ready();
|
||||
component.OnEnable();
|
||||
OnAddComponent(component);
|
||||
return component;
|
||||
}
|
||||
|
||||
|
@ -811,6 +827,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
|
|||
if (_updatingComp)
|
||||
{
|
||||
_changeComponents.Add(new KeyValuePair<Component, bool>(component, false));
|
||||
OnRemoveComponent(component);
|
||||
component.Destroy();
|
||||
}
|
||||
else
|
||||
|
@ -820,6 +837,7 @@ public partial class ActivityObject : CharacterBody2D, IDestroy, ICoroutine
|
|||
if (_components[i].Value == component)
|
||||
{
|
||||
_components.RemoveAt(i);
|
||||
OnRemoveComponent(component);
|
||||
component.Destroy();
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -81,23 +81,6 @@ public abstract partial class UiBase : Control, IDestroy, ICoroutine
|
|||
UiManager.RecordUi(this, UiManager.RecordType.Open);
|
||||
}
|
||||
|
||||
public sealed override void _Ready()
|
||||
{
|
||||
if (Math.Abs(Scale.X - 1f) > 0.001f)
|
||||
{
|
||||
Resized += OnResizeUi;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnResizeUi()
|
||||
{
|
||||
if (ParentUi == null)
|
||||
{
|
||||
var viewportSize = GameApplication.Instance.ViewportSize;
|
||||
Size = viewportSize;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建当前ui时调用
|
||||
/// </summary>
|
||||
|
|
4
DungeonShooting_Godot/src/game/buff/BuffBase.cs
Normal file
4
DungeonShooting_Godot/src/game/buff/BuffBase.cs
Normal file
|
@ -0,0 +1,4 @@
|
|||
|
||||
public abstract partial class BuffBase : Component<Role>
|
||||
{
|
||||
}
|
Loading…
Reference in New Issue
Block a user