Added a way to kill children
This commit is contained in:
@@ -622,13 +622,15 @@ GameObject:
|
|||||||
- component: {fileID: 1867692262}
|
- component: {fileID: 1867692262}
|
||||||
- component: {fileID: 1867692261}
|
- component: {fileID: 1867692261}
|
||||||
- component: {fileID: 1867692260}
|
- component: {fileID: 1867692260}
|
||||||
|
- component: {fileID: 1867692264}
|
||||||
|
- component: {fileID: 1867692263}
|
||||||
m_Layer: 5
|
m_Layer: 5
|
||||||
m_Name: SampleChild
|
m_Name: SampleChild
|
||||||
m_TagString: Untagged
|
m_TagString: Untagged
|
||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1867692259
|
--- !u!224 &1867692259
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@@ -699,6 +701,74 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
<WindowImage>k__BackingField: {fileID: 1867692260}
|
<WindowImage>k__BackingField: {fileID: 1867692260}
|
||||||
|
--- !u!114 &1867692263
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1867692258}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 60d964b1b6914933801eaa6783d62cd8, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
--- !u!114 &1867692264
|
||||||
|
MonoBehaviour:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1867692258}
|
||||||
|
m_Enabled: 1
|
||||||
|
m_EditorHideFlags: 0
|
||||||
|
m_Script: {fileID: 11500000, guid: 4e29b1a8efbd4b44bb3f3716e73f07ff, type: 3}
|
||||||
|
m_Name:
|
||||||
|
m_EditorClassIdentifier:
|
||||||
|
m_Navigation:
|
||||||
|
m_Mode: 3
|
||||||
|
m_WrapAround: 0
|
||||||
|
m_SelectOnUp: {fileID: 0}
|
||||||
|
m_SelectOnDown: {fileID: 0}
|
||||||
|
m_SelectOnLeft: {fileID: 0}
|
||||||
|
m_SelectOnRight: {fileID: 0}
|
||||||
|
m_Transition: 1
|
||||||
|
m_Colors:
|
||||||
|
m_NormalColor: {r: 1, g: 1, b: 1, a: 1}
|
||||||
|
m_HighlightedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||||
|
m_PressedColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 1}
|
||||||
|
m_SelectedColor: {r: 0.9607843, g: 0.9607843, b: 0.9607843, a: 1}
|
||||||
|
m_DisabledColor: {r: 0.78431374, g: 0.78431374, b: 0.78431374, a: 0.5019608}
|
||||||
|
m_ColorMultiplier: 1
|
||||||
|
m_FadeDuration: 0.1
|
||||||
|
m_SpriteState:
|
||||||
|
m_HighlightedSprite: {fileID: 0}
|
||||||
|
m_PressedSprite: {fileID: 0}
|
||||||
|
m_SelectedSprite: {fileID: 0}
|
||||||
|
m_DisabledSprite: {fileID: 0}
|
||||||
|
m_AnimationTriggers:
|
||||||
|
m_NormalTrigger: Normal
|
||||||
|
m_HighlightedTrigger: Highlighted
|
||||||
|
m_PressedTrigger: Pressed
|
||||||
|
m_SelectedTrigger: Selected
|
||||||
|
m_DisabledTrigger: Disabled
|
||||||
|
m_Interactable: 1
|
||||||
|
m_TargetGraphic: {fileID: 1867692260}
|
||||||
|
m_OnClick:
|
||||||
|
m_PersistentCalls:
|
||||||
|
m_Calls:
|
||||||
|
- m_Target: {fileID: 1867692263}
|
||||||
|
m_TargetAssemblyTypeName: InterfaceOff.WindowInteractions, Assembly-CSharp
|
||||||
|
m_MethodName: WindowClicked
|
||||||
|
m_Mode: 1
|
||||||
|
m_Arguments:
|
||||||
|
m_ObjectArgument: {fileID: 0}
|
||||||
|
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||||
|
m_IntArgument: 0
|
||||||
|
m_FloatArgument: 0
|
||||||
|
m_StringArgument:
|
||||||
|
m_BoolArgument: 0
|
||||||
|
m_CallState: 2
|
||||||
--- !u!1 &2038986851
|
--- !u!1 &2038986851
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -2,6 +2,9 @@
|
|||||||
{
|
{
|
||||||
public class BasicWindow : WindowBase
|
public class BasicWindow : WindowBase
|
||||||
{
|
{
|
||||||
|
public override void OnWindowClicked()
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,11 +4,14 @@ namespace InterfaceOff
|
|||||||
{
|
{
|
||||||
public abstract class WindowBase : MonoBehaviour
|
public abstract class WindowBase : MonoBehaviour
|
||||||
{
|
{
|
||||||
|
public WindowInteractions Interactions { get; set; }
|
||||||
public WindowComponents Components { get; set; }
|
public WindowComponents Components { get; set; }
|
||||||
|
|
||||||
public void InstantiateWindowBase()
|
public void InstantiateWindowBase()
|
||||||
{
|
{
|
||||||
transform.position = CanvasManager.GetRandomPositionOnCanvas();
|
transform.position = CanvasManager.GetRandomPositionOnCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual void OnWindowClicked() { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
12
Assets/Scripts/WindowInteractions.cs
Normal file
12
Assets/Scripts/WindowInteractions.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace InterfaceOff
|
||||||
|
{
|
||||||
|
public class WindowInteractions : MonoBehaviour
|
||||||
|
{
|
||||||
|
private WindowBase AttachedWindow { get; set; }
|
||||||
|
|
||||||
|
public void SetAttachedTo(WindowBase window) => AttachedWindow = window;
|
||||||
|
public void WindowClicked() => AttachedWindow.OnWindowClicked();
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Assets/Scripts/WindowInteractions.cs.meta
Normal file
3
Assets/Scripts/WindowInteractions.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 60d964b1b6914933801eaa6783d62cd8
|
||||||
|
timeCreated: 1768301109
|
||||||
@@ -49,6 +49,9 @@ namespace InterfaceOff
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
windowBase.Interactions = go.GetComponent<WindowInteractions>();
|
||||||
|
windowBase.Interactions.SetAttachedTo(windowBase);
|
||||||
|
|
||||||
windowBase.Components = go.GetComponent<WindowComponents>();
|
windowBase.Components = go.GetComponent<WindowComponents>();
|
||||||
windowBase.InstantiateWindowBase();
|
windowBase.InstantiateWindowBase();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user