This commit is contained in:
BOT Alex 2024-04-20 17:13:23 +02:00
commit 9a7cb4c149
11 changed files with 1493 additions and 1904 deletions

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -149,12 +149,12 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
orientation: 0
samples: 15
samples: 25
visualRadius: 1
knob: {fileID: 8756968480882234867}
knobSensitiviy: 1
moveKnobAxisName: Mouse X
rotationMinMax: {x: -30, y: 30}
rotationMinMax: {x: 0, y: 360}
--- !u!1 &2485007193584062128
GameObject:
m_ObjectHideFlags: 0
@ -393,6 +393,37 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9998882d4b72010a9b0ca2d8bd35835e, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &3857615556319596175
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2164222606230954140}
m_Layer: 0
m_Name: Tip
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2164222606230954140
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3857615556319596175}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: 0.00771}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 5449894261559506427}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &8350726662087383414
GameObject:
m_ObjectHideFlags: 0
@ -419,14 +450,14 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8350726662087383414}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalRotation: {x: 0, y: 0, z: -0.7071068, w: 0.7071068}
m_LocalPosition: {x: -0.154, y: 0.433, z: -0.237}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1134124277600307769}
m_Father: {fileID: 9116936080776508834}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: -90}
--- !u!120 &1366289561210151836
LineRenderer:
serializedVersion: 2
@ -698,7 +729,7 @@ PrefabInstance:
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
value: 0.875
objectReference: {fileID: 0}
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
@ -708,7 +739,7 @@ PrefabInstance:
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
@ -718,7 +749,7 @@ PrefabInstance:
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
@ -733,7 +764,7 @@ PrefabInstance:
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
value: 90
objectReference: {fileID: 0}
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
@ -775,6 +806,10 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 3688593234855359137}
- targetCorrespondingSourceObject: {fileID: 3635969771921000238, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
insertIndex: -1
addedObject: {fileID: 2164222606230954140}
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 872127579833310669, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
@ -788,13 +823,36 @@ PrefabInstance:
type: 3}
insertIndex: -1
addedObject: {fileID: 7437064479105606814}
- targetCorrespondingSourceObject: {fileID: 1153177996425766443, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
insertIndex: -1
addedObject: {fileID: 4164347120692690677}
m_SourcePrefab: {fileID: 100100000, guid: f54a14318952c90c5b47a300aedb0d15, type: 3}
--- !u!1 &991916436778619820 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 8365322460670124409, guid: f54a14318952c90c5b47a300aedb0d15,
--- !u!4 &5449894261559506427 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 3635969771921000238, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
m_PrefabInstance: {fileID: 8778754593817981653}
m_PrefabAsset: {fileID: 0}
--- !u!1 &7625877907635197182 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1153177996425766443, guid: f54a14318952c90c5b47a300aedb0d15,
type: 3}
m_PrefabInstance: {fileID: 8778754593817981653}
m_PrefabAsset: {fileID: 0}
--- !u!114 &4164347120692690677
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7625877907635197182}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e81b110ace4ce100b765f538ff6522f, type: 3}
m_Name:
m_EditorClassIdentifier:
tip: {fileID: 2164222606230954140}
--- !u!1 &8488737342646939416 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 872127579833310669, guid: f54a14318952c90c5b47a300aedb0d15,
@ -847,9 +905,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
horizontalArc: {fileID: 8981486734084153558}
verticalArc: {fileID: 5247639431516572416}
attackSecondsDelay: 10
attackSecondsDelay: 1
projectileSequence: []
barrel: {fileID: 991916436778619820}
barrel: {fileID: 4164347120692690677}
trajectory: {fileID: 3987931586699850031}
trajectoryBounces: 4
--- !u!4 &9116936080776508834 stripped

File diff suppressed because it is too large Load Diff

View File

@ -645,116 +645,36 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 614396578925772021, guid: 9415cb10a1bd579269301ca4f61a1554,
- target: {fileID: 1366289561210151836, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_CastShadows
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7215452495559205732, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_CastShadows
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8488737342646939416, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_Name
value: Turret
objectReference: {fileID: 0}
- target: {fileID: 841175348891104259, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: projectileSequence.Array.data[0].bulletPrefab
value:
objectReference: {fileID: 1006877822}
- target: {fileID: 963397980498552487, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_Materials.Array.data[0]
value:
objectReference: {fileID: 2100000, guid: 9896f9d54cb5db749bd49b9da446a549, type: 2}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.x
value: -0.154
objectReference: {fileID: 0}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.433
objectReference: {fileID: 0}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.237
objectReference: {fileID: 0}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 4508182228569071021, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: -90
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.x
value: -0.12817177
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.73
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.z
value: 0.34760666
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.5129842
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.y
value: 0.858398
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 118.274
objectReference: {fileID: 0}
- target: {fileID: 6499929602381336473, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7437064479105606814, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: barrel
value:
objectReference: {fileID: 1890448162}
- target: {fileID: 7437064479105606814, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: attackSecondsDelay
value: 1
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.875
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalRotation.w
@ -775,22 +695,26 @@ PrefabInstance:
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 90
objectReference: {fileID: 0}
- target: {fileID: 9116936080776508834, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 9415cb10a1bd579269301ca4f61a1554, type: 3}
--- !u!1 &1006877822 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 2962360034595352958, guid: 32921dff6554af324ba0001ca8b56fee,
type: 3}
m_PrefabInstance: {fileID: 667212637924654954}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1085503232
GameObject:
m_ObjectHideFlags: 0
@ -1211,12 +1135,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!1 &1890448162 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 7625877907635197182, guid: 9415cb10a1bd579269301ca4f61a1554,
type: 3}
m_PrefabInstance: {fileID: 891862850}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &667212637924654954
PrefabInstance:
m_ObjectHideFlags: 0

View File

@ -3,27 +3,37 @@ using Cinemachine;
public class CameraController : MonoBehaviour
{
//[SerializeField] private CinemachineVirtualCamera cam;
//private CinemachineOrbitalTransposer orbitalTransposer;
[SerializeField] private GameObject cam;
//private void Start()
//{
// orbitalTransposer = cam.GetCinemachineComponent<CinemachineOrbitalTransposer>();
//}
public float scrollSpeed;
//private void Update()
//{
// if (Input.GetMouseButtonDown(1))
// {
// orbitalTransposer.m_XAxis.m_InputAxisName = "Mouse X";
// //orbitalTransposer.
// }
public Vector2 sens;
private Vector2 defaultMaxSpeed;
// if (Input.GetMouseButtonUp(1))
// {
private void Start()
{
defaultMaxSpeed *= 0;
}
// orbitalTransposer.m_XAxis.m_InputAxisName = null;
private void Update()
{
defaultMaxSpeed = new Vector2(cam.GetComponent<CinemachineFreeLook>().m_XAxis.m_MaxSpeed, cam.GetComponent<CinemachineFreeLook>().m_YAxis.m_MaxSpeed);
// }
//}
if (Input.GetMouseButtonDown(1))
{
defaultMaxSpeed = sens;
}
if (Input.GetMouseButtonUp(1))
{
defaultMaxSpeed *= 0;
}
cam.GetComponent<CinemachineFreeLook>().m_XAxis.m_MaxSpeed = defaultMaxSpeed.x;
cam.GetComponent<CinemachineFreeLook>().m_YAxis.m_MaxSpeed = defaultMaxSpeed.y;
float scroll = Input.GetAxis("Mouse ScrollWheel");
cam.GetComponent<CinemachineCameraOffset>().m_Offset.z += scroll * scrollSpeed;
}
}

View File

@ -2,33 +2,41 @@ using UnityEngine;
public class HideWall : MonoBehaviour
{
public float maxRayDistance;
[SerializeField] private GameObject target;
[SerializeField] private GameObject origin;
public GameObject prevObject;
public Material defaultMaterial; // Material when not hitting "Wall"
public Material hitMaterial; // Material when hitting "Wall"
public GameObject prevObject;
public float sphereRadius;
float maxRayDistance;
private void Start()
{
maxRayDistance = Vector3.Distance(target.transform.position, origin.transform.position) - sphereRadius * 2;
}
void Update()
{
Vector3 direction = (target.transform.position - origin.transform.position).normalized;
RaycastHit hit;
RaycastHit[] hit;
if (Physics.Raycast(origin.transform.position, direction, out hit, maxRayDistance))
hit = Physics.SphereCastAll(origin.transform.position, sphereRadius, direction, maxRayDistance);
for (int i = 0; i < hit.Length; i++)
{
if (hit.collider.CompareTag("Wall"))
if (hit[i].collider.CompareTag("Wall"))
{
if (prevObject != null)
if (prevObject == hit.collider.gameObject)
if (prevObject == hit[i].collider.gameObject)
{
var renderer = hit.collider.GetComponent<Renderer>();
var renderer = hit[i].collider.GetComponent<Renderer>();
var originalMat = renderer.material;
var originalColor = originalMat.color;
originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a *0f);
originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, 0f);
renderer.material = originalMat;
}
else
@ -36,18 +44,19 @@ public class HideWall : MonoBehaviour
var renderer = prevObject.GetComponent<Collider>().GetComponent<Renderer>();
var originalMat = renderer.material;
var originalColor = originalMat.color;
originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, originalColor.a + 1f);
originalMat.color = new Color(originalColor.r, originalColor.g, originalColor.b, 1f);
renderer.material = originalMat;
}
prevObject = hit.collider.gameObject;
prevObject = hit[i].collider.gameObject;
}
print(hit[i].collider.gameObject.name);
}
}
private void OnDrawGizmos()
{
Gizmos.color = Color.red;
Gizmos.DrawRay(origin.transform.position, (target.transform.position - origin.transform.position).normalized * maxRayDistance);
Gizmos.DrawWireSphere(origin.transform.position, sphereRadius);
}
}

View File

@ -0,0 +1,9 @@
using UnityEngine;
public class Barrel : MonoBehaviour
{
[SerializeField]
private Transform tip;
public Transform Tip => tip;
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7e81b110ace4ce100b765f538ff6522f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -9,7 +9,7 @@ public class ProjectileTower : Tower
{
[SerializeField, Range(0.01f, 20f)] private float attackSecondsDelay = 1f;
[SerializeField] private ProjectilePattern[] projectileSequence;
[SerializeField] private GameObject barrel;
[SerializeField] private Barrel barrel;
[SerializeField] private LineRenderer trajectory;
[SerializeField] private int trajectoryBounces = 2;
private const float k_trajectory_maxdist = 100f;
@ -42,12 +42,13 @@ public class ProjectileTower : Tower
{
if (trajectory == null) return;
// TODO: change to barrel tip
Vector3 origin = transform.position;
Vector3 dir = AimDirection;
Vector3 origin = barrel.Tip.position;
Vector3 dir = barrel.transform.forward;
List<Vector3> pointsInTrajectory = new();
pointsInTrajectory.Add(origin);
for (int i = 0; i < trajectoryBounces; i++)
{
Debug.DrawRay(origin, dir.normalized * k_trajectory_maxdist, Color.red, 5f);
RaycastHit hit;
if (!Physics.Raycast(origin, dir, out hit, k_trajectory_maxdist))
break;

View File

@ -37,7 +37,7 @@ public class EditableArc : MonoBehaviour
Value.AddListener(UpdateKnobPosition);
// Set default rotation to average between min max
Value.Value = (rotationMinMax.x + rotationMinMax.y) / 2f;
// Value.Value = (rotationMinMax.x + rotationMinMax.y) / 2f;
Assert.IsNotNull(knob, $"No knob on {this}");
knob.OnDrag += PointerDraggedOnKnob;
@ -71,7 +71,7 @@ public class EditableArc : MonoBehaviour
float sign = -1f;
float delta = mouseMovement * knobSensitiviy * sign;
float newAngle = Mathf.Clamp(Value.Value + delta, rotationMinMax.x, rotationMinMax.y);
float newAngle = ClampAngle(Value.Value + delta, rotationMinMax.x, rotationMinMax.y);
Value.Value = newAngle;
}
@ -100,12 +100,30 @@ public class EditableArc : MonoBehaviour
}
lineRenderer.SetPositions(positions);
// Set looop
if (angle >= 360)
lineRenderer.loop = true;
else
lineRenderer.loop = false;
}
public Vector3 SamplePointOnArc(Vector3 startPoint, Vector3 endPoint, float radius, float t)
{
float angle = Mathf.LerpAngle(rotationMinMax.x, rotationMinMax.y, t);
float angle = Mathf.Lerp(rotationMinMax.x, rotationMinMax.y, t);
Vector3 dir = Quaternion.AngleAxis(angle, normal) * tangent;
return transform.position + dir.normalized * radius;
}
public static float ClampAngle(float current, float min, float max)
{
float dtAngle = Mathf.Abs(((min - max) + 180) % 360 - 180);
float hdtAngle = dtAngle * 0.5f;
float midAngle = min + hdtAngle;
float offset = Mathf.Abs(Mathf.DeltaAngle(current, midAngle)) - hdtAngle;
if (offset > 0)
current = Mathf.MoveTowardsAngle(current, midAngle, offset);
return current;
}
}