Start Unit PLacement
navmesh not working yet
This commit is contained in:
parent
afe60bae57
commit
49c5e6df9f
19 changed files with 40382 additions and 89 deletions
86
Assets/Materials/Mask.mat
Normal file
86
Assets/Materials/Mask.mat
Normal file
|
@ -0,0 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: Mask
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _ALPHAPREMULTIPLY_ON
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 2800000, guid: d3784dbc5c9c4844387f5925b5a377e8, type: 3}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0.06851736, b: 0, a: 1}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
8
Assets/Materials/Mask.mat.meta
Normal file
8
Assets/Materials/Mask.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 70189152d6b63c94b9f8b1dcf0e22130
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
86
Assets/Materials/StartArea.mat
Normal file
86
Assets/Materials/StartArea.mat
Normal file
|
@ -0,0 +1,86 @@
|
|||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 8
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name: StartArea
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_Parent: {fileID: 0}
|
||||
m_ModifiedSerializedProperties: 0
|
||||
m_ValidKeywords:
|
||||
- _ALPHAPREMULTIPLY_ON
|
||||
m_InvalidKeywords: []
|
||||
m_LightmapFlags: 4
|
||||
m_EnableInstancingVariants: 0
|
||||
m_DoubleSidedGI: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
stringTagMap:
|
||||
RenderType: Transparent
|
||||
disabledShaderPasses: []
|
||||
m_LockedProperties:
|
||||
m_SavedProperties:
|
||||
serializedVersion: 3
|
||||
m_TexEnvs:
|
||||
- _BumpMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailAlbedoMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailMask:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _DetailNormalMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _EmissionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MainTex:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _MetallicGlossMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _OcclusionMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
- _ParallaxMap:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _BumpScale: 1
|
||||
- _Cutoff: 0.5
|
||||
- _DetailNormalMapScale: 1
|
||||
- _DstBlend: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0.5
|
||||
- _GlossyReflections: 1
|
||||
- _Metallic: 0
|
||||
- _Mode: 3
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 1
|
||||
- _SrcBlend: 1
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0, b: 0.07550669, a: 0.50980395}
|
||||
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
|
||||
m_BuildTextureStacks: []
|
||||
m_AllowLocking: 1
|
8
Assets/Materials/StartArea.mat.meta
Normal file
8
Assets/Materials/StartArea.mat.meta
Normal file
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a2f035a0cba46f4438179e0f32656634
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -68,6 +68,10 @@ PrefabInstance:
|
|||
propertyPath: 'm_Materials.Array.data[0]'
|
||||
value:
|
||||
objectReference: {fileID: 2100000, guid: a38977bd6318aa9c8a271d57b9b1ae20, type: 2}
|
||||
- target: {fileID: 6218773337069610966, guid: bf7c543165ee934ae8da97fec74d051a, type: 3}
|
||||
propertyPath: m_Enabled
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 6682366767980116205, guid: bf7c543165ee934ae8da97fec74d051a, type: 3}
|
||||
propertyPath: 'm_Materials.Array.data[0]'
|
||||
value:
|
||||
|
|
35220
Assets/Scenes/LevelsTest/Flat 2.unity
Normal file
35220
Assets/Scenes/LevelsTest/Flat 2.unity
Normal file
File diff suppressed because it is too large
Load diff
7
Assets/Scenes/LevelsTest/Flat 2.unity.meta
Normal file
7
Assets/Scenes/LevelsTest/Flat 2.unity.meta
Normal file
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 109024a7678496448b19252211a05150
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
File diff suppressed because it is too large
Load diff
|
@ -26,7 +26,7 @@ public class CameraMouvement : MonoBehaviour
|
|||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
print("Update");
|
||||
//print("Update");
|
||||
var mouvement = moveSpeed * Time.deltaTime * (new Vector3(_moveInput.y, 0, -_moveInput.x));
|
||||
transform.Translate(mouvement, Space.World);
|
||||
}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using System;
|
||||
|
||||
public class Cost : MonoBehaviour
|
||||
{
|
||||
private int cost;
|
||||
[SerializeField] TextMeshProUGUI texteCout;
|
||||
[SerializeField] TextMeshProUGUI unit;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
cost = GlobalsVariable.prices[unit.text];
|
||||
texteCout.text = cost.ToString();
|
||||
}
|
||||
}
|
70
Assets/Scripts/UnitButton.cs
Normal file
70
Assets/Scripts/UnitButton.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
using Unity.VisualScripting;
|
||||
using System;
|
||||
|
||||
public class UnitButton : MonoBehaviour
|
||||
{
|
||||
|
||||
[SerializeField] private GameObject Mask;
|
||||
|
||||
[SerializeField] GameObject unitPrefab;
|
||||
[SerializeField] UnitPlacement unitPlacement;
|
||||
public event Action OnClicked, OnExit;
|
||||
|
||||
private int cost;
|
||||
[SerializeField] TextMeshProUGUI texteCout;
|
||||
[SerializeField] TextMeshProUGUI unit;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
private void Start()
|
||||
{
|
||||
cost = GlobalsVariable.prices[unit.text];
|
||||
texteCout.text = cost.ToString();
|
||||
}
|
||||
|
||||
public void StartPlacing()
|
||||
{
|
||||
if (GlobalsVariable.money < cost)
|
||||
{
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("I'm *in");
|
||||
GlobalsVariable.Pay(cost);
|
||||
//Mask.SetActive(true);
|
||||
OnClicked += PlaceUnit;
|
||||
OnExit += StopPlacing;
|
||||
}
|
||||
}
|
||||
|
||||
void PlaceUnit()
|
||||
{
|
||||
Vector3 mousePos = unitPlacement.MapPosition();
|
||||
GameObject go = Instantiate(unitPrefab);
|
||||
go.transform.position = mousePos;
|
||||
|
||||
}
|
||||
|
||||
public void StopPlacing()
|
||||
{
|
||||
//Mask.SetActive(false);
|
||||
OnClicked -= PlaceUnit;
|
||||
OnExit -= StopPlacing;
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
OnClicked?.Invoke();
|
||||
}
|
||||
|
||||
if (Input.GetMouseButtonDown(1))
|
||||
{
|
||||
OnExit?.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
21
Assets/Scripts/UnitPlacement.cs
Normal file
21
Assets/Scripts/UnitPlacement.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using UnityEngine;
|
||||
|
||||
public class UnitPlacement : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Camera _camera;
|
||||
private Vector3 lastPosition;
|
||||
[SerializeField] private LayerMask placementLayer;
|
||||
|
||||
public Vector3 MapPosition()
|
||||
{
|
||||
Vector3 mousePos = Input.mousePosition;
|
||||
mousePos.z = _camera.nearClipPlane;
|
||||
Ray ray = _camera.ScreenPointToRay(mousePos);
|
||||
RaycastHit hit;
|
||||
if (Physics.Raycast(ray,out hit, 100, placementLayer))
|
||||
{
|
||||
lastPosition = hit.point;
|
||||
}
|
||||
return lastPosition;
|
||||
}
|
||||
}
|
2
Assets/Scripts/UnitPlacement.cs.meta
Normal file
2
Assets/Scripts/UnitPlacement.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 1f4860e618b2df541be28bc841173bb6
|
|
@ -4,6 +4,9 @@ using UnityEngine;
|
|||
|
||||
public static class GlobalsVariable
|
||||
{
|
||||
|
||||
public static int money=100;
|
||||
|
||||
public static List<AbstractUnit> AliveUnitsTeamA = new List<AbstractUnit>();
|
||||
public static List<AbstractUnit> AliveUnitsTeamB = new List<AbstractUnit>();
|
||||
|
||||
|
@ -18,4 +21,14 @@ public static class GlobalsVariable
|
|||
{ "Sorcičre",3 },
|
||||
{ "Golem",8 }
|
||||
};
|
||||
|
||||
public static void Pay(int X)
|
||||
{
|
||||
money -= X;
|
||||
}
|
||||
|
||||
public static void Gain(int Y)
|
||||
{
|
||||
money += Y;
|
||||
}
|
||||
}
|
||||
|
|
22
Assets/Scripts/Wallet.cs
Normal file
22
Assets/Scripts/Wallet.cs
Normal file
|
@ -0,0 +1,22 @@
|
|||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
public class Wallet : MonoBehaviour
|
||||
{
|
||||
|
||||
private int argent;
|
||||
[SerializeField] TextMeshProUGUI argentTexte;
|
||||
|
||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
argent = GlobalsVariable.money;
|
||||
argentTexte.text = argent.ToString();
|
||||
}
|
||||
}
|
2
Assets/Scripts/Wallet.cs.meta
Normal file
2
Assets/Scripts/Wallet.cs.meta
Normal file
|
@ -0,0 +1,2 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d14bc8b31a8eb5a4ebec1a208eda3a26
|
Loading…
Add table
Add a link
Reference in a new issue