Update SurvivalIsland
This commit is contained in:
1 parent
a779d1dd79
commit
d33bc2d31c
18 files changed
+192
-5
No files matched your search
@@ -0,0 +1,42 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class PlayerCollisions : MonoBehaviour {
|
||||
bool doorIsOpen = false;
|
||||
float doorTimer = 0.0f;
|
||||
public float doorOpenTime = 3.0f;
|
||||
public AudioClip doorOpenSound;
|
||||
public AudioClip doorShutSound;
|
||||
|
||||
GameObject currentDoor;
|
||||
|
||||
// Use this for initialization
|
||||
void Start () {
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update () {
|
||||
if (doorIsOpen) {
|
||||
doorTimer += Time.deltaTime;
|
||||
|
||||
if (doorTimer > doorOpenTime) {
|
||||
Door (doorShutSound, false, "doorshut",currentDoor);
|
||||
doorTimer = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnControllerColliderHit(ControllerColliderHit hit) {
|
||||
if (hit.gameObject.tag == "playerDoor" && doorIsOpen == false) {
|
||||
currentDoor = hit.gameObject;
|
||||
Door (doorOpenSound, true, "dooropen",currentDoor);
|
||||
}
|
||||
}
|
||||
|
||||
void Door(AudioClip aClip, bool openCheck, string animName,GameObject thisDoor) {
|
||||
thisDoor.audio.PlayOneShot (aClip);
|
||||
doorIsOpen = openCheck;
|
||||
thisDoor.transform.parent.animation.Play (animName);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 479fe5da19b4fba4b9ea55d26873d375
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
Reference in new issue
Block a user