void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } DontDestroyOnLoad(gameObject); rb = GetComponent <Rigidbody2D>(); animator = GetComponent <Animator>(); health = GetComponent <PlayerHealth>(); melee = GetComponent <PlayerMelee>(); dash = GetComponent <PlayerDash>(); projectile = GetComponent <PlayerProjectile>(); interact = GetComponent <PlayerInteract>(); unlock = GetComponent <PlayerUnlock>(); knockback = GetComponent <PlayerKnockback>(); audioSource = GetComponent <AudioSource>(); }
void Start() { fullHealth = health; knockback = gameObject.GetComponent<PlayerKnockback> (); invincible = false; foreach (int threatLayer in threatLayers) Physics.IgnoreLayerCollision (gameObject.layer, threatLayer, false); }