changed spawn logic. fixed inventory
This commit is contained in:
parent
54a1dc4f18
commit
e2017dc339
@ -34,9 +34,9 @@ public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPoint
|
||||
[SerializeField] private RectTransform handle = null;
|
||||
private RectTransform baseRect = null;
|
||||
|
||||
public Action OnTouchUp;
|
||||
public Action OnTouchDown;
|
||||
public Action<Vector2> OnDrug;
|
||||
public event Action OnTouchUp;
|
||||
public event Action OnTouchDown;
|
||||
public event Action<Vector2> OnDrug;
|
||||
|
||||
private Canvas canvas;
|
||||
private Camera cam;
|
||||
|
@ -26,7 +26,7 @@ Transform:
|
||||
m_GameObject: {fileID: 3496656575117217171}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1.4285715, y: 1.2420664, z: 1.4285715}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1659083691731649603}
|
||||
- {fileID: 830850053889082325}
|
||||
@ -50,10 +50,8 @@ MonoBehaviour:
|
||||
weapon:
|
||||
name: TowerWeapon
|
||||
icon: {fileID: 0}
|
||||
objectToThrow: {fileID: 4746165193704193263, guid: 4e7523811a052fd46acf941fc69c8c98,
|
||||
type: 3}
|
||||
VFXGameObject: {fileID: 2957420090356197408, guid: 5d1244f7b80cadd428a70173a01ce889,
|
||||
type: 3}
|
||||
objectToThrow: {fileID: 4746165193704193263, guid: 4e7523811a052fd46acf941fc69c8c98, type: 3}
|
||||
VFXGameObject: {fileID: 2957420090356197408, guid: 5d1244f7b80cadd428a70173a01ce889, type: 3}
|
||||
modifiedDamage: 0
|
||||
damage: 50
|
||||
speed: 1
|
||||
@ -62,7 +60,6 @@ MonoBehaviour:
|
||||
shots: 4
|
||||
shotSound: {fileID: 8300000, guid: 9ea918c6c23577f4e885a8490d2f2046, type: 3}
|
||||
hitSound: {fileID: 8300000, guid: 6c42231c18643dc4d9d8f8d15bc4735b, type: 3}
|
||||
_meshRenderer: {fileID: 5679516902409568551}
|
||||
crystals:
|
||||
- _gameObject: {fileID: 2039549536233283321}
|
||||
_unitColor: 4
|
||||
@ -79,68 +76,55 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 4576729921189221636}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CrystaRed
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
- target: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
@ -148,14 +132,12 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
--- !u!1 &1928478559685501253 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 4391758782632602575, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
m_PrefabInstance: {fileID: 2752258269723904650}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &1263406638282488831 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 4015374634755354997, guid: 2d04fd15863f13c4487d158f78e2a362, type: 3}
|
||||
m_PrefabInstance: {fileID: 2752258269723904650}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &6075215457166424256
|
||||
@ -165,68 +147,55 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 4576729921189221636}
|
||||
m_Modifications:
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CrystaYellow
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
- target: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
@ -234,14 +203,12 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
--- !u!1 &6622182927934416000 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 1128494808968600640, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
m_PrefabInstance: {fileID: 6075215457166424256}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &5813418027225431610 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 352099495347111674, guid: 502fb68ff9e389e479f59c576782150a, type: 3}
|
||||
m_PrefabInstance: {fileID: 6075215457166424256}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &7947451719248451575
|
||||
@ -251,68 +218,55 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 4576729921189221636}
|
||||
m_Modifications:
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CrystaGreen
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
- target: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
@ -320,20 +274,12 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
--- !u!1 &57444072119081327 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 7964352262128733848, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
m_PrefabInstance: {fileID: 7947451719248451575}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &830850053889082325 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 7947451719248451575}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!137 &5679516902409568551 stripped
|
||||
SkinnedMeshRenderer:
|
||||
m_CorrespondingSourceObject: {fileID: 2349392135937857232, guid: 54e3bec084dedc847a62e362e0d63332,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 7335449565726987298, guid: 54e3bec084dedc847a62e362e0d63332, type: 3}
|
||||
m_PrefabInstance: {fileID: 7947451719248451575}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1001 &8308599901968557183
|
||||
@ -343,68 +289,55 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 4576729921189221636}
|
||||
m_Modifications:
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1.5
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_Name
|
||||
value: CrystaBlue
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
- target: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
propertyPath: m_IsActive
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
@ -412,13 +345,11 @@ PrefabInstance:
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
--- !u!1 &2039549536233283321 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 7999515437598587526, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
m_PrefabInstance: {fileID: 8308599901968557183}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!4 &1659083691731649603 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab,
|
||||
type: 3}
|
||||
m_CorrespondingSourceObject: {fileID: 7226074276374339644, guid: 48b919cb81c94d846ab3491c856224ab, type: 3}
|
||||
m_PrefabInstance: {fileID: 8308599901968557183}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
|
@ -337,6 +337,7 @@ GameObject:
|
||||
- component: {fileID: 1455205766}
|
||||
- component: {fileID: 1455205765}
|
||||
- component: {fileID: 1455205764}
|
||||
- component: {fileID: 1455205767}
|
||||
m_Layer: 5
|
||||
m_Name: Score
|
||||
m_TagString: Untagged
|
||||
@ -472,6 +473,102 @@ CanvasRenderer:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1455205762}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!82 &1455205767
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1455205762}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 0}
|
||||
m_PlayOnAwake: 1
|
||||
m_Volume: 1
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &1475618468
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1,5 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Timers;
|
||||
using Chars;
|
||||
using Data;
|
||||
using UnityEngine;
|
||||
// using GoogleMobileAds.Api;
|
||||
using HexFiled;
|
||||
@ -12,7 +14,8 @@ public class AdsMob : MonoBehaviour
|
||||
// private string _revardUnitId = "ca-app-pub-3940256099942544/5224354917";
|
||||
// private RewardedAd _ad;
|
||||
// private AdRequest _request;
|
||||
private Unit _player;
|
||||
private UnitInfo _player;
|
||||
private UnitFactory _factory;
|
||||
[SerializeField] private Button button;
|
||||
[SerializeField] private GameObject canvas;
|
||||
|
||||
@ -40,7 +43,13 @@ public class AdsMob : MonoBehaviour
|
||||
|
||||
private void Spawn()
|
||||
{
|
||||
_player.Spawn(HexManager.CellByColor[UnitColor.GREY][Random.Range(0, HexManager.CellByColor[UnitColor.GREY].Count - 1)].coordinates);
|
||||
var player = _player;
|
||||
player.spawnPos =
|
||||
HexManager.CellByColor[UnitColor.GREY][Random.Range(0, HexManager.CellByColor[UnitColor.GREY].Count - 1)]
|
||||
.coordinates;
|
||||
|
||||
_factory.Spawn(player);
|
||||
|
||||
canvas.SetActive(false);
|
||||
Time.timeScale = 1f;
|
||||
}
|
||||
@ -54,8 +63,9 @@ public class AdsMob : MonoBehaviour
|
||||
// }
|
||||
// }
|
||||
|
||||
public void ShowCanvas(Unit player)
|
||||
public void ShowCanvas(UnitInfo player, UnitFactory factory)
|
||||
{
|
||||
_factory = factory;
|
||||
_player = player;
|
||||
Time.timeScale = 0f;
|
||||
canvas.SetActive(true);
|
||||
|
@ -30,7 +30,7 @@ namespace DefaultNamespace.AI
|
||||
_unit = unit;
|
||||
_camera = Camera.main;
|
||||
_unit.OnDeath += AgentDeath;
|
||||
unit.onPlayerSpawned += InitAgent;
|
||||
unit.OnPlayerSpawned += InitAgent;
|
||||
|
||||
}
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace AI
|
||||
foreach (var color in (UnitColor[])Enum.GetValues(typeof(UnitColor)))
|
||||
{
|
||||
if (HexManager.UnitCurrentCell.ContainsKey(color) &&
|
||||
HexManager.UnitCurrentCell[color] != (null, null) &&
|
||||
HexManager.UnitCurrentCell[color] != (null, null) &&
|
||||
Vector3.Distance(HexManager.UnitCurrentCell[color].unit.Instance.transform.position,
|
||||
agent.Instance.transform.position) <= cellDist * HexGrid.HexDistance
|
||||
&& HexManager.UnitCurrentCell[color].unit.Color != agent.Color)
|
||||
@ -224,8 +224,9 @@ namespace AI
|
||||
|
||||
private void MoveToBonus(AIAgent agent)
|
||||
{
|
||||
Pathfinding.FindPath(HexManager.UnitCurrentCell[agent.Unit.Color].cell, GetNearestItem(agent).hex,
|
||||
agent.currentPath);
|
||||
if (HexManager.UnitCurrentCell.TryGetValue(agent.Unit.Color, out var value))
|
||||
Pathfinding.FindPath(value.cell, GetNearestItem(agent).hex,
|
||||
agent.currentPath);
|
||||
}
|
||||
|
||||
private void AttackEnemy(AIAgent agent)
|
||||
|
@ -23,7 +23,7 @@ namespace Controller
|
||||
new MusicController();
|
||||
new VFXController();
|
||||
MusicController.Instance.SetMusicData(data.MusicData);
|
||||
controllers.Add(hexGrid);
|
||||
|
||||
var paintedController = new PaintedController();
|
||||
|
||||
data.WeaponsData.WeaponsList.ForEach(x => x.SetModifiedDamage(0));
|
||||
@ -33,55 +33,16 @@ namespace Controller
|
||||
|
||||
UIController uiController = new UIController(data.UIData);
|
||||
uiController.Spawn(); //TODO при паузе Dotween ругается
|
||||
Unit player;
|
||||
List<Unit> units = new List<Unit>();
|
||||
data.UnitData.Units.ForEach(unit =>
|
||||
{
|
||||
if (unit.isPlayer)
|
||||
{
|
||||
var weapon = JsonUtility.FromJson<Weapon>(data.ChosenWeapon);
|
||||
weapon.SetModifiedDamage(0);
|
||||
|
||||
player = new Unit(unit, weapon, hexGrid);
|
||||
PlayerControl playerControl = new PlayerControl(player, uiController.PlayerControlView,
|
||||
uiController.PlayerInventoryView);
|
||||
controllers.Add(playerControl);
|
||||
CameraControl cameraControl =
|
||||
new CameraControl(Camera.main, data.CameraData);
|
||||
controllers.Add(cameraControl);
|
||||
|
||||
player.onPlayerSpawned += p => controllers.Add(playerControl);
|
||||
var unitFactory = new UnitFactory(hexGrid, data, uiController, paintedController, controllers);
|
||||
|
||||
player.OnDeath += unit1 => controllers.Remove(playerControl);
|
||||
|
||||
player.onPlayerSpawned += cameraControl.InitCameraControl;
|
||||
units.Add(player);
|
||||
|
||||
player.OnDeath += uiController.AdsMob.ShowCanvas;
|
||||
player.OnDeath += paintedController.PaintOnDeath;
|
||||
}
|
||||
else
|
||||
{
|
||||
var enemy = new Unit(unit,
|
||||
data.WeaponsData.WeaponsList[Random.Range(0, data.WeaponsData.WeaponsList.Count - 1)], hexGrid);
|
||||
var enemyController = new EnemyController(unit, enemy);
|
||||
controllers.Add(enemyController);
|
||||
units.Add(enemy);
|
||||
AIAgent agent = new AIAgent(unit, enemy);
|
||||
enemy.onPlayerSpawned += x => controllers.Add(agent);
|
||||
enemy.OnDeath += x => { controllers.Remove(agent); };
|
||||
enemy.OnDeath += paintedController.PaintOnDeath;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
var unitFactory = new UnitFactory(units, hexGrid);
|
||||
|
||||
hexGrid.OnGridLoaded += unitFactory.Spawn;
|
||||
hexGrid.OnGridLoaded += () => unitFactory.SpawnList(data.UnitData.Units);
|
||||
|
||||
hexGrid.OnHexPainted += paintedController.SetHexColors;
|
||||
hexGrid.OnHexPainted += itemFabric.UpdateCellToOpenList;
|
||||
hexGrid.OnHexPainted += paintedController.CheckDeathOrDestroy;
|
||||
hexGrid.SpawnField();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using Chars;
|
||||
using DefaultNamespace.Weapons;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
|
||||
namespace Data
|
||||
{
|
||||
@ -26,7 +27,8 @@ namespace Data
|
||||
private AIData _aiData;
|
||||
[SerializeField] private string chosenWeaponDataPath;
|
||||
|
||||
public string ChosenWeapon => File.ReadAllText(Application.persistentDataPath + "/" + chosenWeaponDataPath);
|
||||
public Weapon ChosenWeapon =>
|
||||
JsonUtility.FromJson<Weapon>(File.ReadAllText(Application.persistentDataPath + "/" + chosenWeaponDataPath));
|
||||
|
||||
public AIData AIData
|
||||
{
|
||||
|
@ -11,9 +11,9 @@ namespace GameUI
|
||||
[SerializeField] private GameObject item;
|
||||
[SerializeField] private GameObject grid;
|
||||
|
||||
public Action<Item> OnBuildingInvoked;
|
||||
|
||||
public event Action<Item> OnBuildingInvoked;
|
||||
|
||||
private List<GameObject> itemsGo;
|
||||
private List<Button> _buttons;
|
||||
private Button[] _freeButtons;
|
||||
private Dictionary<Button, Item> _dictionary;
|
||||
@ -21,12 +21,20 @@ namespace GameUI
|
||||
|
||||
public void SetUpUI(int inventoryCapacity)
|
||||
{
|
||||
_buttons = new List<Button>();
|
||||
_dictionary = new Dictionary<Button, Item>();
|
||||
if (_buttons != null && _buttons.Count > 0)
|
||||
{
|
||||
itemsGo.ForEach(Destroy);
|
||||
}
|
||||
|
||||
itemsGo = new List<GameObject>();
|
||||
_buttons = new List<Button>();
|
||||
|
||||
_freeButtons = new Button[inventoryCapacity];
|
||||
for (int i = 0; i < inventoryCapacity; i++)
|
||||
{
|
||||
var itemGo = Instantiate(item, grid.transform);
|
||||
itemsGo.Add(itemGo);
|
||||
var button = itemGo.GetComponentInChildren<Button>();
|
||||
_buttons.Add(button);
|
||||
_dictionary.Add(button, null);
|
||||
@ -39,7 +47,7 @@ namespace GameUI
|
||||
|
||||
private void SwitchButton(Button button)
|
||||
{
|
||||
|
||||
button.onClick.RemoveAllListeners();
|
||||
button.gameObject.SetActive(false);
|
||||
for (int i = 0; i < _freeButtons.Length; i++)
|
||||
{
|
||||
|
@ -12,7 +12,7 @@ namespace HexFiled
|
||||
public class HexCell : MonoBehaviour
|
||||
{
|
||||
public HexCoordinates coordinates;
|
||||
public Action<HexCell> onHexPainted;
|
||||
public event Action<HexCell> OnHexPainted;
|
||||
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ namespace HexFiled
|
||||
MusicController.Instance.AddAudioSource(vfx);
|
||||
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures, vfx);
|
||||
|
||||
onHexPainted?.Invoke(this);
|
||||
OnHexPainted?.Invoke(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -9,7 +9,7 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace HexFiled
|
||||
{
|
||||
public class HexGrid : IInitialization
|
||||
public class HexGrid
|
||||
{
|
||||
|
||||
private HexCell[] _cells;
|
||||
@ -18,8 +18,8 @@ namespace HexFiled
|
||||
private FieldData _fieldData;
|
||||
|
||||
public static float HexDistance => _hexDistance;
|
||||
public Action<HexCell> OnHexPainted;
|
||||
public Action OnGridLoaded;
|
||||
public event Action<HexCell> OnHexPainted;
|
||||
public event Action OnGridLoaded;
|
||||
|
||||
private static Dictionary<UnitColor, CellColor> _colors;
|
||||
private static float _hexDistance;
|
||||
@ -45,6 +45,8 @@ namespace HexFiled
|
||||
|
||||
_gridCanvas = Object.Instantiate(fieldData.CoordinatesCanvas, _baseGameObject.transform)
|
||||
.GetComponent<Canvas>();
|
||||
HexManager.CellByColor = new Dictionary<UnitColor, List<HexCell>>();
|
||||
_cells = new HexCell[_fieldData.height * _fieldData.width];
|
||||
}
|
||||
|
||||
public HexCell GetCellFromCoord(HexCoordinates coordinates)
|
||||
@ -67,7 +69,7 @@ namespace HexFiled
|
||||
cell.transform.SetParent(_baseGameObject.transform, false);
|
||||
cell.transform.localPosition = position;
|
||||
cell.coordinates = HexCoordinates.FromOffsetCoordinates(x, z);
|
||||
cell.onHexPainted += OnHexPainted;
|
||||
cell.OnHexPainted += OnHexPainted;
|
||||
|
||||
if (x > 0)
|
||||
{
|
||||
@ -110,10 +112,8 @@ namespace HexFiled
|
||||
}
|
||||
|
||||
|
||||
public void Init()
|
||||
public void SpawnField()
|
||||
{
|
||||
HexManager.CellByColor = new Dictionary<UnitColor, List<HexCell>>();
|
||||
_cells = new HexCell[_fieldData.height * _fieldData.width];
|
||||
|
||||
for (int z = 0, i = 0; z < _fieldData.height; z++)
|
||||
{
|
||||
@ -123,7 +123,7 @@ namespace HexFiled
|
||||
}
|
||||
}
|
||||
|
||||
OnGridLoaded.Invoke();
|
||||
OnGridLoaded?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
@ -20,14 +20,14 @@ namespace HexFiled
|
||||
public void PaintOnDeath(Unit unit)
|
||||
{
|
||||
HexManager.PaintHexList(HexManager.CellByColor[unit.Color], UnitColor.GREY);
|
||||
#if UNITY_EDITOR
|
||||
|
||||
|
||||
if (HexManager.UnitCurrentCell.Count == 1)
|
||||
{
|
||||
SceneManager.LoadScene(1);
|
||||
}
|
||||
#endif
|
||||
// #if UNITY_EDITOR
|
||||
//
|
||||
//
|
||||
// if (HexManager.UnitCurrentCell.Count == 1)
|
||||
// {
|
||||
// SceneManager.LoadScene(1);
|
||||
// }
|
||||
// #endif
|
||||
}
|
||||
public void CheckDeathOrDestroy(HexCell cell)
|
||||
{
|
||||
@ -40,7 +40,7 @@ namespace HexFiled
|
||||
unitsToDeath.ForEach(x => x.Death());
|
||||
if (cell.Building != null && cell.Building.Color != cell.Color)
|
||||
{
|
||||
Object.Destroy(cell.Building);
|
||||
Object.Destroy(cell.Building.gameObject);
|
||||
}
|
||||
}
|
||||
public void SetHexColors(HexCell cell)
|
||||
|
@ -30,7 +30,7 @@ namespace Items
|
||||
public void Invoke(Action action)
|
||||
{
|
||||
OnItemUsed += action;
|
||||
if(_aimInstance == null)
|
||||
if(_aimInstance == null || !_aimInstance.activeSelf)
|
||||
_aimInstance = Object.Instantiate(aimCanvas, Unit.Instance.transform);
|
||||
else
|
||||
{
|
||||
|
@ -8,12 +8,14 @@ namespace Items
|
||||
public class ItemView : MonoBehaviour
|
||||
{
|
||||
private Item _item;
|
||||
|
||||
public bool pickedUp;
|
||||
public string itemName;
|
||||
public Item Item => _item;
|
||||
|
||||
|
||||
private void Start()
|
||||
{
|
||||
pickedUp = false;
|
||||
itemName = _item.name;
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ public class TowerView : MonoBehaviour
|
||||
public GameObject GameObject => _gameObject;
|
||||
public UnitColor UnitColor => _unitColor;
|
||||
}
|
||||
|
||||
private UnitColor _color;
|
||||
private GameObject _target;
|
||||
[SerializeField] private Weapon weapon;
|
||||
@ -56,6 +57,8 @@ public class TowerView : MonoBehaviour
|
||||
|
||||
private IEnumerator Shot()
|
||||
{
|
||||
var direction = DirectionHelper.DirectionTo(transform.position, _target.transform.position);
|
||||
weapon.Fire(transform, new Vector2(direction.x, direction.z));
|
||||
while (_target != null)
|
||||
{
|
||||
yield return new WaitForSecondsRealtime(weapon.reloadTime);
|
||||
@ -63,8 +66,9 @@ public class TowerView : MonoBehaviour
|
||||
{
|
||||
yield return null;
|
||||
}
|
||||
var direction = DirectionHelper.DirectionTo(transform.position, _target.transform.position);
|
||||
weapon.Fire(transform, new Vector2(direction.x, direction.z));
|
||||
|
||||
direction = DirectionHelper.DirectionTo(transform.position, _target.transform.position);
|
||||
weapon.Fire(transform, new Vector2(direction.x, direction.z));
|
||||
}
|
||||
}
|
||||
}
|
@ -9,10 +9,10 @@ namespace MainMenu
|
||||
public float musicVolume;
|
||||
public float sfxVolume;
|
||||
|
||||
public AudioSettings(GameMenuData data)
|
||||
public AudioSettings(float musicVolume, float sfxVolume)
|
||||
{
|
||||
musicVolume = data.musicVolume;
|
||||
sfxVolume = data.sfxVolume;
|
||||
this.musicVolume = musicVolume;
|
||||
this.sfxVolume = sfxVolume;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class EquipmentView : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 025f440838f42a14e87db46c2360aaad
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -9,7 +9,8 @@ public class FadeIn : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float duration;
|
||||
|
||||
private void OnEnable()
|
||||
|
||||
private void Start()
|
||||
{
|
||||
var back = GetComponent<Image>();
|
||||
back.DOFade(0, duration).OnComplete(() => gameObject.SetActive(false));
|
||||
|
@ -1,11 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
[CreateAssetMenu(fileName = "GameMenuData", menuName = "Data/GameMenuData", order = 0)]
|
||||
public class GameMenuData : ScriptableObject
|
||||
{
|
||||
public float musicVolume;
|
||||
public float sfxVolume;
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d81207667cf84460b3021cdd48c1471d
|
||||
timeCreated: 1639741619
|
@ -8,7 +8,6 @@ using AudioSettings = MainMenu.AudioSettings;
|
||||
public class SettingsController : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private AudioSource menuMusSrc;
|
||||
[SerializeField] private GameMenuData GameData;
|
||||
[SerializeField] private string dataFilePath;
|
||||
[SerializeField] private Slider musicSlider;
|
||||
[SerializeField] private Slider sfxSlider;
|
||||
@ -29,10 +28,12 @@ public class SettingsController : MonoBehaviour
|
||||
_audioSettings = JsonUtility.FromJson<AudioSettings>(File.ReadAllText(dataFilePath));
|
||||
else
|
||||
{
|
||||
_audioSettings = new AudioSettings(GameData);
|
||||
_audioSettings = new AudioSettings(1f, 1f);
|
||||
FileStream stream = new FileStream(dataFilePath, FileMode.Create);
|
||||
using StreamWriter writer = new StreamWriter(stream);
|
||||
writer.Write(JsonUtility.ToJson(_audioSettings));
|
||||
stream.Close();
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
musicSlider.value = _audioSettings.musicVolume;
|
||||
@ -53,7 +54,7 @@ public class SettingsController : MonoBehaviour
|
||||
sfxImage.sprite = _audioSettings.sfxVolume == 0f ? sfxOffSprite : sfxOnSprite;
|
||||
}
|
||||
|
||||
public void OnMusicSliderValueChanged()
|
||||
private void OnMusicSliderValueChanged()
|
||||
{
|
||||
_audioSettings.musicVolume = musicSlider.value;
|
||||
SetMenuMusicState();
|
||||
@ -61,7 +62,7 @@ public class SettingsController : MonoBehaviour
|
||||
UpdateVisuals();
|
||||
}
|
||||
|
||||
public void OnSFXSliderValueChanged()
|
||||
private void OnSFXSliderValueChanged()
|
||||
{
|
||||
_audioSettings.sfxVolume = sfxSlider.value;
|
||||
File.WriteAllText(dataFilePath, JsonUtility.ToJson(_audioSettings));
|
||||
|
@ -47,6 +47,7 @@ public class WeaponSelection : MonoBehaviour
|
||||
FileStream stream = new FileStream(Application.persistentDataPath + "/" + dataFilePath, FileMode.Create);
|
||||
using StreamWriter writer = new StreamWriter(stream);
|
||||
writer.Write(JsonUtility.ToJson(weapon));
|
||||
stream.Close();
|
||||
changeStats?.Invoke(weapon);
|
||||
}
|
||||
}
|
@ -47,7 +47,9 @@ public class MusicController
|
||||
public void AddAudioSource(GameObject gameObject)
|
||||
{
|
||||
var source = gameObject.AddComponent<AudioSource>();
|
||||
|
||||
source.spread = 150;
|
||||
source.minDistance = 2f;
|
||||
source.spatialBlend = 0.7f;
|
||||
_sources.Add(gameObject, source);
|
||||
}
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
using Controller;
|
||||
using Data;
|
||||
using DefaultNamespace.AI;
|
||||
using DG.Tweening;
|
||||
using Runtime.Controller;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Chars
|
||||
{
|
||||
public class EnemyController : IFixedExecute, IExecute
|
||||
{
|
||||
private Unit _enemy;
|
||||
private Camera _camera;
|
||||
|
||||
public EnemyController(UnitInfo enemyInfo, Unit enemy)
|
||||
{
|
||||
_enemy = enemy;
|
||||
_camera = Camera.main;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void FixedExecute()
|
||||
{
|
||||
//throw new System.NotImplementedException();
|
||||
}
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
if (_enemy.UnitView != null)
|
||||
{
|
||||
_enemy.UnitView.BarCanvas.transform.DOLookAt(
|
||||
_enemy.UnitView.BarCanvas.transform.position + _camera.transform.rotation * Vector3.back, 0f,
|
||||
up: _camera.transform.rotation * Vector3.up);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3a02fa710e3d4b5c898b6303e56581e2
|
||||
timeCreated: 1640196926
|
@ -14,13 +14,13 @@ using Object = UnityEngine.Object;
|
||||
|
||||
namespace Chars
|
||||
{
|
||||
public class PlayerControl : IFixedExecute
|
||||
public class PlayerControl : IFixedExecute, IDisposable
|
||||
{
|
||||
private Unit _unit;
|
||||
private Joystick _moveJoystick;
|
||||
private Joystick _attackJoystick;
|
||||
private Joystick _placeJoystick;
|
||||
private Camera _camera;
|
||||
private UnitView _unitView;
|
||||
private Vector2 _attackDircetion;
|
||||
|
||||
private PlayerInventoryView _inventoryView;
|
||||
@ -35,7 +35,7 @@ namespace Chars
|
||||
_attackJoystick = joyView.AttackJoystick;
|
||||
_placeJoystick = joyView.PlaceJoystick;
|
||||
_placeJoystick.gameObject.SetActive(false);
|
||||
_camera = Camera.main;
|
||||
_unitView = unit.UnitView;
|
||||
|
||||
_attackJoystick.OnTouchUp += DoAttack;
|
||||
_attackJoystick.OnDrug += AimCanvas;
|
||||
@ -51,7 +51,7 @@ namespace Chars
|
||||
|
||||
private void AimPlaceItem(Item item)
|
||||
{
|
||||
if (_unit.IsBusy) return;
|
||||
if (_unit.IsBusy || !_unit.IsAlive) return;
|
||||
_attackJoystick.gameObject.SetActive(false);
|
||||
_placeJoystick.gameObject.SetActive(true);
|
||||
_itemToPlace = item;
|
||||
@ -59,10 +59,11 @@ namespace Chars
|
||||
|
||||
private void PlaceItem()
|
||||
{
|
||||
if(!_unit.IsAlive) return;
|
||||
switch (_itemToPlace)
|
||||
{
|
||||
case Building building:
|
||||
_unit.UnitView.AimCanvas.SetActive(false);
|
||||
_unitView.AimCanvas.SetActive(false);
|
||||
_placeJoystick.gameObject.SetActive(false);
|
||||
if (_cellToPlace == null)
|
||||
{
|
||||
@ -86,27 +87,26 @@ namespace Chars
|
||||
|
||||
private void DoAttack()
|
||||
{
|
||||
_unit.UnitView.AimCanvas.SetActive(false);
|
||||
_unitView.AimCanvas.SetActive(false);
|
||||
_unit.StartAttack();
|
||||
}
|
||||
|
||||
private void AimCanvas(Vector2 attackDir)
|
||||
{
|
||||
if (!_unit.IsBusy)
|
||||
{
|
||||
_unit.UnitView.AimCanvas.SetActive(true);
|
||||
_unit.Aim(attackDir);
|
||||
}
|
||||
if (_unit.IsBusy || !_unit.IsAlive) return;
|
||||
|
||||
_unitView.AimCanvas.SetActive(true);
|
||||
_unit.Aim(attackDir);
|
||||
}
|
||||
|
||||
private void PlaceItemAim(Vector2 placeDir)
|
||||
{
|
||||
if (_unit.IsBusy) return;
|
||||
if (_unit.IsBusy || !_unit.IsAlive) return;
|
||||
|
||||
switch (_itemToPlace)
|
||||
{
|
||||
case Building building:
|
||||
_unit.UnitView.AimCanvas.SetActive(true);
|
||||
_unitView.AimCanvas.SetActive(true);
|
||||
_cellToPlace = _unit.PlaceItemAim(DirectionHelper.VectorToDirection(placeDir));
|
||||
break;
|
||||
case CaptureAbility ability:
|
||||
@ -119,11 +119,19 @@ namespace Chars
|
||||
|
||||
public void FixedExecute()
|
||||
{
|
||||
if (!_unit.IsBusy && _moveJoystick.Direction != Vector2.zero)
|
||||
if (!_unit.IsBusy && _unit.IsAlive && _moveJoystick.Direction != Vector2.zero)
|
||||
{
|
||||
_placeJoystick.gameObject.SetActive(false);
|
||||
_unit.Move(DirectionHelper.VectorToDirection(_moveJoystick.Direction.normalized));
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_attackJoystick.OnTouchUp -= DoAttack;
|
||||
_attackJoystick.OnDrug -= AimCanvas;
|
||||
_placeJoystick.OnDrug -= PlaceItemAim;
|
||||
_placeJoystick.OnTouchUp -= PlaceItem;
|
||||
}
|
||||
}
|
||||
}
|
@ -24,7 +24,7 @@ namespace Units
|
||||
private AnimLength _animLength;
|
||||
private HexCell _cell;
|
||||
private HexGrid _hexGrid;
|
||||
public Action<GameObject> onPlayerSpawned;
|
||||
public event Action<GameObject> OnPlayerSpawned;
|
||||
private Animator _animator;
|
||||
private UnitView _unitView;
|
||||
private bool _isBusy;
|
||||
@ -53,8 +53,8 @@ namespace Units
|
||||
public bool IsAlive => _isAlive;
|
||||
public UnitColor Color => _data.color;
|
||||
public int InventoryCapacity => _data.inventoryCapacity;
|
||||
public Action<Item> OnItemPickUp;
|
||||
public Action<Unit> OnDeath;
|
||||
public event Action<Item> OnItemPickUp;
|
||||
public event Action<Unit> OnDeath;
|
||||
public BarCanvas BarCanvas => _barCanvas;
|
||||
public GameObject Instance => _instance;
|
||||
public UnitInfo Data => _data;
|
||||
@ -208,7 +208,7 @@ namespace Units
|
||||
BarCanvas.transform.position + _camera.transform.rotation * Vector3.back,
|
||||
_camera.transform.rotation * Vector3.up);
|
||||
_isBusy = false;
|
||||
onPlayerSpawned?.Invoke(_instance);
|
||||
OnPlayerSpawned?.Invoke(_instance);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,23 +1,80 @@
|
||||
using System.Collections.Generic;
|
||||
using CamControl;
|
||||
using Controller;
|
||||
using Data;
|
||||
using DefaultNamespace.AI;
|
||||
using GameUI;
|
||||
using HexFiled;
|
||||
using Runtime.Controller;
|
||||
using Units;
|
||||
using UnityEngine;
|
||||
using Weapons;
|
||||
|
||||
namespace Chars
|
||||
{
|
||||
public class UnitFactory
|
||||
{
|
||||
private List<Unit> _units;
|
||||
private readonly HexGrid _hexGrid;
|
||||
private readonly Weapon _chosenWeapon;
|
||||
private readonly Data.Data _data;
|
||||
private readonly Controllers _controllers;
|
||||
private readonly UIController _uiController;
|
||||
private readonly PaintedController _paintedController;
|
||||
|
||||
|
||||
public UnitFactory(List<Unit> units, HexGrid grid)
|
||||
public UnitFactory(HexGrid grid, Data.Data data, UIController uiController, PaintedController paintedController,
|
||||
Controllers controllers)
|
||||
{
|
||||
_units = units;
|
||||
|
||||
_hexGrid = grid;
|
||||
_data = data;
|
||||
_chosenWeapon = data.ChosenWeapon;
|
||||
_uiController = uiController;
|
||||
_paintedController = paintedController;
|
||||
_controllers = controllers;
|
||||
}
|
||||
|
||||
public void Spawn()
|
||||
public void SpawnList(List<UnitInfo> units)
|
||||
{
|
||||
_units.ForEach(x => x.Spawn(x.Data.spawnPos));
|
||||
units.ForEach(Spawn);
|
||||
}
|
||||
|
||||
public void Spawn(UnitInfo unitInfo)
|
||||
{
|
||||
if (unitInfo.isPlayer)
|
||||
{
|
||||
var player = new Unit(unitInfo, _chosenWeapon, _hexGrid);
|
||||
PlayerControl playerControl = null;
|
||||
|
||||
CameraControl cameraControl =
|
||||
new CameraControl(Camera.main, _data.CameraData);
|
||||
_controllers.Add(cameraControl);
|
||||
|
||||
player.OnPlayerSpawned += p =>
|
||||
{
|
||||
playerControl = new PlayerControl(player, _uiController.PlayerControlView,
|
||||
_uiController.PlayerInventoryView);
|
||||
_controllers.Add(playerControl);
|
||||
};
|
||||
|
||||
player.OnDeath += unit1 => _controllers.Remove(playerControl);
|
||||
player.OnDeath += u => playerControl.Dispose();
|
||||
player.OnPlayerSpawned += cameraControl.InitCameraControl;
|
||||
|
||||
player.OnDeath += p => _uiController.AdsMob.ShowCanvas(unitInfo, this);
|
||||
player.OnDeath += _paintedController.PaintOnDeath;
|
||||
player.Spawn(unitInfo.spawnPos);
|
||||
}
|
||||
else
|
||||
{
|
||||
var enemy = new Unit(unitInfo,
|
||||
_data.WeaponsData.WeaponsList[Random.Range(0, _data.WeaponsData.WeaponsList.Count - 1)], _hexGrid);
|
||||
|
||||
|
||||
AIAgent agent = new AIAgent(unitInfo, enemy);
|
||||
enemy.OnPlayerSpawned += x => _controllers.Add(agent);
|
||||
enemy.OnDeath += x => { _controllers.Remove(agent); };
|
||||
enemy.OnDeath += _paintedController.PaintOnDeath;
|
||||
enemy.Spawn(unitInfo.spawnPos);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -161,8 +161,9 @@ public class UnitView : MonoBehaviour
|
||||
{
|
||||
ItemView itemView = other.GetComponent<ItemView>();
|
||||
|
||||
if (itemView != null && _unit.PickUpItem(itemView.Item))
|
||||
if (itemView != null && _unit.PickUpItem(itemView.Item) && !itemView.pickedUp)
|
||||
{
|
||||
itemView.pickedUp = true;
|
||||
ItemFabric.Items.Remove(itemView.gameObject);
|
||||
Destroy(itemView.gameObject);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user