This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class NPC : MonoBehaviour | |
{ | |
[SerializeField] private int startingHp = 100; | |
[SerializeField] private ParticleSystem deathParticlePrefab; | |
private int currentHp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class NPCParticles : MonoBehaviour | |
{ | |
[SerializeField] private ParticleSystem deathParticlePrefab; | |
private void Start() | |
{ | |
GetComponent<NPC>().OnNPCDied += HandleNPCDied; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class NPC : MonoBehaviour | |
{ | |
[SerializeField] | |
private int startingHp = 100; | |
[SerializeField] | |
private ParticleSystem deathParticlePrefab; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using UnityEngine.UI; | |
public class HPBar : MonoBehaviour | |
{ | |
private Slider _slider; | |
private void Start() | |
{ | |
_slider = GetComponentInChildren<Slider>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class NPC : MonoBehaviour | |
{ | |
[SerializeField] | |
private int startingHp = 100; | |
[SerializeField] | |
private UnityEngine.UI.Slider hpBarSlider; | |
[SerializeField] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using UnityEngine; | |
public class NPC : MonoBehaviour | |
{ | |
[SerializeField] | |
private int _startingHp = 100; | |
[SerializeField] | |
private UnityEngine.UI.Slider _hpBarSlider; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Vector3 TransformHelper.GetDirection(Transform source, Transform destination); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var direction = sourceTransform.DirectionTo(destinationTransform); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var direction = MyReallyBadlyNamedHelperClass.GetDirection(sourceTransform.position, destinationTransform.position); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void LookAtY(this Transform transform, Vector3 point) | |
{ | |
var lookPos = point - transform.position; | |
lookPos.y = 0; | |
var rotation = Quaternion.LookRotation(lookPos); | |
transform.rotation = rotation; | |
} |
NewerOlder