redesign arrow wall trap objects

This commit is contained in:
Cat Flynn 2021-03-18 17:25:34 +00:00
parent 7893db3d19
commit 91be3b97b9
9 changed files with 4835 additions and 1186 deletions

View File

@ -2,4 +2,7 @@ fileFormatVersion: 2
guid: b27f58ae5d5c33a4bb2d1f4f34bd036d
folderAsset: yes
DefaultImporter:
externalObjects: {}
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;
[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}
_shakeStrength: 0.1
_popInEase: 27
_arrowWall:
delay: 2