item base class. tower. some fixes. inventory canvas
This commit is contained in:
parent
2b78e18398
commit
7421638a8d
@ -33,6 +33,7 @@ RectTransform:
|
||||
m_Children:
|
||||
- {fileID: 5903238893732464861}
|
||||
- {fileID: 5903238893920995269}
|
||||
- {fileID: 5909765210375931188}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -116,6 +117,7 @@ MonoBehaviour:
|
||||
m_EditorClassIdentifier:
|
||||
moveJoystick: {fileID: 5903238893732464856}
|
||||
attackJoystick: {fileID: 5903238893920995264}
|
||||
placeJoystick: {fileID: 5909765210375931185}
|
||||
--- !u!1001 &2346010270301780417
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -171,7 +173,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: -200
|
||||
value: -600
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
@ -226,7 +228,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
@ -365,7 +367,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: -200
|
||||
value: -600
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
@ -410,7 +412,7 @@ PrefabInstance:
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 0
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
@ -477,3 +479,197 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 7a47f546fc70ec8428172694e78e4288, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
--- !u!1001 &2549463672493996848
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 2346010271288414180}
|
||||
m_Modifications:
|
||||
- target: {fileID: 8170153791668043265, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: deadZone
|
||||
value: 0.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Pivot.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMax.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchorMin.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: -600
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: -400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 400
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791668043269, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: PlaceJoystic
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219456, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 180
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153791961219459, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 271a63d73be51f64dbf31b6b20b0fcb2,
|
||||
type: 3}
|
||||
- target: {fileID: 8170153792821263252, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_Sprite
|
||||
value:
|
||||
objectReference: {fileID: 21300000, guid: 2f51e0c9d4b837c419aab13bd3a5a8c9,
|
||||
type: 3}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.x
|
||||
value: 512
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_SizeDelta.y
|
||||
value: 512
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.x
|
||||
value: 222
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8170153792821263258, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
propertyPath: m_AnchoredPosition.y
|
||||
value: 140
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 0d230cc8be529a542a08cb878ab14b18, type: 3}
|
||||
--- !u!224 &5909765210375931188 stripped
|
||||
RectTransform:
|
||||
m_CorrespondingSourceObject: {fileID: 8170153791668043268, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2549463672493996848}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &5909765210375931185 stripped
|
||||
MonoBehaviour:
|
||||
m_CorrespondingSourceObject: {fileID: 8170153791668043265, guid: 0d230cc8be529a542a08cb878ab14b18,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2549463672493996848}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7a47f546fc70ec8428172694e78e4288, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
|
179
Assets/Prefab/InventoryCanas.prefab
Normal file
179
Assets/Prefab/InventoryCanas.prefab
Normal file
@ -0,0 +1,179 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1967491301176557388
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5757677100394197073}
|
||||
- component: {fileID: 5200306858852700959}
|
||||
- component: {fileID: 5828887965330480077}
|
||||
- component: {fileID: 5815360006936303551}
|
||||
- component: {fileID: 1527356263590969195}
|
||||
m_Layer: 5
|
||||
m_Name: InventoryCanas
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5757677100394197073
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967491301176557388}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0, y: 0, z: 0}
|
||||
m_Children:
|
||||
- {fileID: 2902167093541798520}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 0}
|
||||
m_Pivot: {x: 0, y: 0}
|
||||
--- !u!223 &5200306858852700959
|
||||
Canvas:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967491301176557388}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 3
|
||||
m_RenderMode: 0
|
||||
m_Camera: {fileID: 0}
|
||||
m_PlaneDistance: 100
|
||||
m_PixelPerfect: 0
|
||||
m_ReceivesEvents: 1
|
||||
m_OverrideSorting: 0
|
||||
m_OverridePixelPerfect: 0
|
||||
m_SortingBucketNormalizedSize: 0
|
||||
m_AdditionalShaderChannelsFlag: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingOrder: 0
|
||||
m_TargetDisplay: 0
|
||||
--- !u!114 &5828887965330480077
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967491301176557388}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_UiScaleMode: 1
|
||||
m_ReferencePixelsPerUnit: 100
|
||||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1080, y: 1920}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 0
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &5815360006936303551
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967491301176557388}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_IgnoreReversedGraphics: 1
|
||||
m_BlockingObjects: 0
|
||||
m_BlockingMask:
|
||||
serializedVersion: 2
|
||||
m_Bits: 4294967295
|
||||
--- !u!114 &1527356263590969195
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1967491301176557388}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e0b3f756d0c46044ca44448fe3582300, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
item: {fileID: 4221355843481402267, guid: da3203b630d1ce446b635338ac488223, type: 3}
|
||||
grid: {fileID: 2902167093541798523}
|
||||
--- !u!1 &2902167093541798523
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2902167093541798520}
|
||||
- component: {fileID: 2902167093541798521}
|
||||
m_Layer: 5
|
||||
m_Name: ItemGroup
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2902167093541798520
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2902167093541798523}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 5757677100394197073}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 1, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 231}
|
||||
m_SizeDelta: {x: 0, y: 228.46094}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2902167093541798521
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2902167093541798523}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Padding:
|
||||
m_Left: 0
|
||||
m_Right: 0
|
||||
m_Top: 0
|
||||
m_Bottom: 0
|
||||
m_ChildAlignment: 4
|
||||
m_Spacing: -180
|
||||
m_ChildForceExpandWidth: 1
|
||||
m_ChildForceExpandHeight: 1
|
||||
m_ChildControlWidth: 0
|
||||
m_ChildControlHeight: 0
|
||||
m_ChildScaleWidth: 0
|
||||
m_ChildScaleHeight: 0
|
||||
m_ReverseArrangement: 0
|
@ -1,7 +1,6 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8143a9ada3328cd47be0140d3ea73d5d
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
guid: ff3bc3b17ddefd14eb798b22cf0a854f
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
198
Assets/Prefab/ItemView.prefab
Normal file
198
Assets/Prefab/ItemView.prefab
Normal file
@ -0,0 +1,198 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &4221355843481402267
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4221355843481402266}
|
||||
- component: {fileID: 4221355843481402340}
|
||||
- component: {fileID: 4221355843481402341}
|
||||
m_Layer: 5
|
||||
m_Name: ItemView
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4221355843481402266
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355843481402267}
|
||||
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_Children:
|
||||
- {fileID: 4221355844459984379}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 405, y: 422}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4221355843481402340
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355843481402267}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4221355843481402341
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355843481402267}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: c965160d8643b4ceb8a96e344d4fe2ff, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!1 &4221355844459984376
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 4221355844459984379}
|
||||
- component: {fileID: 4221355844459984324}
|
||||
- component: {fileID: 4221355844459984325}
|
||||
- component: {fileID: 4221355844459984378}
|
||||
m_Layer: 5
|
||||
m_Name: Item
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &4221355844459984379
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355844459984376}
|
||||
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_Children: []
|
||||
m_Father: {fileID: 4221355843481402266}
|
||||
m_RootOrder: 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: 208, y: 208}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &4221355844459984324
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355844459984376}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &4221355844459984325
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355844459984376}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
m_Material: {fileID: 0}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_RaycastTarget: 1
|
||||
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
|
||||
m_Maskable: 1
|
||||
m_OnCullStateChanged:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Sprite: {fileID: 21300000, guid: caf8bc0311dd2fc4ca1528a82a063754, type: 3}
|
||||
m_Type: 0
|
||||
m_PreserveAspect: 0
|
||||
m_FillCenter: 1
|
||||
m_FillMethod: 4
|
||||
m_FillAmount: 1
|
||||
m_FillClockwise: 1
|
||||
m_FillOrigin: 0
|
||||
m_UseSpriteMesh: 0
|
||||
m_PixelsPerUnitMultiplier: 1
|
||||
--- !u!114 &4221355844459984378
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4221355844459984376}
|
||||
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: 4221355844459984325}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
7
Assets/Prefab/ItemView.prefab.meta
Normal file
7
Assets/Prefab/ItemView.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: da3203b630d1ce446b635338ac488223
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -12,5 +12,5 @@ MonoBehaviour:
|
||||
m_Script: {fileID: 11500000, guid: 83b1020f31bf45569f5af6c77fc77d4e, type: 3}
|
||||
m_Name: CameraData
|
||||
m_EditorClassIdentifier:
|
||||
offset: {x: 0, y: 25, z: -10}
|
||||
offset: {x: 0, y: 20, z: -10}
|
||||
smoothSpeed: 2
|
||||
|
@ -18,4 +18,5 @@ MonoBehaviour:
|
||||
weaponDataPath: WeaponsData
|
||||
uiDataPath: UIData
|
||||
musicDataPath: MusicData
|
||||
itemDataPath: ItemData
|
||||
chosenWeaponDataPath: ChosenWeapon.json
|
||||
|
24
Assets/Resources/Data/ItemData.asset
Normal file
24
Assets/Resources/Data/ItemData.asset
Normal file
@ -0,0 +1,24 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: effbc11b6ae8444c8d20e929ce28183e, type: 3}
|
||||
m_Name: ItemData
|
||||
m_EditorClassIdentifier:
|
||||
itemInfos:
|
||||
- prefab: {fileID: 3197816592181874056, guid: 2704c4f795b0d7748a3e3fa53be4d893,
|
||||
type: 3}
|
||||
isInstantUse: 0
|
||||
type: Tower
|
||||
icon: {fileID: 21300000, guid: 543c4732bd2d47a41bdbbf2156eb358c, type: 3}
|
||||
spawnablePrefab: {fileID: 1175122412763585952, guid: ca39954219550f949aeeecf95f25f3d1,
|
||||
type: 3}
|
||||
fromTimeSpawn: 3
|
||||
toTimeSpawn: 10
|
8
Assets/Resources/Data/ItemData.asset.meta
Normal file
8
Assets/Resources/Data/ItemData.asset.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 61b36bbea9deaf3429a93f65e1bdb53e
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -15,5 +15,3 @@ MonoBehaviour:
|
||||
levels:
|
||||
- sceneName: Level 1
|
||||
levelSprite: {fileID: 21300000, guid: 8bc240b354e7722408178bdcb1bf7b56, type: 3}
|
||||
- sceneName: Level 2
|
||||
levelSprite: {fileID: 21300000, guid: 426478b073313244bbe84d3ec1cafa64, type: 3}
|
||||
|
@ -17,3 +17,5 @@ MonoBehaviour:
|
||||
- {fileID: 5296751824488078361, guid: 7305318dc10267546b643a42c7c21af3, type: 3}
|
||||
joystickView: {fileID: 4385872142190176059, guid: 4df6913b39f4979429158c344680d83f,
|
||||
type: 3}
|
||||
inventoryView: {fileID: 1527356263590969195, guid: ff3bc3b17ddefd14eb798b22cf0a854f,
|
||||
type: 3}
|
||||
|
@ -23,6 +23,7 @@ MonoBehaviour:
|
||||
manaRegen: 5
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
- isPlayer: 0
|
||||
spawnPos:
|
||||
x: 3
|
||||
@ -33,6 +34,7 @@ MonoBehaviour:
|
||||
manaRegen: 10
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
- isPlayer: 0
|
||||
spawnPos:
|
||||
x: 3
|
||||
@ -43,3 +45,4 @@ MonoBehaviour:
|
||||
manaRegen: 10
|
||||
maxMana: 100
|
||||
maxHP: 100
|
||||
inventoryCapacity: 4
|
||||
|
@ -267,8 +267,8 @@ Camera:
|
||||
near clip plane: 0.3
|
||||
far clip plane: 1000
|
||||
field of view: 60
|
||||
orthographic: 0
|
||||
orthographic size: 5
|
||||
orthographic: 1
|
||||
orthographic size: 12
|
||||
m_Depth: -1
|
||||
m_CullingMask:
|
||||
serializedVersion: 2
|
||||
|
@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using CamControl;
|
||||
using Chars;
|
||||
using Data;
|
||||
using DefaultNamespace;
|
||||
using GameUI;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Controller
|
||||
{
|
||||
@ -19,10 +20,14 @@ namespace Controller
|
||||
new MusicController();
|
||||
MusicController.Instance.SetMusicData(data.MusicData);
|
||||
controllers.Add(hexGrid);
|
||||
|
||||
List<Type> types =
|
||||
new List<Type>() { typeof(Tower) };
|
||||
ItemFabric itemFabric = new ItemFabric(data.ItemsData, types);
|
||||
controllers.Add(itemFabric);
|
||||
|
||||
UIController uiController = new UIController(data.UIData);
|
||||
uiController.Spawn(); //TODO при паузе
|
||||
|
||||
uiController.Spawn(); //TODO при паузе Dotween ругается
|
||||
Unit player;
|
||||
List<Unit> units = new List<Unit>();
|
||||
data.UnitData.Units.ForEach(unit =>
|
||||
@ -30,7 +35,7 @@ namespace Controller
|
||||
if (unit.isPlayer)
|
||||
{
|
||||
player = new Unit(unit, JsonUtility.FromJson<Weapon>(data.ChosenWeapon), hexGrid);
|
||||
PlayerControl playerControl = new PlayerControl(player, uiController.PlayerControlView);
|
||||
PlayerControl playerControl = new PlayerControl(player, uiController.PlayerControlView, uiController.PlayerInventoryView);
|
||||
controllers.Add(playerControl);
|
||||
CameraControl cameraControl =
|
||||
new CameraControl(Camera.main, data.CameraData);
|
||||
@ -56,6 +61,8 @@ namespace Controller
|
||||
|
||||
hexGrid.OnHexPainted += paintedController.SetHexColors;
|
||||
|
||||
hexGrid.OnHexPainted += itemFabric.UpdateCellToOpenList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -20,10 +20,25 @@ namespace Data
|
||||
private UIData _uiData;
|
||||
[SerializeField] private string musicDataPath;
|
||||
private MusicData _musicData;
|
||||
[SerializeField] private string itemDataPath;
|
||||
private ItemsData _itemsData;
|
||||
[SerializeField] private string chosenWeaponDataPath;
|
||||
|
||||
public string ChosenWeapon => File.ReadAllText(Application.persistentDataPath + "/" + chosenWeaponDataPath);
|
||||
|
||||
public ItemsData ItemsData
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_itemsData == null)
|
||||
{
|
||||
_itemsData = Load<ItemsData>("Data/" + itemDataPath);
|
||||
}
|
||||
|
||||
return _itemsData;
|
||||
}
|
||||
}
|
||||
|
||||
public MusicData MusicData
|
||||
{
|
||||
get
|
||||
|
39
Assets/Scripts/Data/ItemsData.cs
Normal file
39
Assets/Scripts/Data/ItemsData.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Items;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
[CreateAssetMenu(fileName = "ItemData", menuName = "Data/ItemData", order = 0)]
|
||||
public class ItemsData : ScriptableObject
|
||||
{
|
||||
[SerializeField]
|
||||
private List<ItemInfo> itemInfos;
|
||||
|
||||
[SerializeField] private float fromTimeSpawn;
|
||||
[SerializeField] private float toTimeSpawn;
|
||||
|
||||
public List<ItemInfo> ItemInfos => itemInfos;
|
||||
public (float from, float to) SpawnTime => (fromTimeSpawn, toTimeSpawn);
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public struct ItemInfo
|
||||
{
|
||||
[SerializeField] private GameObject prefab;
|
||||
[SerializeField] private bool isInstantUse;
|
||||
[SerializeField] private string type;
|
||||
[SerializeField] private Sprite icon;
|
||||
[SerializeField] private GameObject spawnablePrefab;
|
||||
public GameObject Prefab => prefab;
|
||||
public string Type => type;
|
||||
|
||||
public Sprite Icon => icon;
|
||||
|
||||
public GameObject SpawnablePrefab => spawnablePrefab;
|
||||
|
||||
public bool IsInstanceUse => isInstantUse;
|
||||
}
|
||||
}
|
3
Assets/Scripts/Data/ItemsData.cs.meta
Normal file
3
Assets/Scripts/Data/ItemsData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: effbc11b6ae8444c8d20e929ce28183e
|
||||
timeCreated: 1641238823
|
@ -9,9 +9,10 @@ namespace Data
|
||||
{
|
||||
[SerializeField] private List<GameObject> _objectsToSpawn;
|
||||
[SerializeField] private PlayerControlView joystickView;
|
||||
[SerializeField] private PlayerInventoryView inventoryView;
|
||||
public List<GameObject> ObjectsToSpawn => _objectsToSpawn;
|
||||
public PlayerControlView PlayerControlView => joystickView;
|
||||
|
||||
|
||||
|
||||
public PlayerInventoryView InventoryView => inventoryView;
|
||||
}
|
||||
}
|
@ -24,5 +24,6 @@ namespace Data
|
||||
public int manaRegen;
|
||||
public int maxMana;
|
||||
public int maxHP;
|
||||
public int inventoryCapacity;
|
||||
}
|
||||
}
|
66
Assets/Scripts/GameUI/PlayerInventoryView.cs
Normal file
66
Assets/Scripts/GameUI/PlayerInventoryView.cs
Normal file
@ -0,0 +1,66 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Items;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class PlayerInventoryView : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private GameObject item;
|
||||
[SerializeField] private GameObject grid;
|
||||
|
||||
public Action<Item> OnItemInvoked;
|
||||
|
||||
private List<Button> _buttons;
|
||||
private Queue<Button> _freeButtons;
|
||||
private Dictionary<Item, Button> _dictionary;
|
||||
|
||||
|
||||
public void SetUpUI(int inventoryCapacity)
|
||||
{
|
||||
_buttons = new List<Button>();
|
||||
_dictionary = new Dictionary<Item, Button>();
|
||||
_freeButtons = new Queue<Button>();
|
||||
for (int i = 0; i < inventoryCapacity; i++)
|
||||
{
|
||||
var itemGo = Instantiate(item, grid.transform);
|
||||
var button = itemGo.GetComponentInChildren<Button>();
|
||||
_buttons.Add(button);
|
||||
button.gameObject.SetActive(false);
|
||||
}
|
||||
|
||||
_buttons.ForEach(button => _freeButtons.Enqueue(button));
|
||||
}
|
||||
|
||||
private void SwitchButton(Item item)
|
||||
{
|
||||
var button = _dictionary[item];
|
||||
_dictionary.Remove(item);
|
||||
button.gameObject.SetActive(false);
|
||||
_freeButtons.Enqueue(button);
|
||||
}
|
||||
|
||||
public void PickUpItem(Item item)
|
||||
{
|
||||
var button = _freeButtons.Dequeue();
|
||||
_dictionary.Add(item, button);
|
||||
button.gameObject.SetActive(true);
|
||||
button.onClick.AddListener(() =>
|
||||
{
|
||||
if (item.IsInstantUse)
|
||||
{
|
||||
item.InstanceInvoke();
|
||||
_freeButtons.Enqueue(button);
|
||||
button.gameObject.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
item.Invoke(SwitchButton);
|
||||
OnItemInvoked?.Invoke(item);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
11
Assets/Scripts/GameUI/PlayerInventoryView.cs.meta
Normal file
11
Assets/Scripts/GameUI/PlayerInventoryView.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e0b3f756d0c46044ca44448fe3582300
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -9,8 +9,10 @@ namespace GameUI
|
||||
{
|
||||
private readonly UIData _uiData;
|
||||
private PlayerControlView _playerControlView;
|
||||
private PlayerInventoryView _inventoryView;
|
||||
|
||||
public PlayerControlView PlayerControlView => _playerControlView;
|
||||
public PlayerInventoryView PlayerInventoryView => _inventoryView;
|
||||
|
||||
public UIController(UIData uiData)
|
||||
{
|
||||
@ -22,8 +24,9 @@ namespace GameUI
|
||||
var canvasGroup = new GameObject("CanvasGroup");
|
||||
canvasGroup.AddComponent<CanvasGroup>();
|
||||
_playerControlView = Object.Instantiate(_uiData.PlayerControlView, canvasGroup.transform);
|
||||
_inventoryView = Object.Instantiate(_uiData.InventoryView, canvasGroup.transform);
|
||||
|
||||
_uiData.ObjectsToSpawn.ForEach(x => Object.Instantiate(x, canvasGroup.transform));
|
||||
_uiData.ObjectsToSpawn.ForEach(x => Object.Instantiate(x, canvasGroup.transform));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Items;
|
||||
using UnityEngine;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
@ -12,12 +13,15 @@ namespace HexFiled
|
||||
public Action<HexCell> onHexPainted;
|
||||
|
||||
[SerializeField] private HexCell[] neighbors;
|
||||
private Item _item;
|
||||
private UnitColor _color;
|
||||
private MeshRenderer _renderer;
|
||||
private Dictionary<UnitColor, CellColor> _cellColor;
|
||||
|
||||
public UnitColor Color => _color;
|
||||
|
||||
public Item Item => _item;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
_renderer = GetComponent<MeshRenderer>();
|
||||
@ -25,10 +29,17 @@ namespace HexFiled
|
||||
_color = UnitColor.GREY;
|
||||
}
|
||||
|
||||
public void SetItem(Item item)
|
||||
{
|
||||
_item = item == _item ? null : item;
|
||||
}
|
||||
|
||||
|
||||
public List<HexCell> GetListNeighbours()
|
||||
{
|
||||
return neighbors.ToList();
|
||||
}
|
||||
|
||||
public void SetDictionary(Dictionary<UnitColor, CellColor> colors)
|
||||
{
|
||||
_cellColor = colors;
|
||||
@ -56,11 +67,10 @@ namespace HexFiled
|
||||
}
|
||||
|
||||
_renderer.material.mainTexture = _cellColor[color].Texture;
|
||||
|
||||
|
||||
_color = color;
|
||||
Instantiate(_cellColor[color].VFXPrefab, transform);
|
||||
onHexPainted?.Invoke(this);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Items.meta
Normal file
3
Assets/Scripts/Items.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 2ece86e08d3d4fbfb7c41139b60e7ae9
|
||||
timeCreated: 1641238755
|
39
Assets/Scripts/Items/Item.cs
Normal file
39
Assets/Scripts/Items/Item.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using Data;
|
||||
using HexFiled;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
public abstract class Item
|
||||
{
|
||||
protected ItemInfo Data;
|
||||
protected Unit Unit;
|
||||
protected Action<Item> OnItemUsed;
|
||||
|
||||
public bool IsInstantUse => Data.IsInstanceUse;
|
||||
protected Item(ItemInfo data)
|
||||
{
|
||||
Data = data;
|
||||
}
|
||||
|
||||
public void PickUp(Unit unit)
|
||||
{
|
||||
Unit = unit;
|
||||
}
|
||||
|
||||
public GameObject Spawn(HexCell cell)
|
||||
{
|
||||
var item = Object.Instantiate(Data.Prefab, cell.transform.position + new Vector3(0, 1, 0),
|
||||
Quaternion.identity);
|
||||
return item;
|
||||
}
|
||||
|
||||
public abstract void Invoke(Action<Item> item);
|
||||
public abstract void InstanceInvoke();
|
||||
public abstract void PlaceItem(HexCell cell);
|
||||
}
|
||||
}
|
3
Assets/Scripts/Items/Item.cs.meta
Normal file
3
Assets/Scripts/Items/Item.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 710a543252ea459bbc84897416de38c5
|
||||
timeCreated: 1641238772
|
71
Assets/Scripts/Items/ItemFabric.cs
Normal file
71
Assets/Scripts/Items/ItemFabric.cs
Normal file
@ -0,0 +1,71 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Data;
|
||||
using HexFiled;
|
||||
using Runtime.Controller;
|
||||
using UnityEngine;
|
||||
using Object = UnityEngine.Object;
|
||||
using Random = UnityEngine.Random;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
public class ItemFabric : IExecute
|
||||
{
|
||||
private ItemsData _data;
|
||||
private List<HexCell> _openList;
|
||||
private List<Type> _itemTypes;
|
||||
private Dictionary<string, ItemInfo> _itemInfos;
|
||||
private float _spawnTime;
|
||||
private float time;
|
||||
|
||||
public ItemFabric(ItemsData data, List<Type> dictionary)
|
||||
{
|
||||
_itemInfos = new Dictionary<string, ItemInfo>();
|
||||
data.ItemInfos.ForEach(info => { _itemInfos.Add(info.Type, info); });
|
||||
_itemTypes = dictionary;
|
||||
_data = data;
|
||||
_openList = new List<HexCell>();
|
||||
_spawnTime = Random.Range(data.SpawnTime.from, data.SpawnTime.to);
|
||||
}
|
||||
|
||||
public void UpdateCellToOpenList(HexCell cell)
|
||||
{
|
||||
if (cell.Color != UnitColor.GREY)
|
||||
{
|
||||
_openList.Add(cell);
|
||||
}
|
||||
else if (_openList.Contains(cell))
|
||||
{
|
||||
_openList.Remove(cell);
|
||||
}
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (Time.time - time >= _spawnTime)
|
||||
{
|
||||
List<HexCell> closedList = PaintedController.UnitCurrentCell.Select(unitCells => unitCells.Value.curent)
|
||||
.ToList();
|
||||
time = Time.time;
|
||||
var cell = _openList[Random.Range(0, _openList.Count - 1)];
|
||||
|
||||
while (closedList.Contains(cell) || cell.Item != null)
|
||||
{
|
||||
cell = _openList[Random.Range(0, _openList.Count - 1)];
|
||||
}
|
||||
|
||||
var type = _itemTypes[Random.Range(0, _itemTypes.Count - 1)];
|
||||
var info = _itemInfos[type.ToString().Replace("Items.", "")];
|
||||
var obj = (Item)Activator.CreateInstance(type, info);
|
||||
|
||||
var go = obj.Spawn(cell);
|
||||
go.AddComponent<CapsuleCollider>().isTrigger = true;
|
||||
var itemView = go.AddComponent<ItemView>();
|
||||
itemView.SetUp(obj);
|
||||
cell.SetItem(obj);
|
||||
_spawnTime = Random.Range(_data.SpawnTime.from, _data.SpawnTime.to);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Items/ItemFabric.cs.meta
Normal file
3
Assets/Scripts/Items/ItemFabric.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c1cf50c0d39346d5818f77f30c58e03b
|
||||
timeCreated: 1641294547
|
34
Assets/Scripts/Items/ItemView.cs
Normal file
34
Assets/Scripts/Items/ItemView.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using DG.Tweening;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
public class ItemView : MonoBehaviour
|
||||
{
|
||||
private Item _item;
|
||||
|
||||
|
||||
public void SetUp(Item item)
|
||||
{
|
||||
_item = item;
|
||||
Rotate();
|
||||
}
|
||||
|
||||
public Item PickUp(Unit unit)
|
||||
{
|
||||
transform.DOKill();
|
||||
_item.PickUp(unit);
|
||||
return _item;
|
||||
}
|
||||
|
||||
private void Rotate()
|
||||
{
|
||||
|
||||
transform.DORotate(transform.rotation.eulerAngles + new Vector3(0,10,0), 0.1f)
|
||||
.SetEase(Ease.Linear)
|
||||
.OnComplete(Rotate);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Items/ItemView.cs.meta
Normal file
3
Assets/Scripts/Items/ItemView.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58146f7e810741bcb70fe582391749bb
|
||||
timeCreated: 1641295184
|
34
Assets/Scripts/Items/Tower.cs
Normal file
34
Assets/Scripts/Items/Tower.cs
Normal file
@ -0,0 +1,34 @@
|
||||
using System;
|
||||
using Data;
|
||||
using HexFiled;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using Object = UnityEngine.Object;
|
||||
|
||||
namespace Items
|
||||
{
|
||||
public class Tower : Item
|
||||
{
|
||||
|
||||
public Tower(ItemInfo data) : base(data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void Invoke(Action<Item> action)
|
||||
{
|
||||
OnItemUsed += action;
|
||||
}
|
||||
|
||||
public override void InstanceInvoke()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public override void PlaceItem(HexCell cell)
|
||||
{
|
||||
Object.Instantiate(Data.SpawnablePrefab, cell.transform.position, Quaternion.identity);
|
||||
OnItemUsed?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Items/Tower.cs.meta
Normal file
3
Assets/Scripts/Items/Tower.cs.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f23a091c5733400f8f0092a4c0f33c6e
|
||||
timeCreated: 1641294934
|
@ -48,7 +48,6 @@ public class WeaponSelection : MonoBehaviour
|
||||
|
||||
private void ChoseWeapon(Weapon weapon)
|
||||
{
|
||||
_buttons.ForEach(x => x.image.color = Color.white);
|
||||
FileStream stream = new FileStream(Application.persistentDataPath + "/" + dataFilePath, FileMode.Create);
|
||||
using StreamWriter writer = new StreamWriter(stream);
|
||||
writer.Write(JsonUtility.ToJson(weapon));
|
||||
|
3
Assets/Scripts/Units/AI.meta
Normal file
3
Assets/Scripts/Units/AI.meta
Normal file
@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 32fec41995024d6f9b110df79b751c97
|
||||
timeCreated: 1641238734
|
@ -3,6 +3,7 @@ using Controller;
|
||||
using Data;
|
||||
using DG.Tweening;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using Runtime.Controller;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
@ -15,26 +16,64 @@ namespace Chars
|
||||
private Unit _unit;
|
||||
private FloatingJoystick _moveJoystick;
|
||||
private FloatingJoystick _attackJoystick;
|
||||
private FloatingJoystick _placeJoystick;
|
||||
private Camera _camera;
|
||||
private Vector2 _attackDircetion;
|
||||
private HexDirection _placeDirection;
|
||||
private PlayerInventoryView _inventoryView;
|
||||
private Item _itemToPlace;
|
||||
private HexCell _cellToPlace;
|
||||
|
||||
|
||||
|
||||
public PlayerControl(Unit unit, PlayerControlView joyView)
|
||||
public PlayerControl(Unit unit, PlayerControlView joyView, PlayerInventoryView inventoryView)
|
||||
{
|
||||
_unit = unit;
|
||||
_moveJoystick = joyView.MoveJoystick;
|
||||
_attackJoystick = joyView.AttackJoystick;
|
||||
_placeJoystick = joyView.PlaceJoystick;
|
||||
_placeJoystick.gameObject.SetActive(false);
|
||||
_camera = Camera.main;
|
||||
|
||||
_attackJoystick.OnTouchUp += DoAttack;
|
||||
_attackJoystick.OnTouchDown += AimCanvas;
|
||||
|
||||
inventoryView.SetUpUI(unit.InventoryCapacity);
|
||||
_unit.OnItemPickUp += PickUp;
|
||||
_inventoryView = inventoryView;
|
||||
inventoryView.OnItemInvoked += AimPlaceItem;
|
||||
_placeJoystick.OnTouchDown += AimCanvas;
|
||||
_placeJoystick.OnTouchUp += PlaceItem;
|
||||
|
||||
}
|
||||
|
||||
private void AimPlaceItem(Item item)
|
||||
{
|
||||
if (!_unit.IsBusy)
|
||||
{
|
||||
_placeJoystick.gameObject.SetActive(true);
|
||||
_itemToPlace = item;
|
||||
}
|
||||
}
|
||||
|
||||
private void PlaceItem()
|
||||
{
|
||||
_unit.UnitView.AimCanvas.SetActive(false);
|
||||
|
||||
_itemToPlace.PlaceItem(_cellToPlace);
|
||||
|
||||
_placeJoystick.gameObject.SetActive(false);
|
||||
}
|
||||
private void PickUp(Item item)
|
||||
{
|
||||
_inventoryView.PickUpItem(item);
|
||||
}
|
||||
private void DoAttack()
|
||||
{
|
||||
_unit.UnitView.AimCanvas.SetActive(false);
|
||||
_unit.StartAttack();
|
||||
}
|
||||
|
||||
|
||||
private void AimCanvas()
|
||||
{
|
||||
if (!_unit.IsBusy)
|
||||
@ -55,6 +94,12 @@ namespace Chars
|
||||
_attackDircetion = _attackJoystick.Direction.normalized;
|
||||
_unit.Aim(_attackDircetion);
|
||||
}
|
||||
|
||||
if (!_unit.IsBusy && _placeJoystick.isPressed)
|
||||
{
|
||||
_placeDirection = VectorToDirection(_placeJoystick.Direction.normalized);
|
||||
_cellToPlace = _unit.PlaceItemAim(_placeDirection);
|
||||
}
|
||||
}
|
||||
|
||||
private static HexDirection VectorToDirection(Vector2 dir)
|
||||
|
@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Chars;
|
||||
using Data;
|
||||
using DG.Tweening;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
using Object = UnityEngine.Object;
|
||||
@ -15,7 +17,7 @@ namespace Units
|
||||
{
|
||||
private bool _isAlive;
|
||||
private GameObject _instance;
|
||||
|
||||
private List<Item> _inventory;
|
||||
private AnimLength _animLength;
|
||||
private HexCell _cell;
|
||||
private HexGrid _hexGrid;
|
||||
@ -37,6 +39,8 @@ namespace Units
|
||||
public GameObject PlayerInstance => _instance;
|
||||
public UnitView UnitView => _unitView;
|
||||
public bool IsAlive => _isAlive;
|
||||
public int InventoryCapacity => _data.inventoryCapacity;
|
||||
public Action<Item> OnItemPickUp;
|
||||
|
||||
public Unit(UnitInfo unitData, Weapon weapon, HexGrid hexGrid)
|
||||
{
|
||||
@ -52,7 +56,7 @@ namespace Units
|
||||
public void Move(HexDirection direction)
|
||||
{
|
||||
if (!_cell.GetNeighbor(direction) || _isBusy) return;
|
||||
_unitView.StopHardCature();
|
||||
_unitView.StopHardCapture();
|
||||
if (_cell.GetNeighbor(direction).Color == _data.color)
|
||||
{
|
||||
DoTransit(direction);
|
||||
@ -117,6 +121,7 @@ namespace Units
|
||||
{
|
||||
_cell = _hexGrid.GetCellFromCoord(_data.spawnPos);
|
||||
_cell.PaintHex(_data.color);
|
||||
_inventory = new List<Item>();
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
var neigh = _cell.GetNeighbor((HexDirection)i);
|
||||
@ -139,7 +144,7 @@ namespace Units
|
||||
_animator = _instance.GetComponent<Animator>();
|
||||
_unitView = _instance.GetComponent<UnitView>();
|
||||
_barCanvas = _unitView.BarCanvas.GetComponent<BarCanvas>();
|
||||
_unitView.SetUp(_barCanvas.SpawnShotUI(_weapon.shots), _weapon, RegenMana, _data.manaRegen, CaptureHex);
|
||||
_unitView.SetUp(_barCanvas.SpawnShotUI(_weapon.shots), _weapon, RegenMana, _data.manaRegen, CaptureHex, this);
|
||||
SetAnimLength();
|
||||
MusicController.Instance.AddAudioSource(_instance);
|
||||
_mana = _data.maxMana;
|
||||
@ -154,6 +159,14 @@ namespace Units
|
||||
UpdateBarCanvas();
|
||||
}
|
||||
|
||||
public void PickUpItem(Item item)
|
||||
{
|
||||
if (_inventory.Count < _data.inventoryCapacity)
|
||||
{
|
||||
_inventory.Add(item);
|
||||
OnItemPickUp.Invoke(item);
|
||||
}
|
||||
}
|
||||
private void MoveEnd()
|
||||
{
|
||||
_isBusy = false;
|
||||
@ -268,6 +281,13 @@ namespace Units
|
||||
_direction = direction;
|
||||
}
|
||||
|
||||
public HexCell PlaceItemAim(HexDirection direction)
|
||||
{
|
||||
var cell = _cell.GetNeighbor(direction);
|
||||
_unitView.AimCanvas.transform.LookAt(cell.transform);
|
||||
return cell;
|
||||
}
|
||||
|
||||
private void Damage(int dmg)
|
||||
{
|
||||
if (_hp - dmg <= 0f)
|
||||
|
@ -6,12 +6,12 @@ namespace Chars
|
||||
{
|
||||
[SerializeField] private FloatingJoystick moveJoystick;
|
||||
[SerializeField] private FloatingJoystick attackJoystick;
|
||||
[SerializeField] private FloatingJoystick placeJoystick;
|
||||
|
||||
|
||||
public FloatingJoystick MoveJoystick => moveJoystick;
|
||||
public FloatingJoystick AttackJoystick => attackJoystick;
|
||||
|
||||
|
||||
|
||||
|
||||
public FloatingJoystick PlaceJoystick => placeJoystick;
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,10 @@ using System.Collections.Generic;
|
||||
using Data;
|
||||
using DG.Tweening;
|
||||
using HexFiled;
|
||||
using Items;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.UI;
|
||||
using Weapons;
|
||||
using Random = UnityEngine.Random;
|
||||
@ -32,11 +35,13 @@ public class UnitView : MonoBehaviour
|
||||
private Action _capureHex;
|
||||
private Sequence _sequence;
|
||||
private AudioSource _audioSource;
|
||||
private Unit _unit;
|
||||
|
||||
public GameObject BarCanvas => barCanvas;
|
||||
public GameObject AimCanvas => aimCanvas;
|
||||
|
||||
public void SetUp(Stack<ShotUIView> shots, Weapon weapon, Action regenMana, int manaRegen, Action captureHex)
|
||||
public void SetUp(Stack<ShotUIView> shots, Weapon weapon, Action regenMana, int manaRegen, Action captureHex,
|
||||
Unit unit)
|
||||
{
|
||||
_shootUIStack = shots;
|
||||
_weapon = weapon;
|
||||
@ -44,6 +49,7 @@ public class UnitView : MonoBehaviour
|
||||
_startRegen = regenMana;
|
||||
_manaRegen = manaRegen;
|
||||
_capureHex = captureHex;
|
||||
_unit = unit;
|
||||
}
|
||||
|
||||
public void HardCaptureHex(HexCell cell)
|
||||
@ -59,9 +65,9 @@ public class UnitView : MonoBehaviour
|
||||
cell.gameObject);
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
public void StopHardCature()
|
||||
|
||||
public void StopHardCapture()
|
||||
{
|
||||
_sequence.Kill();
|
||||
captureBar.DOFillAmount(0f, 0f).SetEase(Ease.Linear);
|
||||
@ -124,6 +130,14 @@ public class UnitView : MonoBehaviour
|
||||
other.transform.DOKill();
|
||||
Destroy(other.gameObject);
|
||||
}
|
||||
|
||||
ItemView itemView = other.GetComponent<ItemView>();
|
||||
|
||||
if (itemView != null)
|
||||
{
|
||||
_unit.PickUpItem(itemView.PickUp(_unit));
|
||||
Destroy(itemView.gameObject);
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator Reload()
|
||||
|
Loading…
x
Reference in New Issue
Block a user