Merge branch 'feature/109-arrow-wall-redesign' into 'main'

redesign arrow wall trap objects

Closes #109

See merge request kernel-panic/revival!53
This commit is contained in:
Cat Flynn 2021-03-22 11:51:14 +00:00
commit b0d1f36571
9 changed files with 4835 additions and 1186 deletions

View File

@ -2,4 +2,7 @@ fileFormatVersion: 2
guid: b27f58ae5d5c33a4bb2d1f4f34bd036d guid: b27f58ae5d5c33a4bb2d1f4f34bd036d
folderAsset: yes folderAsset: yes
DefaultImporter: DefaultImporter:
externalObjects: {}
userData: userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,52 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(BoxCollider))]
public class ArrowWall : MonoBehaviour
{
[SerializeField] private TrapSettings _settings;
[SerializeField] private ParticleSystem _particles;
private float _killTimer = -1;
private void OnTriggerEnter(Collider other)
{
if (!other.TryGetComponent(out PlayerDeath _)) return;
// TODO: pressure plate 'click' sound
// set kill timer to zero, start counting
_killTimer = 0;
}
private void OnTriggerStay(Collider other)
{
// bail if the other thing cant die
if (!other.TryGetComponent(out PlayerDeath playerDeath)) return;
// TODO: implications for time freeze
_killTimer += Time.deltaTime;
if (_killTimer > _settings.ArrowWall.delay)
{
// TODO: arrow whoosh noises
// reset
_particles.Play();
// kill player
playerDeath.Respawn();
_killTimer = -1;
}
}
private void OnTriggerExit(Collider other)
{
if (!other.TryGetComponent(out PlayerDeath _)) return;
_killTimer = -1;
}
}

View File

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

View File

@ -31,4 +31,13 @@ public class TrapSettings : ScriptableObject
} }
public FallawayFloorSettings FallawayFloor => _fallawayFloor; public FallawayFloorSettings FallawayFloor => _fallawayFloor;
[SerializeField] private FallawayFloorSettings _fallawayFloor; [SerializeField] private FallawayFloorSettings _fallawayFloor;
[Serializable]
public struct ArrowWallSettings
{
public float delay;
}
public ArrowWallSettings ArrowWall => _arrowWall;
[SerializeField] private ArrowWallSettings _arrowWall;
} }

View File

@ -18,3 +18,5 @@ MonoBehaviour:
_safeTime: {fileID: 11400000, guid: 27c10a061baeec8469e96d4f995c1445, type: 2} _safeTime: {fileID: 11400000, guid: 27c10a061baeec8469e96d4f995c1445, type: 2}
_shakeStrength: 0.1 _shakeStrength: 0.1
_popInEase: 27 _popInEase: 27
_arrowWall:
delay: 2