Added slicer logic
This commit is contained in:
@@ -1,5 +1,100 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4832663291580191548
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 8585923548504464766}
|
||||
- component: {fileID: 1267529444914265891}
|
||||
- component: {fileID: 6163106584074071335}
|
||||
m_Layer: 0
|
||||
m_Name: SlicerAOE
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &8585923548504464766
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4832663291580191548}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 546461529234046531}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 160, y: 160}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!61 &1267529444914265891
|
||||
BoxCollider2D:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4832663291580191548}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_Density: 1
|
||||
m_Material: {fileID: 0}
|
||||
m_IncludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_ExcludeLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 0
|
||||
m_LayerOverridePriority: 0
|
||||
m_ForceSendLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ForceReceiveLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_ContactCaptureLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_CallbackLayers:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
m_IsTrigger: 1
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 40}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
oldSize: {x: 0, y: 0}
|
||||
newSize: {x: 0, y: 0}
|
||||
adaptiveTilingThreshold: 0
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 160, y: 80}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &6163106584074071335
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4832663291580191548}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7a471a3a004424f44aed18516c22740e, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier: Fruitomation::Fruitomation.Game.TriggerDetector
|
||||
--- !u!1 &8624048914473773482
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@@ -33,13 +128,14 @@ RectTransform:
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Children:
|
||||
- {fileID: 8585923548504464766}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 40, y: 120}
|
||||
m_SizeDelta: {x: 160, y: 160}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &6946449142574024064
|
||||
MonoBehaviour:
|
||||
@@ -55,6 +151,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier: Fruitomation::Fruitomation.Game.SlicerBuilding
|
||||
BuildingSprite: {fileID: 2084882389, guid: 0aea2ef73138c3b469b2db9651c7c5f8, type: 3}
|
||||
<SizeOnGrid>k__BackingField: {x: 4, y: 4}
|
||||
TriggerDetector: {fileID: 6163106584074071335}
|
||||
SlicerAnimator: {fileID: 739724694248001410}
|
||||
--- !u!222 &512124502862012575
|
||||
CanvasRenderer:
|
||||
@@ -150,7 +247,7 @@ BoxCollider2D:
|
||||
m_UsedByEffector: 0
|
||||
m_CompositeOperation: 0
|
||||
m_CompositeOrder: 0
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Offset: {x: 0, y: -40}
|
||||
m_SpriteTilingProperty:
|
||||
border: {x: 0, y: 0, z: 0, w: 0}
|
||||
pivot: {x: 0, y: 0}
|
||||
@@ -160,7 +257,7 @@ BoxCollider2D:
|
||||
drawMode: 0
|
||||
adaptiveTiling: 0
|
||||
m_AutoTiling: 0
|
||||
m_Size: {x: 40, y: 120}
|
||||
m_Size: {x: 160, y: 80}
|
||||
m_EdgeRadius: 0
|
||||
--- !u!114 &2693608777607402836
|
||||
MonoBehaviour:
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace Fruitomation.Game
|
||||
{
|
||||
[Header("Fan Specific Items")]
|
||||
[SerializeField] private TriggerDetector TriggerDetector;
|
||||
|
||||
[SerializeField] private Animator FanAnimator;
|
||||
|
||||
private void Start()
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using Fruitomation.Global;
|
||||
using System;
|
||||
using Fruitomation.Game.Items;
|
||||
using Fruitomation.Global;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Fruitomation.Game
|
||||
@@ -6,8 +8,50 @@ namespace Fruitomation.Game
|
||||
public class SlicerBuilding : Building
|
||||
{
|
||||
[Header("Slicer Specific Items")]
|
||||
[SerializeField] private TriggerDetector TriggerDetector;
|
||||
[SerializeField] private Animator SlicerAnimator;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
TriggerDetector.SetAction(other =>
|
||||
{
|
||||
bool isItem = other.transform.parent.TryGetComponent(out ItemBehaviour item);
|
||||
if (!isItem)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
item.CurrentType = item.CurrentType switch
|
||||
{
|
||||
ItemType.Apple => UpgradeManager.Is(BasicUpgrade.AppleSlices)
|
||||
? ItemType.AppleSlices
|
||||
: ItemType.Apple,
|
||||
|
||||
ItemType.Banana => UpgradeManager.Is(BasicUpgrade.BananaSlices)
|
||||
? ItemType.BananaSlices
|
||||
: ItemType.Banana,
|
||||
|
||||
ItemType.Kiwi => UpgradeManager.Is(BasicUpgrade.SlicedKiwi)
|
||||
? ItemType.SlicedKiwi
|
||||
: ItemType.Kiwi,
|
||||
|
||||
ItemType.Mango => UpgradeManager.Is(BasicUpgrade.MangoSlices)
|
||||
? ItemType.MangoSlices
|
||||
: ItemType.Mango,
|
||||
|
||||
ItemType.Durian => UpgradeManager.Is(BasicUpgrade.DurianSlices)
|
||||
? ItemType.DurianSlices
|
||||
: ItemType.Durian,
|
||||
|
||||
ItemType.BuddhasHand => UpgradeManager.Is(BasicUpgrade.BuddhasHandSlices)
|
||||
? ItemType.BuddhasHandSlices
|
||||
: ItemType.BuddhasHand,
|
||||
|
||||
var _ => item.CurrentType // Default
|
||||
};
|
||||
}, TriggerType.Enter);
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (GameStateController.Is(GameState.Simulation))
|
||||
|
||||
@@ -21,8 +21,11 @@ namespace Fruitomation.Game.Items
|
||||
get => InternalItemType;
|
||||
set
|
||||
{
|
||||
InternalItemType = value;
|
||||
OnUpdateItemType();
|
||||
if (InternalItemType != value) // Stops unneeded changes
|
||||
{
|
||||
InternalItemType = value;
|
||||
OnUpdateItemType();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user