mirror of
https://github.com/ConjureETS/VZ.git
synced 2026-03-24 02:11:15 +00:00
Added Pathfinding & Direction
This commit is contained in:
parent
7cc15fdd42
commit
baca9e1d20
1645
Assets/Scenes/gab.unity
Normal file
1645
Assets/Scenes/gab.unity
Normal file
File diff suppressed because it is too large
Load Diff
8
Assets/Scenes/gab.unity.meta
Normal file
8
Assets/Scenes/gab.unity.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcefa9118fcea874ba82acd1df164e32
|
||||
timeCreated: 1439236349
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
32
Assets/Scripts/CharacterMovement.cs
Normal file
32
Assets/Scripts/CharacterMovement.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class CharacterMovement : MonoBehaviour {
|
||||
|
||||
public int player;
|
||||
|
||||
public MovementManager mm;
|
||||
|
||||
enum direction { up = "Up",down = "Down", left = "Left", right = "Right", stop = "Stop" };
|
||||
|
||||
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
}
|
||||
|
||||
public void UpdateDirection()
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/CharacterMovement.cs.meta
Normal file
12
Assets/Scripts/CharacterMovement.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bee059a115db707408e1a8a8214d1c4c
|
||||
timeCreated: 1439332359
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/Scripts/MovementManager.cs
Normal file
84
Assets/Scripts/MovementManager.cs
Normal file
@ -0,0 +1,84 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
|
||||
public class MovementManager : MonoBehaviour
|
||||
{
|
||||
|
||||
public Queue<string> p1MovBuffer = new Queue<string>(4); // Buffer de mouvement pour le player 1
|
||||
public Queue<string> p2MovBuffer = new Queue<string>(4); //Buffer de mouvement pour le player 2
|
||||
|
||||
// Use this for initialization
|
||||
void Awake()
|
||||
{
|
||||
p1MovBuffer.Enqueue("Stop");
|
||||
p2MovBuffer.Enqueue("Stop");
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
ReadMovement();
|
||||
Debug.Log(p1MovBuffer.Peek() + " " + p2MovBuffer.Peek());
|
||||
|
||||
}
|
||||
|
||||
void ReadMovement()
|
||||
{
|
||||
if (Input.GetKeyDown(KeyCode.W))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Up");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.A))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Left");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.S))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Down");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.D))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Right");
|
||||
}
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.I))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Up");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.J))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Left");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.K))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Down");
|
||||
}
|
||||
else if (Input.GetKeyDown(KeyCode.L))
|
||||
{
|
||||
p1MovBuffer.Enqueue("Right");
|
||||
}
|
||||
}
|
||||
|
||||
string getNextDirection(int playerID)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (playerID == 1)
|
||||
{
|
||||
return p1MovBuffer.Dequeue();
|
||||
}
|
||||
else if (playerID == 2)
|
||||
{
|
||||
return p2MovBuffer.Dequeue();
|
||||
}
|
||||
}catch(Invalide e)
|
||||
{
|
||||
return "Stop";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
12
Assets/Scripts/MovementManager.cs.meta
Normal file
12
Assets/Scripts/MovementManager.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58bf12fc7f7dfb9419306d55b94c77b6
|
||||
timeCreated: 1439327857
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
35
Assets/Scripts/Node.cs
Normal file
35
Assets/Scripts/Node.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Node : MonoBehaviour {
|
||||
|
||||
public Node n_up;
|
||||
public Node n_left;
|
||||
public Node n_down;
|
||||
public Node n_right;
|
||||
|
||||
public Vector3 pos;
|
||||
|
||||
void Start()
|
||||
{
|
||||
pos = gameObject.transform.position;
|
||||
}
|
||||
|
||||
|
||||
void OnDrawGizmosSelected() {
|
||||
if (n_up != null) {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(pos, n_up.pos);
|
||||
}else if (n_left != null) {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(pos, n_left.pos);
|
||||
}else if (n_down != null) {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(pos, n_down.pos);
|
||||
}else if (n_right != null) {
|
||||
Gizmos.color = Color.red;
|
||||
Gizmos.DrawLine(pos, n_right.pos);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
12
Assets/Scripts/Node.cs.meta
Normal file
12
Assets/Scripts/Node.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ef5779c31ae1e344e918bafb5061a31e
|
||||
timeCreated: 1439240437
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
24
Assets/Scripts/Path.cs
Normal file
24
Assets/Scripts/Path.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Path{
|
||||
|
||||
Node start;
|
||||
Node end;
|
||||
|
||||
public Path(Node start,Node end){
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
||||
//TODO fonction de points
|
||||
|
||||
}
|
||||
|
||||
|
||||
Vector3 getNext()
|
||||
{
|
||||
|
||||
return Vector3.one;
|
||||
}
|
||||
|
||||
}
|
||||
12
Assets/Scripts/Path.cs.meta
Normal file
12
Assets/Scripts/Path.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b5515fca9c85963498137a7a41550f13
|
||||
timeCreated: 1439240491
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
20
Assets/Scripts/Pathfinding.cs
Normal file
20
Assets/Scripts/Pathfinding.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class Pathfinding : MonoBehaviour {
|
||||
|
||||
public Transform target;
|
||||
NavMeshAgent agent;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
agent = GetComponent<NavMeshAgent> ();
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
|
||||
agent.SetDestination (target.position);
|
||||
|
||||
}
|
||||
}
|
||||
12
Assets/Scripts/Pathfinding.cs.meta
Normal file
12
Assets/Scripts/Pathfinding.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0f200319be173a744b3096ba4d6a1673
|
||||
timeCreated: 1439238331
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
9
Assets/Shaders/Gab.meta
Normal file
9
Assets/Shaders/Gab.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6aabdc9ae3315d249b4581347bc67f7c
|
||||
folderAsset: yes
|
||||
timeCreated: 1439234568
|
||||
licenseType: Free
|
||||
DefaultImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
138
Assets/Shaders/Gab/Path.mat
Normal file
138
Assets/Shaders/Gab/Path.mat
Normal file
@ -0,0 +1,138 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: Path
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
data:
|
||||
first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
data:
|
||||
first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Cutoff
|
||||
second: .5
|
||||
data:
|
||||
first:
|
||||
name: _Parallax
|
||||
second: .0199999996
|
||||
data:
|
||||
first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _Glossiness
|
||||
second: .5
|
||||
data:
|
||||
first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Metallic
|
||||
second: .63499999
|
||||
m_Colors:
|
||||
data:
|
||||
first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _Color
|
||||
second: {r: .0758619234, g: 0, b: 1, a: 1}
|
||||
8
Assets/Shaders/Gab/Path.mat.meta
Normal file
8
Assets/Shaders/Gab/Path.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9cd1c8a5acbe7242a6d91dd1e77f8ab
|
||||
timeCreated: 1439236657
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
138
Assets/Shaders/Gab/placeholder.mat
Normal file
138
Assets/Shaders/Gab/placeholder.mat
Normal file
@ -0,0 +1,138 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!21 &2100000
|
||||
Material:
|
||||
serializedVersion: 6
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_Name: placeholder
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords:
|
||||
m_LightmapFlags: 5
|
||||
m_CustomRenderQueue: -1
|
||||
stringTagMap: {}
|
||||
m_SavedProperties:
|
||||
serializedVersion: 2
|
||||
m_TexEnvs:
|
||||
data:
|
||||
first:
|
||||
name: _MainTex
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _BumpMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _ParallaxMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _EmissionMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailMask
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _DetailAlbedoMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
data:
|
||||
first:
|
||||
name: _MetallicGlossMap
|
||||
second:
|
||||
m_Texture: {fileID: 0}
|
||||
m_Scale: {x: 1, y: 1}
|
||||
m_Offset: {x: 0, y: 0}
|
||||
m_Floats:
|
||||
data:
|
||||
first:
|
||||
name: _SrcBlend
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DstBlend
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Cutoff
|
||||
second: .5
|
||||
data:
|
||||
first:
|
||||
name: _Parallax
|
||||
second: .0199999996
|
||||
data:
|
||||
first:
|
||||
name: _ZWrite
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _Glossiness
|
||||
second: .848999977
|
||||
data:
|
||||
first:
|
||||
name: _BumpScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _OcclusionStrength
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _DetailNormalMapScale
|
||||
second: 1
|
||||
data:
|
||||
first:
|
||||
name: _UVSec
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Mode
|
||||
second: 0
|
||||
data:
|
||||
first:
|
||||
name: _Metallic
|
||||
second: .661000013
|
||||
m_Colors:
|
||||
data:
|
||||
first:
|
||||
name: _EmissionColor
|
||||
second: {r: 0, g: 0, b: 0, a: 1}
|
||||
data:
|
||||
first:
|
||||
name: _Color
|
||||
second: {r: 1, g: 0, b: 0, a: 1}
|
||||
8
Assets/Shaders/Gab/placeholder.mat.meta
Normal file
8
Assets/Shaders/Gab/placeholder.mat.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d69a5d051f78e1e4bb139da129cb646d
|
||||
timeCreated: 1439234580
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Loading…
x
Reference in New Issue
Block a user