protected override void OnDestroy() { base.OnDestroy(); if (GlobalVariables.applicationIsQuitting) { return; } if (playerScript == null) { playerScript = GetComponent <PlayersGameplay>(); playerFXScript = GetComponent <PlayersFXAnimations>(); } playerScript.OnDashAvailable -= DashDispo; playerScript.OnDash -= Dash; playerScript.OnDashEnd -= DashEnd; playerScript.OnSafe -= SafeStart; playerScript.OnSafeEnd -= SafeEnd; playerScript.OnDeath -= DashEnd; playerFXScript.OnStunFXON -= StunON; playerFXScript.OnStunFXOFF -= StunOFF; }
// Use this for initialization protected virtual void Start() { player = gameObject.transform.parent; playerScript = player.GetComponent <PlayersGameplay>(); fxAnimationsScript = player.GetComponent <PlayersFXAnimations>(); GetComponent <MeshCollider>().enabled = false; GetComponent <MeshCollider>().enabled = true; }
protected override void Start() { base.Start(); playerScript = GetComponent <PlayersGameplay>(); playerFXScript = GetComponent <PlayersFXAnimations>(); playerScript.OnDashAvailable += DashDispo; playerScript.OnDash += Dash; playerScript.OnDashEnd += DashEnd; playerScript.OnSafe += SafeStart; playerScript.OnSafeEnd += SafeEnd; playerScript.OnDeath += DashEnd; playerFXScript.OnStunFXON += StunON; playerFXScript.OnStunFXOFF += StunOFF; }
// Use this for initialization protected virtual void Start() { triggerMask = LayerMask.GetMask("FloorMask"); playerRigidbody = GetComponent <Rigidbody>(); lifeDuration = 0; if (GameObject.FindGameObjectWithTag("MovableParent") != null) { movableParent = GameObject.FindGameObjectWithTag("MovableParent").transform; if (movableParent.childCount != 0) { playerDeadCubeTag = movableParent.GetChild(0).tag; } else { Debug.LogWarning("No Movables!"); } } magnetPoint = transform.GetChild(0).transform; transform.GetComponentInChildren <MagnetTriggerScript>().magnetPoint = magnetPoint; playerFX = GetComponent <PlayersFXAnimations>(); }