Example #1
0
        /// <summary>
        /// once the player overlaps with the hazard
        /// </summary>
        /// <param name="pm"></param>
        public override void OnOverlap(PlayerMovement pm)
        {
            // hp
            Health hp = pm.GetComponent <Health>();// is getting a reference to the player healrh

            if (hp)
            {
                hp.TakeDamage(damageAmount);// do damage to the player
            }

            Vector3 vToPlayer = (pm.transform.position - this.transform.position).normalized.normalized;

            pm.LaunchPlayer(vToPlayer * 7);// when the player its the hazard it will knock it back
        }
Example #2
0
 public void PlayerHit(PlayerMovement pm)
 {
     pm.LaunchPlayer(new Vector3(0, launch, 0));
 }
Example #3
0
 /// <summary>
 /// adds a launch effect to player when overlap or hit it
 /// </summary>
 /// <param name="pm"></param>
 public void PlayerHit(PlayerMovement pm)
 {
     pm.LaunchPlayer(new Vector3(0, launch, 0));// this launches the player up on y axis
 }