Commit 27ddb5ef authored by Parsa Rahmaty's avatar Parsa Rahmaty

Camera and Stack now move with Player

parent 756045ce
......@@ -14,9 +14,9 @@ GameObject:
- component: {fileID: 400804237596747917}
- component: {fileID: 5560186350293350528}
- component: {fileID: 1317944747836374153}
m_Layer: 0
m_Name: Sphere
m_TagString: Untagged
m_Layer: 8
m_Name: Cannonball
m_TagString: Cannonball
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
......
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &2813114490005280564
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2813114490005280567}
- component: {fileID: 2813114490005280560}
- component: {fileID: 2813114490005280561}
- component: {fileID: 2813114490005280566}
- component: {fileID: 2813114490005280563}
m_Layer: 9
m_Name: StackNode
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2813114490005280567
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
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_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &2813114490005280560
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &2813114490005280561
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
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!136 &2813114490005280566
CapsuleCollider:
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
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2813114490005280564}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8fa5977b14e9a8141884e3f5569471f6, type: 3}
m_Name:
m_EditorClassIdentifier:
fileFormatVersion: 2
guid: 6673329a28c72c44a95878ed59481a5b
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
......@@ -121,6 +121,37 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &446428162
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 446428163}
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 &446428163
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 446428162}
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_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
GameObject:
m_ObjectHideFlags: 0
......@@ -289,13 +320,78 @@ Transform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 963194225}
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
m_LocalRotation: {x: 0.2588191, y: -0, z: -0, w: 0.9659258}
m_LocalPosition: {x: 0, y: 6.72, z: -5.05}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
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
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1217394286}
- component: {fileID: 1217394287}
- component: {fileID: 1217394289}
m_Layer: 0
m_Name: Stack
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1217394286
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1217394285}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 15}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 446428163}
m_Father: {fileID: 2145345063}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!136 &1217394287
CapsuleCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1217394285}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
m_Radius: 5
m_Height: 10.5
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &1217394289
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1217394285}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e878bb183c13d5042bcae62bb09b1401, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1384577410
GameObject:
m_ObjectHideFlags: 0
......@@ -534,3 +630,190 @@ MonoBehaviour:
cannonColliders:
- {fileID: 1389915129}
- {fileID: 1384577412}
--- !u!1 &2140978673
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2140978675}
- component: {fileID: 2140978674}
- component: {fileID: 2140978676}
m_Layer: 0
m_Name: Camera Holder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2140978674
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2140978673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cff00b706ee811b448467fa040390d67, type: 3}
m_Name:
m_EditorClassIdentifier:
smoothing: 0.05
--- !u!4 &2140978675
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2140978673}
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: 963194228}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2140978676
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2140978673}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6f5b4fb209166f945960c270dd4516fa, type: 3}
m_Name:
m_EditorClassIdentifier:
smoothing: 1
--- !u!1 &2145345061
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2145345063}
- component: {fileID: 2145345062}
- component: {fileID: 2145345064}
m_Layer: 0
m_Name: Stack Holder
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2145345062
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145345061}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: cff00b706ee811b448467fa040390d67, type: 3}
m_Name:
m_EditorClassIdentifier:
smoothing: 0.05
--- !u!4 &2145345063
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145345061}
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: 1217394286}
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &2145345064
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 2145345061}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 6f5b4fb209166f945960c270dd4516fa, type: 3}
m_Name:
m_EditorClassIdentifier:
smoothing: 1
--- !u!1001 &2813114489972349221
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 446428163}
m_Modifications:
- target: {fileID: 2813114490005280564, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_Name
value: StackNode
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2813114490005280567, guid: 6673329a28c72c44a95878ed59481a5b,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 6673329a28c72c44a95878ed59481a5b, type: 3}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveWithPlayer : MonoBehaviour
{
[SerializeField] private float smoothing = 0.05f;
private Vector3 m_Velocity = Vector3.zero;
private Vector3 initialPosition;
private Vector3 targetPosition;
private Vector3 distance;
void Awake()
{
initialPosition = gameObject.transform.position;
distance = initialPosition - GameObject.FindWithTag("Player").transform.position;
targetPosition = initialPosition;
}
void FixedUpdate()
{
targetPosition = GameObject.FindWithTag("Player").transform.position + distance;
transform.position = Vector3.SmoothDamp(transform.position, targetPosition, ref m_Velocity, smoothing);
}
}
fileFormatVersion: 2
guid: cff00b706ee811b448467fa040390d67
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RotateWithPlayer : MonoBehaviour
{
[SerializeField] private float smoothing = 0.05f;
private Vector3 m_AngularVelocity = Vector3.zero;
private Quaternion initialRotation;
private Quaternion targetRotation;
private Quaternion difference;
void Awake()
{
initialRotation = gameObject.transform.rotation;
targetRotation = initialRotation;
}
void FixedUpdate()
{
targetRotation = GameObject.FindWithTag("Player").transform.rotation;
transform.rotation = Quaternion.Lerp(transform.rotation, targetRotation, smoothing);
}
}
fileFormatVersion: 2
guid: 6f5b4fb209166f945960c270dd4516fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stack : MonoBehaviour
{
private int numberOfNodes;
private LinkedList<StackNode> nodes = new LinkedList<StackNode>();
public Stack()
{
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.tag == "Cannonball")
{
// Destroy the last stack node
}
}
}
fileFormatVersion: 2
guid: e878bb183c13d5042bcae62bb09b1401
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class StackNode : MonoBehaviour
{
// Destroy node on cannonball hit
public void DestroyNode()
{
Destroy(gameObject);
}
}
fileFormatVersion: 2
guid: 8fa5977b14e9a8141884e3f5569471f6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
......@@ -3,7 +3,7 @@
--- !u!55 &1
PhysicsManager:
m_ObjectHideFlags: 0
serializedVersion: 11
serializedVersion: 13
m_Gravity: {x: 0, y: -9.81, z: 0}
m_DefaultMaterial: {fileID: 0}
m_BounceThreshold: 2
......@@ -17,11 +17,12 @@ PhysicsManager:
m_ClothInterCollisionDistance: 0
m_ClothInterCollisionStiffness: 0
m_ContactsGeneration: 1
m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_LayerCollisionMatrix: fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8fffffffefffffffaffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
m_AutoSimulation: 1
m_AutoSyncTransforms: 0
m_ReuseCollisionCallbacks: 1
m_ClothInterCollisionSettingsToggle: 0
m_ClothGravity: {x: 0, y: -9.81, z: 0}
m_ContactPairsMode: 0
m_BroadphaseType: 0
m_WorldBounds:
......@@ -31,4 +32,5 @@ PhysicsManager:
m_FrictionType: 0
m_EnableEnhancedDeterminism: 0
m_EnableUnifiedHeightmaps: 1
m_DefaultMaxAngluarSpeed: 7
m_SolverType: 0
m_DefaultMaxAngularSpeed: 7
......@@ -3,7 +3,8 @@
--- !u!78 &1
TagManager:
serializedVersion: 2
tags: []
tags:
- Cannonball
layers:
- Default
- TransparentFX
......@@ -13,9 +14,9 @@ TagManager:
- UI
-
-
-
-
-
- Cannonball
- Stack Node
- Ground
-
-
-
......
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