some c# script work
This commit is contained in:
parent
de7ff223ca
commit
9df12ce204
|
@ -1689,7 +1689,7 @@ PrefabInstance:
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 7c6479b7e0d25a747a6b2a88e81eeaa6, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 7c6479b7e0d25a747a6b2a88e81eeaa6, type: 3}
|
||||||
propertyPath: m_LocalPosition.z
|
propertyPath: m_LocalPosition.z
|
||||||
value: -30.6674
|
value: -30.6833
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: -8679921383154817045, guid: 7c6479b7e0d25a747a6b2a88e81eeaa6, type: 3}
|
- target: {fileID: -8679921383154817045, guid: 7c6479b7e0d25a747a6b2a88e81eeaa6, type: 3}
|
||||||
propertyPath: m_LocalRotation.w
|
propertyPath: m_LocalRotation.w
|
||||||
|
|
13
Assets/props/doors/door1/DoorUnlock.cs
Normal file
13
Assets/props/doors/door1/DoorUnlock.cs
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class DoorUnlock : Lockable
|
||||||
|
{
|
||||||
|
public override void StartUnlock(){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
public override void FailedUnlock(){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
11
Assets/props/doors/door1/DoorUnlock.cs.meta
Normal file
11
Assets/props/doors/door1/DoorUnlock.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5ce9749f8b04eee4896e68462ad25738
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
|
@ -8,7 +8,7 @@ Material:
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: postit UV 0
|
m_Name: postit UV 0
|
||||||
m_Shader: {fileID: 4800000, guid: 05c011ffd97fbb34d86b3a2d3bf5b7a9, type: 3}
|
m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
|
||||||
m_ValidKeywords: []
|
m_ValidKeywords: []
|
||||||
m_InvalidKeywords:
|
m_InvalidKeywords:
|
||||||
- VIGNETTE_MASKED
|
- VIGNETTE_MASKED
|
||||||
|
@ -3026,7 +3026,7 @@ Material:
|
||||||
- _MochieSpecularTint: {r: 1, g: 1, b: 1, a: 1}
|
- _MochieSpecularTint: {r: 1, g: 1, b: 1, a: 1}
|
||||||
- _MultilayerMathBlurMapPan: {r: 0, g: 0, b: 0, a: 0}
|
- _MultilayerMathBlurMapPan: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- _NormalCorrectOrigin: {r: 0, g: 0.4, b: -0.025, a: 1}
|
- _NormalCorrectOrigin: {r: 0, g: 0.4, b: -0.025, a: 1}
|
||||||
- _OutlineColor: {r: 1, g: 1, b: 1, a: 1}
|
- _OutlineColor: {r: 0, g: 0, b: 0, a: 1}
|
||||||
- _OutlineDropShadowOffset: {r: 1, g: 0, b: 0, a: 0}
|
- _OutlineDropShadowOffset: {r: 1, g: 0, b: 0, a: 0}
|
||||||
- _OutlineMaskPan: {r: 0, g: 0, b: 0, a: 0}
|
- _OutlineMaskPan: {r: 0, g: 0, b: 0, a: 0}
|
||||||
- _OutlinePersonaDirection: {r: 1, g: 0, b: 0, a: 0}
|
- _OutlinePersonaDirection: {r: 1, g: 0, b: 0, a: 0}
|
||||||
|
|
8
Assets/scripts.meta
Normal file
8
Assets/scripts.meta
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 838404684af601d4599d686ccbcec4b3
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
33
Assets/scripts/Lockable.cs
Normal file
33
Assets/scripts/Lockable.cs
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
// if locked is true, calling TryUnlock will call StartUnlock, otherwise it will call FailedUnlock.
|
||||||
|
|
||||||
|
public abstract class Lockable : MonoBehaviour
|
||||||
|
{
|
||||||
|
public bool looping = true;
|
||||||
|
public bool loopingAfterUnlock = false;
|
||||||
|
public bool locked = true;
|
||||||
|
|
||||||
|
private bool runBefore = false;
|
||||||
|
private bool unlockedBefore = false;
|
||||||
|
|
||||||
|
public abstract void StartUnlock();
|
||||||
|
public abstract void FailedUnlock();
|
||||||
|
|
||||||
|
public void TryUnlock(){
|
||||||
|
if((!runBefore) | looping){
|
||||||
|
runBefore = true;
|
||||||
|
if(!locked){
|
||||||
|
if((!unlockedBefore) | loopingAfterUnlock){
|
||||||
|
unlockedBefore = true;
|
||||||
|
StartUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
FailedUnlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/scripts/Lockable.cs.meta
Normal file
11
Assets/scripts/Lockable.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9e2b8adf68baf6b4ca2f7976d0ab8a60
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
15
Assets/scripts/Unlocker.cs
Normal file
15
Assets/scripts/Unlocker.cs
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
// when Unlock() is called, sets locked to false for all attached Lockables
|
||||||
|
|
||||||
|
public class Unlocker : MonoBehaviour
|
||||||
|
{
|
||||||
|
public List<Lockable> attachedLockables = new List<Lockable>();
|
||||||
|
public void Unlock(){
|
||||||
|
foreach(Lockable lockable in attachedLockables){
|
||||||
|
lockable.locked = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
11
Assets/scripts/Unlocker.cs.meta
Normal file
11
Assets/scripts/Unlocker.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
fileFormatVersion: 2
|
||||||
|
guid: afdc71e568c06fa479327632679b7632
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
Loading…
Reference in a new issue