Behavior choice complete

omg ça marche juste la défense il faut une reine mais en vrai c'est pas grave
This commit is contained in:
Kirabsol 2025-01-28 23:41:01 +01:00
parent 0e815e1a05
commit f52ac8863c
11 changed files with 1295 additions and 15 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 948ec571daad54f44872d10eefe50cf1
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -155,7 +155,7 @@ GameObject:
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 0
--- !u!224 &2770694185298211905 --- !u!224 &2770694185298211905
RectTransform: RectTransform:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -253,6 +253,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 77dd5b557ccc843469e1ecb32d50884e, type: 3} m_Script: {fileID: 11500000, guid: 77dd5b557ccc843469e1ecb32d50884e, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
time: {fileID: 1335902319491163578}
gameUI: {fileID: 0}
--- !u!1 &2994547276816314867 --- !u!1 &2994547276816314867
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0

View file

@ -20402,6 +20402,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 8301512717716404702, guid: a0750dd4706e5480da2ad597b62d8531, type: 3} m_CorrespondingSourceObject: {fileID: 8301512717716404702, guid: a0750dd4706e5480da2ad597b62d8531, type: 3}
m_PrefabInstance: {fileID: 1564756688} m_PrefabInstance: {fileID: 1564756688}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &1572186029 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 279674044248058329, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
m_PrefabInstance: {fileID: 4547251011800678122}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1573000769 --- !u!1001 &1573000769
PrefabInstance: PrefabInstance:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -24324,6 +24329,10 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: GameManager value: GameManager
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 4500885157334573855, guid: e0cd2add4bbdcf59a8c46048ba422a58, type: 3}
propertyPath: WinUI
value:
objectReference: {fileID: 2046072547}
- target: {fileID: 4500885157334573855, guid: e0cd2add4bbdcf59a8c46048ba422a58, type: 3} - target: {fileID: 4500885157334573855, guid: e0cd2add4bbdcf59a8c46048ba422a58, type: 3}
propertyPath: GameUI propertyPath: GameUI
value: value:
@ -27253,6 +27262,11 @@ Transform:
m_CorrespondingSourceObject: {fileID: 6208992634893184319, guid: e2eadb5c4fdf45ea995b4da7c9110275, type: 3} m_CorrespondingSourceObject: {fileID: 6208992634893184319, guid: e2eadb5c4fdf45ea995b4da7c9110275, type: 3}
m_PrefabInstance: {fileID: 2042270893} m_PrefabInstance: {fileID: 2042270893}
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
--- !u!1 &2046072547 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2477445203442906544, guid: 4149c923cb4a6114987a92556a52029b, type: 3}
m_PrefabInstance: {fileID: 792415115539954008}
m_PrefabAsset: {fileID: 0}
--- !u!1 &2047775027 --- !u!1 &2047775027
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -28624,10 +28638,6 @@ PrefabInstance:
propertyPath: m_Name propertyPath: m_Name
value: WinCanvas value: WinCanvas
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 2477445203442906544, guid: 4149c923cb4a6114987a92556a52029b, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2770694185298211905, guid: 4149c923cb4a6114987a92556a52029b, type: 3} - target: {fileID: 2770694185298211905, guid: 4149c923cb4a6114987a92556a52029b, type: 3}
propertyPath: m_Pivot.x propertyPath: m_Pivot.x
value: 0 value: 0
@ -28708,6 +28718,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z propertyPath: m_LocalEulerAnglesHint.z
value: 0 value: 0
objectReference: {fileID: 0} objectReference: {fileID: 0}
- target: {fileID: 5144714098964261609, guid: 4149c923cb4a6114987a92556a52029b, type: 3}
propertyPath: gameUI
value:
objectReference: {fileID: 681838060}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@ -29831,6 +29845,14 @@ PrefabInstance:
propertyPath: _camera propertyPath: _camera
value: value:
objectReference: {fileID: 8730717024350458101} objectReference: {fileID: 8730717024350458101}
- target: {fileID: 8122024602593529219, guid: b9a7a5b5e81a8b444a6f4ec17276f004, type: 3}
propertyPath: behaviorMenu
value:
objectReference: {fileID: 1572186029}
- target: {fileID: 8122024602593529219, guid: b9a7a5b5e81a8b444a6f4ec17276f004, type: 3}
propertyPath: behaviorLayer.m_Bits
value: 64
objectReference: {fileID: 0}
m_RemovedComponents: [] m_RemovedComponents: []
m_RemovedGameObjects: [] m_RemovedGameObjects: []
m_AddedGameObjects: [] m_AddedGameObjects: []
@ -30556,6 +30578,107 @@ MeshFilter:
m_PrefabAsset: {fileID: 0} m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7227382087281670638} m_GameObject: {fileID: 7227382087281670638}
m_Mesh: {fileID: -1472620812718112534, guid: 2f2cad356fc43243b9e657c7a69a490b, type: 3} m_Mesh: {fileID: -1472620812718112534, guid: 2f2cad356fc43243b9e657c7a69a490b, type: 3}
--- !u!1001 &4547251011800678122
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 279674044248058329, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_Name
value: Behavior Choice
objectReference: {fileID: 0}
- target: {fileID: 279674044248058329, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_Pivot.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_Pivot.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchorMax.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchorMin.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_SizeDelta.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_SizeDelta.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchoredPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_AnchoredPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6598983395310970009, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 948ec571daad54f44872d10eefe50cf1, type: 3}
--- !u!33 &4562004189529128754 --- !u!33 &4562004189529128754
MeshFilter: MeshFilter:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -32141,6 +32264,7 @@ SceneRoots:
- {fileID: 1336224317622087985} - {fileID: 1336224317622087985}
- {fileID: 4045811570301639236} - {fileID: 4045811570301639236}
- {fileID: 792415115539954008} - {fileID: 792415115539954008}
- {fileID: 4547251011800678122}
- {fileID: 1513702494036408917} - {fileID: 1513702494036408917}
- {fileID: 1024259134} - {fileID: 1024259134}
- {fileID: 3733067540770527814} - {fileID: 3733067540770527814}

View file

@ -0,0 +1,61 @@
using UnityEngine;
public class BehaviorChoice : MonoBehaviour
{
public GameObject chosenUnit;
public void Neutral()
{
if (chosenUnit.GetComponent<OffensiveBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<OffensiveBehaviour>());
}
if (chosenUnit.GetComponent<DefensiveBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<DefensiveBehaviour>());
}
if (chosenUnit.GetComponent<NeutralBehaviour>() == null)
{
chosenUnit.AddComponent<NeutralBehaviour>();
this.gameObject.SetActive(false);
}
}
public void Offensive()
{
if (chosenUnit.GetComponent<NeutralBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<NeutralBehaviour>());
}
if (chosenUnit.GetComponent<DefensiveBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<DefensiveBehaviour>());
}
if (chosenUnit.GetComponent<OffensiveBehaviour>() == null)
{
chosenUnit.AddComponent<OffensiveBehaviour>();
this.gameObject.SetActive(false);
}
}
public void Defensive()
{
if (chosenUnit.GetComponent<NeutralBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<NeutralBehaviour>());
}
if (chosenUnit.GetComponent<OffensiveBehaviour>() != null)
{
Destroy(chosenUnit.GetComponent<OffensiveBehaviour>());
}
if (chosenUnit.GetComponent<DefensiveBehaviour>() == null)
{
chosenUnit.AddComponent<DefensiveBehaviour>();
this.gameObject.SetActive(false);
}
}
}

View file

@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c6efd77ab92bc124d94cdd0f63dc60f3

View file

@ -1,11 +1,15 @@
using Unity.VisualScripting;
using UnityEngine; using UnityEngine;
using UnityEngine.AI; using UnityEngine.AI;
public class UnitPlacement : MonoBehaviour public class ShopCanvas : MonoBehaviour
{ {
[SerializeField] private Camera _camera; [SerializeField] private Camera _camera;
public Vector3 lastPosition; public Vector3 lastPosition;
[SerializeField] private LayerMask placementLayer; [SerializeField] private LayerMask placementLayer;
[SerializeField] private LayerMask behaviorLayer;
[SerializeField] private GameObject behaviorMenu;
public Vector3 MapPosition() public Vector3 MapPosition()
{ {
@ -33,4 +37,22 @@ public class UnitPlacement : MonoBehaviour
return lastPosition; return lastPosition;
} }
private void Update()
{
if (Input.GetMouseButtonDown(1))
{
Vector3 mousePos = Input.mousePosition;
mousePos.z = _camera.nearClipPlane;
Ray ray = _camera.ScreenPointToRay(mousePos);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 100, behaviorLayer))
{
GameObject unite = hit.transform.GameObject();
behaviorMenu.SetActive(true);
behaviorMenu.GetComponent<BehaviorChoice>().chosenUnit = unite;
}
}
}
} }

View file

@ -18,7 +18,7 @@ public class GameManager : MonoBehaviourSingletonPersistent<GameManager>
// Start is called once before the first execution of Update after the MonoBehaviour is created // Start is called once before the first execution of Update after the MonoBehaviour is created
void Start() void Start()
{ {
GoNextLevel();
} }
// Update is called once per frame // Update is called once per frame

View file

@ -9,7 +9,7 @@ public class UnitButton : MonoBehaviour
[SerializeField] GameObject unitPrefab; [SerializeField] GameObject unitPrefab;
[SerializeField] UnitPlacement unitPlacement; [SerializeField] ShopCanvas unitPlacement;
public event Action OnClicked, OnExit; public event Action OnClicked, OnExit;

View file

@ -1,19 +1,17 @@
using TMPro;
using UnityEngine; using UnityEngine;
using UnityEngine.SceneManagement; using UnityEngine.SceneManagement;
public class WinCanvas : MonoBehaviour public class WinCanvas : MonoBehaviour
{ {
// Start is called once before the first execution of Update after the MonoBehaviour is created [SerializeField] TextMeshProUGUI time;
[SerializeField] GameObject gameUI;
void Start() void Start()
{ {
time.text = gameUI.GetComponent<GameUI>().time.ToString();
} }
// Update is called once per frame
void Update()
{
}
public void NextLevel() public void NextLevel()
{ {