Merge branch 'ArrowWall' into 'main'

Arrow wall

Closes #50

See merge request kernel-panic/revival!28
This commit is contained in:
Cat Flynn 2021-03-12 18:31:43 +00:00
commit 89ec092d49
12 changed files with 1492 additions and 45 deletions

View File

@ -101,6 +101,7 @@ GameObject:
- component: {fileID: 2167937473989734407}
- component: {fileID: 6606601648879830728}
- component: {fileID: 6685677556849761150}
- component: {fileID: 4463072970378110064}
m_Layer: 0
m_Name: Player
m_TagString: Player
@ -283,6 +284,18 @@ MonoBehaviour:
m_CallState: 2
m_ActionId: 0eb55067-1328-4b0a-9494-b427befe049a
m_ActionName: CoreMap/New action
- m_PersistentCalls:
m_Calls: []
m_ActionId: 5b0a923b-469a-4829-8f31-6fcd7cb49281
m_ActionName: ArtefactPreview/LookEnable[/Mouse/leftButton]
- m_PersistentCalls:
m_Calls: []
m_ActionId: 0a5c2191-e93e-44ba-880e-189b8b33e10a
m_ActionName: ArtefactPreview/LookVelocity
- m_PersistentCalls:
m_Calls: []
m_ActionId: b118302a-6162-4223-8a6c-38ff2d6b4133
m_ActionName: ArtefactPreview/LookDelta[/Mouse/delta]
m_NeverAutoSwitchControlSchemes: 0
m_DefaultControlScheme: Gamepad
m_DefaultActionMap: CoreMap
@ -458,6 +471,23 @@ MonoBehaviour:
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!114 &4463072970378110064
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 13726836969441781}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: bb840fd42f6526f4893e136a093cf1bd, type: 3}
m_Name:
m_EditorClassIdentifier:
animator: {fileID: 0}
fadeScreen: {fileID: 0}
_respawnPosition: {fileID: 11400000, guid: 20fad56702134eb469a652ba680b48b2, type: 2}
_playerDeath: {fileID: 11400000, guid: 22fd384aef0d08146831d35c2ab7f983, type: 2}
_playerRespawn: {fileID: 11400000, guid: 6e31084a96bb93a44a85563a6208d0da, type: 2}
--- !u!1 &13726837642651461
GameObject:
m_ObjectHideFlags: 0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 55fadb9f11c9ea74fb586631ce45bd14
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1463,6 +1463,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3340651998927408399, guid: e182e6daf2f187b45a07e7c89e3f1b55, type: 3}
propertyPath: m_Enabled
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3340651998927408401, guid: e182e6daf2f187b45a07e7c89e3f1b55, type: 3}
propertyPath: m_Name
value: Kill Plane
@ -2310,15 +2314,15 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.x
value: -0.000000014901161
value: -0.000000029802322
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.y
value: -0.040505253
value: -0.040505223
objectReference: {fileID: 0}
- target: {fileID: 4676633831318799747, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalRotation.z
value: 0.0220641
value: 0.022064082
objectReference: {fileID: 0}
- target: {fileID: 4676633831388223341, guid: 8a918f60d084fbe468bf3b2c0a14fb52, type: 3}
propertyPath: m_LocalPosition.x
@ -4239,6 +4243,14 @@ PrefabInstance:
propertyPath: m_Name
value: Safe Zone
objectReference: {fileID: 0}
- target: {fileID: 4449396798674854632, guid: 373acc46f7fa7eb4b9cfba9c3e17b6ca, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4449396798674854633, guid: 373acc46f7fa7eb4b9cfba9c3e17b6ca, type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4449396798674854634, guid: 373acc46f7fa7eb4b9cfba9c3e17b6ca, type: 3}
propertyPath: m_RootOrder
value: 0
@ -5420,6 +5432,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1112305614}
m_Modifications:
- target: {fileID: 2663749718261374877, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3201523991801391447, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: _data
value:
@ -5472,6 +5488,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8781564214893312960, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
--- !u!4 &1689233312 stripped
@ -5668,6 +5688,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1112305614}
m_Modifications:
- target: {fileID: 2663749718261374877, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3201523991801391447, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: _data
value:
@ -5720,6 +5744,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8781564214893312960, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
--- !u!1 &1746912635 stripped
@ -6184,6 +6212,10 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 1112305614}
m_Modifications:
- target: {fileID: 2663749718261374877, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 3201523991801391447, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: _data
value:
@ -6236,6 +6268,10 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 8781564214893312960, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: b3a3678d38e60164dbd4f343e28f69e1, type: 3}
--- !u!4 &1887796315 stripped
@ -58143,6 +58179,14 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 1833095293156707977, guid: 8a3f2b3b16275e540b349897292a42ac, type: 3}
propertyPath: m_fontAsset
value:
objectReference: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
- target: {fileID: 1833095293156707977, guid: 8a3f2b3b16275e540b349897292a42ac, type: 3}
propertyPath: m_sharedMaterial
value:
objectReference: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
- target: {fileID: 6808448287154422772, guid: 8a3f2b3b16275e540b349897292a42ac, type: 3}
propertyPath: _preview
value:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 4cc71201ee62efb488f75c38d71a1bba
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,52 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Arrow : MonoBehaviour
{
Rigidbody rb;
// Float for speed of the arrow.
[SerializeField] private float speed;
// Float for time in seconds to wait to destroy the arrow on contact with any other gameobject that is no the player.
[SerializeField] private float waitToDestroy;
// Vector3 to set direction of travel for the arrow once the trigger is activated.
[SerializeField] private Vector3 direction;
private void Start()
{
rb = GetComponent<Rigidbody>();
}
private void OnTriggerEnter(Collider other)
{
// Checks to make sure other collider is the Player using tag.
if (other.gameObject.CompareTag("Player"))
{
rb.velocity = direction * speed;
}
}
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.TryGetComponent(out PlayerDeath playerDeath))
{
// Start Respawn coroutine.
playerDeath.Respawn();
// Destroy arrow on contact with player.
Destroy(gameObject);
}
else
{
// If arrow makes contact with any other gameobject start DestroyArrow corountine.
StartCoroutine(DestoryArrow());
}
}
public IEnumerator DestoryArrow()
{
// set arrow velocity to zero wait for destory time and then destory the arrow.
rb.velocity = Vector3.zero;
yield return new WaitForSeconds(waitToDestroy);
Destroy(gameObject);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: ba21ce2fa4afd344ea4d6e0cc7932d32
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -12,7 +12,7 @@ public class SafeZone : MonoBehaviour
private void OnTriggerStay(Collider other)
{
// Check if other game object is Player.
if (other.gameObject.name == "Player")
if (other.gameObject.CompareTag("Player"))
{
_respawnPosition.Value = other.gameObject.transform.position;
}

View File

@ -1,45 +1,14 @@
using System;
using System.Collections;
using System.Collections.Generic;
using Ktyl.Util;
using UnityEngine;
using UnityEngine.InputSystem;
public class DeathZone : MonoBehaviour
{
private GameObject player;
[SerializeField] private SerialVector3 _respawnPosition;
[SerializeField] private GameEvent _playerDeath;
[SerializeField] private GameEvent _playerRespawn;
private void OnTriggerEnter(Collider other)
{
// Checks to make sure other collider is the Player. Sets player variable as Player game object and starts the coroutine.
if (other.gameObject.CompareTag("Player"))
if (other.TryGetComponent(out PlayerDeath playerDeath))
{
player = other.gameObject;
StartCoroutine(RespawnPlayer());
playerDeath.Respawn();
}
}
// Corountine to trigger death animation, disable player movement, play fade, respawn player at last safe position and then play fade in animation and re-enable player movement.
public IEnumerator RespawnPlayer()
{
_playerDeath.Raise();
// yield return new WaitForSeconds(0.5f);
// fadeScreen.GetComponent<Animator>().SetTrigger("fadeToBlack");
yield return new WaitForSeconds(1.5f);
// move player to respawn position
player.transform.position = _respawnPosition;
// fadeScreen.GetComponent<Animator>().SetTrigger("fadeToClear");
yield return new WaitForSeconds(0.5f);
_playerRespawn.Raise();
yield return null;
}
}

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Ktyl.Util;
public class PlayerDeath : MonoBehaviour
{
[SerializeField] private SerialVector3 _respawnPosition;
[SerializeField] private GameEvent _playerDeath;
[SerializeField] private GameEvent _playerRespawn;
public void Respawn()
{
StartCoroutine(RespawnPlayerCR());
}
// raise death/respawn events with a given intermediate delay
public IEnumerator RespawnPlayerCR()
{
_playerDeath.Raise();
yield return new WaitForSeconds(1.5f);
// move player to respawn position
transform.position = _respawnPosition;
// need to wait a bit for the respawn to actually work?? >:v
yield return new WaitForSeconds(0.5f);
_playerRespawn.Raise();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb840fd42f6526f4893e136a093cf1bd
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -25,12 +25,9 @@ public class FallingRocks : MonoBehaviour
// Use OnCollison to call respawn method from DeathZone script.
private void OnCollisionEnter(Collision collision)
{
if (collision.gameObject.CompareTag("Player"))
if (collision.gameObject.TryGetComponent(out PlayerDeath playerDeath))
{
// Check code is working in log. Can be deleted at a later stage.
Debug.Log("Dead");
// Call respawn coroutine from DeathZone script.
StartCoroutine(_dz.RespawnPlayer());
playerDeath.Respawn();
}
}
}