| | | 1 | | using BNG; |
| | | 2 | | using System.Diagnostics.CodeAnalysis; |
| | | 3 | | using UnityEngine; |
| | | 4 | | using HenryLab; |
| | | 5 | | |
| | | 6 | | public class LightCandle : MonoBehaviour, IGrabbableEntity |
| | | 7 | | { |
| | | 8 | | [ExcludeFromCodeCoverage] |
| | | 9 | | public Grabbable Grabbable |
| | | 10 | | { |
| | | 11 | | get |
| | | 12 | | { |
| | | 13 | | var g = GetComponent<Grabbable>(); |
| | | 14 | | if (g) return g; |
| | | 15 | | return gameObject.AddComponent<Grabbable>(); |
| | | 16 | | } |
| | | 17 | | } |
| | | 18 | | [ExcludeFromCodeCoverage] public string Name => Str.Grabbable; |
| | | 19 | | |
| | | 20 | | [ExcludeFromCodeCoverage] public Transform Destination => null; |
| | | 21 | | |
| | | 22 | | |
| | | 23 | | [ExcludeFromCodeCoverage] |
| | | 24 | | public void OnGrabbed() |
| | | 25 | | { |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | public ParticleSystem flames; |
| | | 29 | | private Rigidbody rigidbody; |
| | 2 | 30 | | public float velocityThreshold = 0.5f; |
| | | 31 | | void Start() |
| | 1 | 32 | | { |
| | 1 | 33 | | rigidbody = GetComponent<Rigidbody>(); |
| | 1 | 34 | | } |
| | | 35 | | void Update() |
| | 1196 | 36 | | { |
| | 1196 | 37 | | if (rigidbody.velocity.magnitude >= velocityThreshold) |
| | 1057 | 38 | | { |
| | 1057 | 39 | | flames.Stop(); |
| | 1057 | 40 | | } |
| | 1196 | 41 | | } |
| | | 42 | | void OnCollisionEnter(Collision collision) |
| | 3 | 43 | | { |
| | 3 | 44 | | if (collision.gameObject.CompareTag("Player")) |
| | 1 | 45 | | { |
| | 1 | 46 | | flames.Play(); |
| | 1 | 47 | | } |
| | 3 | 48 | | } |
| | | 49 | | [ExcludeFromCodeCoverage] |
| | | 50 | | public void OnReleased() |
| | | 51 | | { |
| | | 52 | | } |
| | | 53 | | } |