Obj can vanish and reappear on interaction
This commit is contained in:
parent
eb1c9acdea
commit
b57f51cfb5
@ -251,7 +251,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 111805105}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 26.1, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 40.830006, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -348,7 +348,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 206662342}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 36.089996, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 50.820004, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -418,6 +418,12 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 206662342}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!4 &352496527 stripped
|
||||
Transform:
|
||||
m_CorrespondingSourceObject: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 2266619456470102847}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!1 &455582639
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -445,7 +451,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 455582639}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 46.079998, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 60.81, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -542,7 +548,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 561001795}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 66.009995, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 75.57, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -824,6 +830,8 @@ Transform:
|
||||
m_Children:
|
||||
- {fileID: 2041855513}
|
||||
- {fileID: 1992316510}
|
||||
- {fileID: 352496527}
|
||||
- {fileID: 1026411780}
|
||||
m_Father: {fileID: 778227310}
|
||||
m_RootOrder: 16
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -854,7 +862,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 749443133}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 26.099998, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 40.830006, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -999,7 +1007,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 840320351}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 73.89, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 83.450005, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -1096,7 +1104,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 899030641}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 66.009995, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 75.57, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -1394,6 +1402,118 @@ MonoBehaviour:
|
||||
duration: 1
|
||||
knockback: 1
|
||||
stunDir: {x: 1000, y: 1000}
|
||||
--- !u!1 &1026411779
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1026411780}
|
||||
- component: {fileID: 1026411783}
|
||||
- component: {fileID: 1026411782}
|
||||
- component: {fileID: 1026411781}
|
||||
- component: {fileID: 1026411784}
|
||||
m_Layer: 6
|
||||
m_Name: Cube
|
||||
m_TagString: Vanishing
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1026411780
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1026411779}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 20.08, y: 12.45, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 663828001}
|
||||
m_RootOrder: 3
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!65 &1026411781
|
||||
BoxCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1026411779}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
serializedVersion: 2
|
||||
m_Size: {x: 1, y: 1, z: 1}
|
||||
m_Center: {x: 0, y: 0, z: 0}
|
||||
--- !u!23 &1026411782
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1026411779}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
|
||||
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
|
||||
m_AdditionalVertexStreams: {fileID: 0}
|
||||
--- !u!33 &1026411783
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1026411779}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!114 &1026411784
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1026411779}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9701f1b28a113754d906bf5b88f98178, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
timeToVanish: 2
|
||||
timeToAppear: 1
|
||||
--- !u!1 &1070079036
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1421,7 +1541,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1070079036}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 46.079998, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 60.81, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -1491,6 +1611,26 @@ MeshFilter:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1070079036}
|
||||
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &1094313414 stripped
|
||||
GameObject:
|
||||
m_CorrespondingSourceObject: {fileID: 507150368010421230, guid: 9723b3e4256aab94e99ca1c7527bb38d,
|
||||
type: 3}
|
||||
m_PrefabInstance: {fileID: 507150369097360936}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
--- !u!114 &1094313422
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1094313414}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 9701f1b28a113754d906bf5b88f98178, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
timeToVanish: 1
|
||||
timeToAppear: 2
|
||||
--- !u!1 &1166806157
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1518,7 +1658,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1166806157}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 56, y: 10.1, z: 0}
|
||||
m_LocalPosition: {x: 70.73001, y: 10.1, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -2026,7 +2166,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1678058221}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 36.089996, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 50.820004, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -2220,7 +2360,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1815050698}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 73.89, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 83.450005, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -2390,7 +2530,7 @@ Transform:
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 2006523531}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 56, y: 20.7, z: 0}
|
||||
m_LocalPosition: {x: 70.73001, y: 20.7, z: 0}
|
||||
m_LocalScale: {x: 2.8042, y: 2.8042, z: 6.9}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
@ -2544,6 +2684,11 @@ PrefabInstance:
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 663828001}
|
||||
m_Modifications:
|
||||
- target: {fileID: 507150368010421230, guid: 9723b3e4256aab94e99ca1c7527bb38d,
|
||||
type: 3}
|
||||
propertyPath: m_TagString
|
||||
value: Vanishing
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 507150368245936245, guid: 9723b3e4256aab94e99ca1c7527bb38d,
|
||||
type: 3}
|
||||
propertyPath: m_Name
|
||||
@ -2611,12 +2756,17 @@ PrefabInstance:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 0}
|
||||
m_TransformParent: {fileID: 663828001}
|
||||
m_Modifications:
|
||||
- target: {fileID: 2266619454697635466, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
propertyPath: m_Layer
|
||||
value: 6
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
propertyPath: m_RootOrder
|
||||
value: 7
|
||||
value: 2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
@ -2641,17 +2791,17 @@ PrefabInstance:
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 2266619454732308705, guid: 5929ab1e380d0d24eb14edf221c4e219,
|
||||
type: 3}
|
||||
|
||||
@ -133,6 +133,9 @@ public class GrappleHook : MonoBehaviour
|
||||
joint.damper = grappleDamper;
|
||||
joint.massScale = 4.5f;
|
||||
|
||||
if(hit.transform.tag.Equals("Vanishing")){
|
||||
hit.transform.gameObject.GetComponent<Vanisher>().Begin(this);
|
||||
}
|
||||
currGrappleEndPos = transform.position;
|
||||
}
|
||||
|
||||
@ -169,6 +172,10 @@ public void Stun(float duration){
|
||||
EndGrapple();
|
||||
Invoke("UnStun", duration);
|
||||
}
|
||||
|
||||
public void Unhook(){
|
||||
EndGrapple();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region InputActions
|
||||
|
||||
37
Assets/Scripts/Vanisher.cs
Normal file
37
Assets/Scripts/Vanisher.cs
Normal file
@ -0,0 +1,37 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Vanisher : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
private float timeToVanish;
|
||||
[SerializeField]
|
||||
private float timeToAppear;
|
||||
private GrappleHook grapple;
|
||||
private bool isVanishing = false;
|
||||
//TODO represent obj is breaking
|
||||
public void Begin(GrappleHook grapple){
|
||||
if(isVanishing)return;
|
||||
this.grapple = grapple;
|
||||
Invoke("Vanish", timeToVanish);
|
||||
isVanishing = true;
|
||||
}
|
||||
|
||||
private void Vanish(){
|
||||
grapple.Unhook();
|
||||
gameObject.SetActive(false);
|
||||
Invoke("Appear", timeToAppear);
|
||||
isVanishing = false;
|
||||
}
|
||||
|
||||
private void Appear(){
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
|
||||
private void OnCollisionEnter(Collision other) {
|
||||
if(other.gameObject.tag.Equals("Player")){
|
||||
Begin(other.gameObject.GetComponent<GrappleHook>());
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/Vanisher.cs.meta
Normal file
11
Assets/Scripts/Vanisher.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9701f1b28a113754d906bf5b88f98178
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -3,7 +3,8 @@
|
||||
--- !u!78 &1
|
||||
TagManager:
|
||||
serializedVersion: 2
|
||||
tags: []
|
||||
tags:
|
||||
- Vanishing
|
||||
layers:
|
||||
- Default
|
||||
- TransparentFX
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user