public void Start() { playerscript = PlayerEntityScript.instance; defaultValue = slider.maxValue; playerscript.OnPlayerHealthChangedEvent += SetHealth; SetHealth(); }
private void OnCollisionEnter2D(Collision2D collision) { PlayerEntityScript p = collision.collider.GetComponent <PlayerEntityScript>(); if (p != null) { p.TakeDamage(damage, p.transform.position - transform.position, knockbackForce); GetComponent <Rigidbody2D>().velocity = Vector2.zero; } }
// Start is called before the first frame update public override void Awake() { base.Awake(); if (instance == null) { instance = this; } else { Destroy(gameObject); } }