Пример #1
0
        public void KillPlayer(GameObject unit, PlayerAnimations animation, bool play_death_effect)
        {
            if (!player_death)
            {
                player_death     = true;
                player_unit      = unit;
                player_movements = player_unit.GetComponent <PlayerMovements>();
                player_movements.LockMovements(true);
                animator.SetAnimation(animation);
                player_movements.HealthBarVisibility(false);
                player_movements.SetPlayerHP(0);
                player_movements.ActivateSpeedBoost(false);
                if (play_death_effect)
                {
                    SpawnPool general_pool = PoolManager.Pools[CurrentLevel.GetGeneralPoolName()];
                    general_pool.Spawn(death_effect, unit.transform.position, new Quaternion(0, 0, 0, 0));
                }

                if (animation == PlayerAnimations.Death)
                {
                    player_movements.StartCoroutine(DeathAnimation());
                }
                else
                {
                    player_movements.StartCoroutine(ResurrectPlayer(RESPAWN_TIMER));
                }
            }
        }
Пример #2
0
 private void CheckPlatformType(Transform platform)
 {
     if ((platform.tag == "Snow") && (current_movement_type != PlayerMovementType.Snow))
     {
         current_movement_type = PlayerMovementType.Snow;
         last_movement_speed   = movement_speed;
         extra_movement_speed  = 0;
         ResetMovements(false, true, true);
         animations.SetAnimation(PlayerAnimations.Stand);
     }
     else if ((platform.tag == "Ice") && (current_movement_type != PlayerMovementType.Ice))
     {
         current_movement_type = PlayerMovementType.Ice;
         last_movement_speed   = ice_movement_speed;
         ResetMovements(true, false, true);
         animations.SetAnimation(PlayerAnimations.Ice);
     }
     else if ((platform.tag == "Reverse") && (current_movement_type != PlayerMovementType.Reverse))
     {
         current_movement_type = PlayerMovementType.Reverse;
         last_movement_speed   = ice_movement_speed;
         ResetMovements(true, false, true);
         animations.SetAnimation(PlayerAnimations.Ice);
     }
     else if ((platform.tag == "Straight") && (current_movement_type != PlayerMovementType.Straight))
     {
         current_movement_type = PlayerMovementType.Straight;
         last_movement_speed   = ice_movement_speed;
         ResetMovements(true, false, true);
         animations.SetAnimation(PlayerAnimations.Ice);
     }
     else if (platform.tag == "Water")
     {
         current_movement_type = PlayerMovementType.None;
         extra_movement_speed  = 0;
         ResetMovements(false, true, true);
         respawner.KillPlayer(gameObject, PlayerAnimations.Stand, false);
         SpawnPool general_pool = PoolManager.Pools[CurrentLevel.GetGeneralPoolName()];
         general_pool.Spawn(water_effect, transform.position, new Quaternion(90, 0, 0, 0));
     }
 }