Commit 0833cbb3 authored by Parsa Rahmaty's avatar Parsa Rahmaty

Stacks added, the nodes can rotate

parent 27ddb5ef
fileFormatVersion: 2
guid: a1d3eaa086a9a5f418f962e335c7a14b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!134 &13400000
PhysicMaterial:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Node
dynamicFriction: 0.6
staticFriction: 0.6
bounciness: 0
frictionCombine: 0
bounceCombine: 0
fileFormatVersion: 2
guid: 767de626f0734e747b948a518e3e7918
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2984237215047306181
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2984237215047306180}
- component: {fileID: 4028788090995854451}
m_Layer: 0
m_Name: Node Holder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2984237215047306180
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2984237215047306181}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4028788090995854451
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2984237215047306181}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 13374e0c672524b4bb588748d040d0df, type: 3}
m_Name:
m_EditorClassIdentifier:
stackNodeObject: {fileID: 1469019900825895114, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
fileFormatVersion: 2
guid: 90b16e9d09448504aa823b8ca0032ddf
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -11,8 +11,10 @@ GameObject:
- component: {fileID: 2813114490005280567}
- component: {fileID: 2813114490005280560}
- component: {fileID: 2813114490005280561}
- component: {fileID: 2813114490005280566}
- component: {fileID: 2813114490005280563}
- component: {fileID: 1469019900825895114}
- component: {fileID: 1239118069581175081}
- component: {fileID: 1551914874522532703}
m_Layer: 9
m_Name: StackNode
m_TagString: Untagged
......@@ -30,7 +32,8 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 0.25, z: 10}
m_Children: []
m_Children:
- {fileID: 6023010212252713845}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
......@@ -81,21 +84,20 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!136 &2813114490005280566
CapsuleCollider:
--- !u!114 &2813114490005280563
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 0.5000001
m_Height: 2
m_Direction: 1
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!114 &2813114490005280563
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8fa5977b14e9a8141884e3f5569471f6, type: 3}
m_Name:
m_EditorClassIdentifier:
rotationSpeed: 20
--- !u!114 &1469019900825895114
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
......@@ -104,6 +106,115 @@ MonoBehaviour:
m_GameObject: {fileID: 2813114490005280564}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8fa5977b14e9a8141884e3f5569471f6, type: 3}
m_Script: {fileID: 11500000, guid: 6af9c6b1989ec8b4985459fa969b2f02, type: 3}
m_Name:
m_EditorClassIdentifier:
health: 1
--- !u!54 &1239118069581175081
Rigidbody:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
serializedVersion: 2
m_Mass: 1
m_Drag: 0
m_AngularDrag: 0.05
m_UseGravity: 0
m_IsKinematic: 0
m_Interpolate: 0
m_Constraints: 90
m_CollisionDetection: 0
--- !u!65 &1551914874522532703
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
m_Material: {fileID: 13400000, guid: 767de626f0734e747b948a518e3e7918, type: 2}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1.0000001, y: 2, z: 1.0000002}
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!1 &5094898662465186538
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6023010212252713845}
- component: {fileID: 1203169594875834969}
- component: {fileID: 5788632802884759433}
m_Layer: 9
m_Name: Sphere
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6023010212252713845
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5094898662465186538}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.682, y: 0, z: 0}
m_LocalScale: {x: 0.1, y: 4, z: 0.1}
m_Children: []
m_Father: {fileID: 2813114490005280567}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &1203169594875834969
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5094898662465186538}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &5788632802884759433
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5094898662465186538}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
......@@ -121,7 +121,7 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &446428162
--- !u!1 &58095958
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
......@@ -129,29 +129,97 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 446428163}
m_Layer: 0
m_Name: Node Holder
- component: {fileID: 58095959}
- component: {fileID: 58095962}
- component: {fileID: 58095961}
- component: {fileID: 58095960}
m_Layer: 10
m_Name: Cylinder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &446428163
--- !u!4 &58095959
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 446428162}
m_GameObject: {fileID: 58095958}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1040879122}
m_Father: {fileID: 1217394286}
m_LocalPosition: {x: 0, y: -2, z: 15}
m_LocalScale: {x: 30, y: 0.25, z: 30}
m_Children: []
m_Father: {fileID: 768744113}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!65 &58095960
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 58095958}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1.0000001, y: 2, z: 1.0000002}
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
--- !u!23 &58095961
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 58095958}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &58095962
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 58095958}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!4 &446428163 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
m_PrefabInstance: {fileID: 2984237214688264135}
m_PrefabAsset: {fileID: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
......@@ -244,6 +312,37 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &768744112
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 768744113}
m_Layer: 10
m_Name: Ground
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &768744113
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 768744112}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 58095959}
m_Father: {fileID: 0}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &963194225
GameObject:
m_ObjectHideFlags: 0
......@@ -327,12 +426,6 @@ Transform:
m_Father: {fileID: 2140978675}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 30, y: 0, z: 0}
--- !u!4 &1040879122 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
m_PrefabInstance: {fileID: 2813114489972349221}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1217394285
GameObject:
m_ObjectHideFlags: 0
......@@ -344,7 +437,7 @@ GameObject:
- component: {fileID: 1217394286}
- component: {fileID: 1217394287}
- component: {fileID: 1217394289}
m_Layer: 0
m_Layer: 11
m_Name: Stack
m_TagString: Untagged
m_Icon: {fileID: 0}
......@@ -392,6 +485,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: e878bb183c13d5042bcae62bb09b1401, type: 3}
m_Name:
m_EditorClassIdentifier:
numberOfNodes: 30
nodesLeft: 0
--- !u!1 &1384577410
GameObject:
m_ObjectHideFlags: 0
......@@ -748,72 +843,77 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
smoothing: 1
--- !u!1001 &2813114489972349221
--- !u!1001 &2984237214688264135
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 446428163}
m_TransformParent: {fileID: 1217394286}
m_Modifications:
- target: {fileID: 2813114490005280564, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 1448479530122692290, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_Name
value: StackNode
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
- target: {fileID: 2984237215047306180, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2984237215047306181, guid: 90b16e9d09448504aa823b8ca0032ddf,
type: 3}
propertyPath: m_Name
value: Node Holder
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6673329a28c72c44a95878ed59481a5b, type: 3}
m_SourcePrefab: {fileID: 100100000, guid: 90b16e9d09448504aa823b8ca0032ddf, type: 3}
fileFormatVersion: 2
guid: 6eb39b150795f6f41ac738a517455e41
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class DestroyableObject : MonoBehaviour
{
[SerializeField] public int health;
// Decrement health and returns true if health turned to zero
public bool TakeDamage(int damage)
{
health -= damage;
if(health <= 0)
{
Destroy(gameObject);
return true;
}
return false;
}
public void Kill()
{
Destroy(gameObject);
}
}
fileFormatVersion: 2
guid: 6af9c6b1989ec8b4985459fa969b2f02
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: d97e8a7231bff17409538512aa911e93
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,9 +4,9 @@ using UnityEngine;
public class CannonControls : MonoBehaviour
{
[SerializeField] private GameObject projectile;
[SerializeField] private float shootingDelay;
[SerializeField] private Collider[] cannonColliders;
[SerializeField] private GameObject projectile = null;
[SerializeField] private float shootingDelay = 0.2f;
[SerializeField] private Collider[] cannonColliders = null;
private float delay;
private float framesLeftToShoot = 0f; // the number of frames passed since last shot
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class NodeHolder : MonoBehaviour
{
public LinkedList<DestroyableObject> nodes { get; private set; }
[SerializeField] private DestroyableObject stackNodeObject = null;
void Awake()
{
nodes = new LinkedList<DestroyableObject>();
}
public void MakeNodes(int numberOfNodes)
{
for(int i = 0; i < nodes.Count; i++)
{
nodes.First.Value.Kill();
nodes.RemoveFirst();
}
// The linked list is now empty
for(int i = 0; i < numberOfNodes; i++)
{
DestroyableObject node = Instantiate(stackNodeObject);
node.transform.parent = gameObject.transform;
node.transform.localPosition = new Vector3(0f, i * 0.5f, 0f);
nodes.AddLast(node);
}
}
public void RemoveBottomNode()
{
if (nodes.Count != 0)
{
DestroyableObject node = nodes.First.Value;
nodes.RemoveFirst();
Destroy(node.gameObject);
}
}
public DestroyableObject GetBottomNode()
{
return nodes.First.Value;
}
}
fileFormatVersion: 2
guid: 13374e0c672524b4bb588748d040d0df
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -4,12 +4,15 @@ using UnityEngine;
public class Stack : MonoBehaviour
{
private int numberOfNodes;
private LinkedList<StackNode> nodes = new LinkedList<StackNode>();
public int numberOfNodes;
[HideInInspector] public int nodesLeft;
private NodeHolder nodeHolder = null;
public Stack()
void Awake()
{
nodeHolder = gameObject.transform.GetChild(0).GetComponent<NodeHolder>();
nodeHolder.MakeNodes(numberOfNodes);
}
private void OnCollisionEnter(Collision collision)
......@@ -17,7 +20,9 @@ public class Stack : MonoBehaviour
if (collision.gameObject.tag == "Cannonball")
{
// Destroy the last stack node
Destroy(collision.gameObject);
nodeHolder.RemoveBottomNode();
nodesLeft--;
}
}
}
......@@ -4,10 +4,10 @@ using UnityEngine;
public class StackNode : MonoBehaviour
{
[SerializeField] private float rotationSpeed = 10f;
// Destroy node on cannonball hit
public void DestroyNode()
void FixedUpdate()
{
Destroy(gameObject);
transform.localEulerAngles += new Vector3(0f, rotationSpeed * Time.fixedDeltaTime, 0f);
}
}
......@@ -17,7 +17,7 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8fffffffefffffffaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8fffffff6fffffff2fffffff9ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1
......
......@@ -17,7 +17,7 @@ TagManager:
- Cannonball
- Stack Node
- Ground
-
- Stack
-
-
-
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment