Direction Selection Arrows

This commit is contained in:
brausjonas
2023-01-24 18:00:34 +01:00
parent 4f0dcefbcb
commit 025d4b974f
39 changed files with 940 additions and 88 deletions
+1 -1
View File
@@ -18,6 +18,6 @@ public class Camera : MonoBehaviour
private void FixedUpdate()
{
transform.position = Vector3.SmoothDamp(transform.position, followUp.transform.position - offset, ref velocity, 0.6f);
transform.position = Vector3.SmoothDamp(transform.position, followUp.transform.position - offset, ref velocity, 0.2f);
}
}
@@ -0,0 +1,35 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Arrow : MonoBehaviour
{
private bool clicked = false;
private void Start()
{
Deactivate();
}
public bool IsClicked()
{
return clicked;
}
public void Activate()
{
gameObject.SetActive(true);
}
public void Deactivate()
{
clicked = false;
gameObject.SetActive(false);
}
private void OnMouseDown()
{
clicked = true;
}
}
@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 62ea731c79e81374aa55c0f0bf8183c2
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -6,6 +6,7 @@ public abstract class Field : MonoBehaviour
{
//Liste der nächsten Feld, die auf das diesige Feld folgen
[SerializeField] private Field[] target;
[SerializeField] private Arrow[] directionalArrows;
public Field[] Target
{
@@ -15,6 +16,14 @@ public abstract class Field : MonoBehaviour
}
}
public Arrow[] DirectionalArrow
{
get
{
return directionalArrows;
}
}
//Feld aktion (Münzen etc..)
public abstract void Action();
}
+16 -6
View File
@@ -20,7 +20,7 @@ public class Player : MonoBehaviour
private void Start()
{
Debug.Log("Test: zum Würfeln Leertaste drücken!");
}
private void Update()
@@ -68,16 +68,27 @@ public class Player : MonoBehaviour
}
else
{
//TEST!!!!!!!!!!!!!!!
//TODO: Replace with selection arrows
if (Input.GetKeyDown(KeyCode.N))
foreach(Arrow a in nextField.DirectionalArrow)
{
a.Activate();
}
if (nextField.DirectionalArrow[0].IsClicked())
{
foreach(Arrow a in nextField.DirectionalArrow)
{
a.Deactivate();
}
nextField = nextField = nextField.Target[0];
moveTo = nextField.transform.position;
wait = false;
}
else if (Input.GetKeyDown(KeyCode.A))
else if (nextField.DirectionalArrow[1].IsClicked())
{
foreach(Arrow a in nextField.DirectionalArrow)
{
a.Deactivate();
}
nextField = nextField = nextField.Target[1];
moveTo = nextField.transform.position;
wait = false;
@@ -100,7 +111,6 @@ public class Player : MonoBehaviour
else
{
wait = true;
Debug.Log("Test: AlternativWeg = A NormalerWeg = N");
}
}