Merge branch 'main' of https://gitea.deprived.dev/Sveskejuice/3DTD
This commit is contained in:
commit
60ca297352
|
@ -179,17 +179,17 @@ PrefabInstance:
|
|||
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
value: 3.2174833
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
value: 1.0573871
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
value: -0.8372203
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 527409087646353271, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
|
@ -242,7 +242,11 @@ PrefabInstance:
|
|||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 6791947043022790992}
|
||||
m_AddedComponents: []
|
||||
m_AddedComponents:
|
||||
- targetCorrespondingSourceObject: {fileID: 872127579833310669, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
insertIndex: -1
|
||||
addedObject: {fileID: 36692134324172431}
|
||||
m_SourcePrefab: {fileID: 100100000, guid: f54a14318952c90c5b47a300aedb0d15, type: 3}
|
||||
--- !u!4 &3798190417997420117 stripped
|
||||
Transform:
|
||||
|
@ -250,3 +254,50 @@ Transform:
|
|||
type: 3}
|
||||
m_PrefabInstance: {fileID: 3739212318609641762}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &4611178744751000815 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 872127579833310669, guid: f54a14318952c90c5b47a300aedb0d15,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 3739212318609641762}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &36692134324172431
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 4611178744751000815}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 4fb850aad740b9b418ade5f74fff1818, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
radius: 1.5
|
||||
orb: {fileID: 6791947043022790992}
|
||||
affectedBodies:
|
||||
serializedVersion: 2
|
||||
m_Bits: 64
|
||||
distToAcceleration:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 20
|
||||
inSlope: -12.5
|
||||
outSlope: -12.5
|
||||
tangentMode: 34
|
||||
weightedMode: 0
|
||||
inWeight: 0
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 7.5
|
||||
inSlope: -12.5
|
||||
outSlope: -12.5
|
||||
tangentMode: 34
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
|
|
|
@ -451,6 +451,74 @@ Transform:
|
|||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &770231297
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 3.2174833
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 1.0573871
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -0.8372203
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3798190417997420117, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4611178744751000815, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BlackHole
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 1d7949721a9f0bc9ba1a8c49ca5fd099, type: 3}
|
||||
--- !u!1 &832575517
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -500,74 +568,6 @@ Transform:
|
|||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &841514572
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
serializedVersion: 3
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_Modifications:
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 1.3662028
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0.10441658
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: -1.0829077
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: -8679921383154817045, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_LocalEulerAnglesHint.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 919132149155446097, guid: 81c113ab4fb3e22748b1f98217139f12,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
value: BlackHole
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_RemovedGameObjects: []
|
||||
m_AddedGameObjects: []
|
||||
m_AddedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: 81c113ab4fb3e22748b1f98217139f12, type: 3}
|
||||
--- !u!1001 &891862850
|
||||
PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -1165,7 +1165,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: -0.1380528
|
||||
value: -0.13805284
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc,
|
||||
type: 3}
|
||||
|
@ -1180,7 +1180,7 @@ PrefabInstance:
|
|||
- target: {fileID: 7348612162646443967, guid: fd9f9b61c0ebb324ebc9f929e26706bc,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0.13815574
|
||||
value: -0.13815573
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 8882344377078016156, guid: fd9f9b61c0ebb324ebc9f929e26706bc,
|
||||
type: 3}
|
||||
|
@ -1493,6 +1493,6 @@ SceneRoots:
|
|||
- {fileID: 1621186633}
|
||||
- {fileID: 1797347352}
|
||||
- {fileID: 1732242001}
|
||||
- {fileID: 841514572}
|
||||
- {fileID: 1932692269}
|
||||
- {fileID: 1671091699}
|
||||
- {fileID: 770231297}
|
||||
|
|
|
@ -6,6 +6,9 @@ using UnityEngine.Assertions;
|
|||
|
||||
public class ProjectileTower : Tower
|
||||
{
|
||||
[SerializeField] protected EditableArc horizontalArc;
|
||||
[SerializeField] protected EditableArc verticalArc;
|
||||
|
||||
[SerializeField, Range(0.01f, 20f)] private float attackSecondsDelay = 1f;
|
||||
[SerializeField] private ProjectilePattern[] projectileSequence;
|
||||
[SerializeField] private Barrel barrel;
|
||||
|
@ -16,6 +19,10 @@ public class ProjectileTower : Tower
|
|||
private ProjectileSpawner projectileSpawner;
|
||||
|
||||
public Vector3 AimDirection => barrel.transform.forward;
|
||||
public Vector2 HorizontalRotationMinMax => horizontalArc.RotationMinMax;
|
||||
public Vector2 VerticalRotationMinMax => verticalArc.RotationMinMax;
|
||||
public float HorizontalRotation => horizontalArc.Value;
|
||||
public float VerticalRotation => verticalArc.Value;
|
||||
|
||||
protected override void Awake()
|
||||
{
|
||||
|
@ -30,11 +37,18 @@ public class ProjectileTower : Tower
|
|||
horizontalArc.Value.AddListener(UpdateTrajectory);
|
||||
verticalArc.Value.AddListener(UpdateTrajectory);
|
||||
|
||||
horizontalArc.Value.AddListener(SnapVerticalToHorizontal);
|
||||
|
||||
UpdateBarrelRotation();
|
||||
UpdateTrajectory();
|
||||
StartCoroutine(AttackLoop());
|
||||
}
|
||||
|
||||
private void SnapVerticalToHorizontal(float horizontalAngle)
|
||||
{
|
||||
verticalArc.transform.rotation = Quaternion.Euler(verticalArc.transform.rotation.eulerAngles.x, horizontalAngle, verticalArc.transform.rotation.eulerAngles.z);
|
||||
}
|
||||
|
||||
private void UpdateTrajectory(float unused) => UpdateTrajectory();
|
||||
|
||||
private void UpdateTrajectory()
|
||||
|
@ -65,6 +79,7 @@ public class ProjectileTower : Tower
|
|||
{
|
||||
horizontalArc.Value.RemoveListener(UpdateBarrelRotation);
|
||||
verticalArc.Value.RemoveListener(UpdateBarrelRotation);
|
||||
horizontalArc.Value.RemoveListener(SnapVerticalToHorizontal);
|
||||
}
|
||||
|
||||
private IEnumerator AttackLoop()
|
||||
|
|
|
@ -5,33 +5,19 @@ public abstract class Tower : MonoBehaviour
|
|||
{
|
||||
public bool towerSelected { get; set; } = true;
|
||||
|
||||
[SerializeField] protected EditableArc horizontalArc;
|
||||
[SerializeField] protected EditableArc verticalArc;
|
||||
|
||||
protected HealthComponent healthComp;
|
||||
|
||||
// Getters
|
||||
public Vector2 HorizontalRotationMinMax => horizontalArc.RotationMinMax;
|
||||
public Vector2 VerticalRotationMinMax => verticalArc.RotationMinMax;
|
||||
public float HorizontalRotation => horizontalArc.Value;
|
||||
public float VerticalRotation => verticalArc.Value;
|
||||
|
||||
protected virtual void Awake()
|
||||
{
|
||||
healthComp = GetComponent<HealthComponent>();
|
||||
Assert.IsNotNull(healthComp);
|
||||
|
||||
horizontalArc.Value.AddListener(SnapVerticalToHorizontal);
|
||||
}
|
||||
|
||||
private void SnapVerticalToHorizontal(float horizontalAngle)
|
||||
{
|
||||
verticalArc.transform.rotation = Quaternion.Euler(verticalArc.transform.rotation.eulerAngles.x, horizontalAngle, verticalArc.transform.rotation.eulerAngles.z);
|
||||
}
|
||||
|
||||
protected virtual void OnDestroy()
|
||||
{
|
||||
horizontalArc.Value.RemoveListener(SnapVerticalToHorizontal);
|
||||
}
|
||||
|
||||
protected virtual void Update()
|
||||
|
|
|
@ -9,7 +9,7 @@ public class TowerEditor : Editor
|
|||
|
||||
public void OnSceneGUI()
|
||||
{
|
||||
var tower = (serializedObject.targetObject as Component).gameObject.GetComponent<Tower>();
|
||||
var tower = (serializedObject.targetObject as Component).gameObject.GetComponent<ProjectileTower>();
|
||||
|
||||
// Draw horizontal angle
|
||||
Handles.color = Color.red;
|
||||
|
|
Loading…
Reference in New Issue