temp trajectory path

This commit is contained in:
Sveske Juice 2024-04-20 16:28:46 +02:00
parent c229215211
commit 4e68e8bd46
5 changed files with 112 additions and 125 deletions

View File

@ -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

View File

@ -645,116 +645,26 @@ PrefabInstance:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 614396578925772021, guid: 9415cb10a1bd579269301ca4f61a1554,
- 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 +685,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 +1125,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

@ -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;