fixes + gripper done

This commit is contained in:
Sveske Juice 2024-04-20 23:32:42 +02:00
parent b28bdc2e27
commit 55d2181ebd
10 changed files with 1503 additions and 143 deletions

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -414,6 +414,109 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
--- !u!1001 &658701657
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1415246146501367120, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_Name
value: Gripper
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalPosition.x
value: 1.22
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.517
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalPosition.z
value: -0.14
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1794726729777156074, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2600338399449118553, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071068
objectReference: {fileID: 0}
- target: {fileID: 2600338399449118553, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: 2600338399449118553, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2600338399449118553, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2600338399449118553, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8606494081824023083, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: rotationMinMax.x
value: 60
objectReference: {fileID: 0}
- target: {fileID: 8606494081824023083, guid: 91554800af50ec827822f376e2fc5f64,
type: 3}
propertyPath: rotationMinMax.y
value: 120
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 91554800af50ec827822f376e2fc5f64, type: 3}
--- !u!1 &769011490
GameObject:
m_ObjectHideFlags: 0
@ -519,74 +622,6 @@ 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
@ -958,6 +993,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 00e1f7ea5be7c564faf42d035aec7f53, type: 3}
m_Name:
m_EditorClassIdentifier:
Balance: 0
IsBuildMode: 0
--- !u!4 &1395991987
Transform:
@ -1474,74 +1510,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: -90, y: 0, z: 0}
--- !u!1001 &1932692269
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalPosition.x
value: 2.750328
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalPosition.y
value: 0.33336017
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalPosition.z
value: -6.3587294
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.7071067
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.7071068
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 919132149155446097, guid: 48ecac7381f19af3bab6fef54e6dbadc,
type: 3}
propertyPath: m_Name
value: MrLazer
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 48ecac7381f19af3bab6fef54e6dbadc, type: 3}
--- !u!1 &1970787075 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 6163557566655415017, guid: fd9f9b61c0ebb324ebc9f929e26706bc,
@ -1656,8 +1624,7 @@ SceneRoots:
- {fileID: 1621186633}
- {fileID: 1797347352}
- {fileID: 1732242001}
- {fileID: 1932692269}
- {fileID: 1671091699}
- {fileID: 770231297}
- {fileID: 504816165}
- {fileID: 1395991987}
- {fileID: 658701657}

View File

@ -2,6 +2,7 @@ using UnityEngine;
public class GameManager : MonoBehaviour
{
public float Balance = 0;
public static GameManager Instance;
public bool IsBuildMode = false;
@ -11,7 +12,8 @@ public class GameManager : MonoBehaviour
selectedTower.TowerSelected(false);
selectedTower = value;
selectedTower.TowerSelected(true);
if (selectedTower != null)
selectedTower.TowerSelected(true);
}}
private void Awake()

View File

@ -35,7 +35,8 @@ public class CameraSlotClickDetect : MonoBehaviour
if (Physics.Raycast(ray, out selectHit, Mathf.Infinity, selectLayer) && !GameManager.Instance.IsBuildMode)
{
var tower = selectHit.collider.gameObject.GetComponentInChildren<Tower>();
GameManager.Instance.SelectedTower = tower;
if (tower != null)
GameManager.Instance.SelectedTower = tower;
}
}

View File

@ -38,8 +38,12 @@ public class AimTower : Tower
horizontalArc.Value.AddListener(SnapVerticalToHorizontal);
UpdateBarrelRotation();
UpdateTrajectory();
UpdateBarrelRotation();
// dont ask me why but this makes sure everything is initialized lol
TowerSelected(true);
TowerSelected(false);
}
public override void TowerSelected(bool selected)

View File

@ -24,6 +24,10 @@ public abstract class Tower : MonoBehaviour
Assert.IsNotNull(outline);
}
protected virtual void Start()
{
}
protected virtual void OnDestroy()
{
}

View File

@ -35,8 +35,9 @@ public class EditableArc : MonoBehaviour
Value.AddListener(UpdateArc);
Value.AddListener(UpdateKnobPosition);
// Set default rotation to average between min max
// Value.Value = (rotationMinMax.x + rotationMinMax.y) / 2f;
// Set default rotation to middle if outside
if (Value.Value < rotationMinMax.x || Value.Value > rotationMinMax.y)
Value.Value = (rotationMinMax.x + rotationMinMax.y) / 2f;
Assert.IsNotNull(knob, $"No knob on {this}");
knob.OnDrag += PointerDraggedOnKnob;