Merge branch 'main' into clement
This commit is contained in:
commit
4e82be610a
6 changed files with 288 additions and 17 deletions
|
@ -767,7 +767,19 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 20164805}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 20164803}
|
||||
m_TargetAssemblyTypeName: UnitButton, Assembly-CSharp
|
||||
m_MethodName: StartPlacing
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &20164805
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -3077,7 +3089,7 @@ MonoBehaviour:
|
|||
m_VertexBufferAutoSizeReduction: 0
|
||||
m_useMaxVisibleDescender: 1
|
||||
m_pageToDisplay: 1
|
||||
m_margin: {x: 0, y: 0, z: 0.012481665, w: 0}
|
||||
m_margin: {x: 43.125782, y: 0, z: 46.30258, w: 0}
|
||||
m_isUsingLegacyAnimationComponent: 0
|
||||
m_isVolumetricText: 0
|
||||
m_hasFontAssetChanged: 0
|
||||
|
@ -8227,7 +8239,7 @@ GameObject:
|
|||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &546001050
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -8790,6 +8802,7 @@ MonoBehaviour:
|
|||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
_camera: {fileID: 8730717024350458101}
|
||||
lastPosition: {x: 0, y: 0, z: 0}
|
||||
placementLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 8
|
||||
|
@ -8876,7 +8889,7 @@ RectTransform:
|
|||
- {fileID: 1299052269}
|
||||
- {fileID: 335362245}
|
||||
- {fileID: 1326704818}
|
||||
- {fileID: 2065769867}
|
||||
- {fileID: 2142292411}
|
||||
- {fileID: 546001050}
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
|
@ -18471,7 +18484,19 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 1299052272}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1299052270}
|
||||
m_TargetAssemblyTypeName: UnitButton, Assembly-CSharp
|
||||
m_MethodName: StartPlacing
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1299052272
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -19485,7 +19510,7 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8432779344647231755, guid: 87b84199a88b2822fb7a2a230db2f0ba, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -26.346624
|
||||
value: -4.6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8432779344647231755, guid: 87b84199a88b2822fb7a2a230db2f0ba, type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
|
@ -19493,7 +19518,7 @@ PrefabInstance:
|
|||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8432779344647231755, guid: 87b84199a88b2822fb7a2a230db2f0ba, type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -5.309149
|
||||
value: -28.3
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8432779344647231755, guid: 87b84199a88b2822fb7a2a230db2f0ba, type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
|
@ -27907,7 +27932,19 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 1931254092}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 1931254090}
|
||||
m_TargetAssemblyTypeName: UnitButton, Assembly-CSharp
|
||||
m_MethodName: StartPlacing
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &1931254092
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -29482,7 +29519,7 @@ Transform:
|
|||
m_GameObject: {fileID: 2002548185}
|
||||
serializedVersion: 2
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: -46.1, y: 2.81, z: 56.2}
|
||||
m_LocalPosition: {x: -46.1, y: 2.3, z: 56.2}
|
||||
m_LocalScale: {x: 2.3030813, y: 2.3030813, z: 2.3030813}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
|
@ -30717,6 +30754,7 @@ GameObject:
|
|||
- component: {fileID: 2065769867}
|
||||
- component: {fileID: 2065769869}
|
||||
- component: {fileID: 2065769868}
|
||||
- component: {fileID: 2065769870}
|
||||
m_Layer: 5
|
||||
m_Name: Crown
|
||||
m_TagString: Untagged
|
||||
|
@ -30731,17 +30769,17 @@ RectTransform:
|
|||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2065769866}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.44016, y: 0.44016, z: 0.44016}
|
||||
m_LocalScale: {x: 1.5500991, y: 0.27223474, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 879565805}
|
||||
m_Father: {fileID: 584956885}
|
||||
m_Father: {fileID: 2142292411}
|
||||
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: 271, y: 147.99998}
|
||||
m_AnchoredPosition: {x: -0.00018310547, y: 0.00012207031}
|
||||
m_SizeDelta: {x: 100, y: 100}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2065769868
|
||||
|
@ -30779,6 +30817,23 @@ CanvasRenderer:
|
|||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2065769866}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!114 &2065769870
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2065769866}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 0d450b2674075c944a534648ddbb139c, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
texte: {fileID: 879565806}
|
||||
_camera: {fileID: 8730717024350458101}
|
||||
placementLayer:
|
||||
serializedVersion: 2
|
||||
m_Bits: 64
|
||||
--- !u!1001 &2066998217
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -31349,7 +31404,19 @@ MonoBehaviour:
|
|||
m_TargetGraphic: {fileID: 2109768018}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls: []
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 2109768016}
|
||||
m_TargetAssemblyTypeName: UnitButton, Assembly-CSharp
|
||||
m_MethodName: StartPlacing
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &2109768018
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -31934,6 +32001,139 @@ Transform:
|
|||
m_CorrespondingSourceObject: {fileID: 6208992634893184319, guid: e2eadb5c4fdf45ea995b4da7c9110275, type: 3}
|
||||
m_PrefabInstance: {fileID: 2131583151}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &2142292410
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 2142292411}
|
||||
- component: {fileID: 2142292414}
|
||||
- component: {fileID: 2142292413}
|
||||
- component: {fileID: 2142292412}
|
||||
m_Layer: 5
|
||||
m_Name: Button
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &2142292411
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2142292410}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.28395602, y: 1.6168399, z: 0.44015998}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children:
|
||||
- {fileID: 2065769867}
|
||||
m_Father: {fileID: 584956885}
|
||||
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: 271.00003, y: 147.99979}
|
||||
m_SizeDelta: {x: 160, y: 30}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!114 &2142292412
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2142292410}
|
||||
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: 2142292413}
|
||||
m_OnClick:
|
||||
m_PersistentCalls:
|
||||
m_Calls:
|
||||
- m_Target: {fileID: 2065769870}
|
||||
m_TargetAssemblyTypeName: Crown, Assembly-CSharp
|
||||
m_MethodName: StartCrown
|
||||
m_Mode: 1
|
||||
m_Arguments:
|
||||
m_ObjectArgument: {fileID: 0}
|
||||
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
|
||||
m_IntArgument: 0
|
||||
m_FloatArgument: 0
|
||||
m_StringArgument:
|
||||
m_BoolArgument: 0
|
||||
m_CallState: 2
|
||||
--- !u!114 &2142292413
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2142292410}
|
||||
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: 0, g: 0, b: 0, 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: 10905, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Type: 1
|
||||
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!222 &2142292414
|
||||
CanvasRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2142292410}
|
||||
m_CullTransparentMesh: 1
|
||||
--- !u!4 &105823620233657495
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
|
|
64
Assets/Scripts/Crown.cs
Normal file
64
Assets/Scripts/Crown.cs
Normal file
|
@ -0,0 +1,64 @@
|
|||
using System;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class Crown : MonoBehaviour
|
||||
{
|
||||
|
||||
public event Action OnClicked;
|
||||
private bool crowned=false;
|
||||
[SerializeField] TextMeshProUGUI texte;
|
||||
|
||||
|
||||
[SerializeField] private Camera _camera;
|
||||
[SerializeField] private LayerMask placementLayer;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
texte.enabled = false;
|
||||
}
|
||||
|
||||
public void StartCrown()
|
||||
{
|
||||
if (!crowned)
|
||||
{
|
||||
Debug.Log("Crowning right now");
|
||||
texte.enabled = true;
|
||||
OnClicked += Crowning;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public GameObject ObjectPosition()
|
||||
{
|
||||
Vector3 mousePos = Input.mousePosition;
|
||||
mousePos.z = _camera.nearClipPlane;
|
||||
Ray ray = _camera.ScreenPointToRay(mousePos);
|
||||
RaycastHit hit;
|
||||
|
||||
if (Physics.Raycast(ray, out hit, 100, placementLayer))
|
||||
{
|
||||
OnClicked -= Crowning;
|
||||
return hit.transform.gameObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void Crowning()
|
||||
{
|
||||
GameObject unit = ObjectPosition();
|
||||
unit.GetComponent<AbstractUnit>().IsQueen = true;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
OnClicked?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
2
Assets/Scripts/Crown.cs.meta
Normal file
2
Assets/Scripts/Crown.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0d450b2674075c944a534648ddbb139c
|
|
@ -12,6 +12,7 @@ public class UnitButton : MonoBehaviour
|
|||
[SerializeField] GameObject unitPrefab;
|
||||
[SerializeField] UnitPlacement unitPlacement;
|
||||
public event Action OnClicked, OnExit;
|
||||
private bool clicked;
|
||||
|
||||
private int cost;
|
||||
[SerializeField] TextMeshProUGUI texteCout;
|
||||
|
@ -33,10 +34,12 @@ public class UnitButton : MonoBehaviour
|
|||
else
|
||||
{
|
||||
Debug.Log("I'm *in");
|
||||
GlobalsVariable.Pay(cost);
|
||||
|
||||
//Mask.SetActive(true);
|
||||
|
||||
OnClicked += PlaceUnit;
|
||||
OnExit += StopPlacing;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,6 +47,8 @@ public class UnitButton : MonoBehaviour
|
|||
{
|
||||
Vector3 mousePos = unitPlacement.MapPosition();
|
||||
GameObject go = Instantiate(unitPrefab, mousePos, Quaternion.identity);
|
||||
GlobalsVariable.Pay(cost);
|
||||
OnClicked -= PlaceUnit;
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ using UnityEngine.AI;
|
|||
public class UnitPlacement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Camera _camera;
|
||||
private Vector3 lastPosition;
|
||||
public Vector3 lastPosition;
|
||||
[SerializeField] private LayerMask placementLayer;
|
||||
|
||||
public Vector3 MapPosition()
|
||||
|
|
|
@ -12,7 +12,7 @@ public abstract class AbstractUnit : MonoBehaviour
|
|||
{
|
||||
public float price;
|
||||
[field: SerializeField] public bool IsTeamA { get; private set; }
|
||||
[field: SerializeField] public bool IsQueen { get; private set; }
|
||||
[field: SerializeField] public bool IsQueen { get; set; }
|
||||
|
||||
public abstract void TakeDamage(float damage);
|
||||
public abstract void Heal(float heal);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue