Beispiel #1
0
        static void Prefix(Projectile __instance, ref Transform ___m_cur_target, ref float ___m_homing_cur_strength,
                           ref float ___m_target_timer, ref Robot ___m_cur_target_robot, ref Player ___m_cur_target_player)
        {
            var proj = __instance;

            if (!MPHoming.UseNonFixedHoming(proj))
            {
                return;
            }
            var frametime_GAME = RUtility.FRAMETIME_GAME;

            if (proj.m_acceleration != 0f)
            {
                Vector3 b = proj.c_transform.forward * (proj.m_acceleration * frametime_GAME);
                proj.c_rigidbody.velocity += b;
            }
            if (proj.m_homing_strength > 0f)
            {
                if (___m_cur_target == null)
                {
                    ___m_homing_cur_strength = 0f;
                    if (proj.m_homing_strength > 0f && ___m_target_timer <= 0f)
                    {
                        proj.FindATarget();
                        ___m_target_timer = 0.05f;
                    }
                }
                else
                {
                    ___m_homing_cur_strength = Mathf.Min(___m_homing_cur_strength + frametime_GAME * proj.m_homing_acquire_speed, proj.m_homing_strength);
                    if (proj.TargetAlive())
                    {
                        if (proj.m_homing_min_dot < -0.9f)
                        {
                            proj.MoveTowardsTarget();
                        }
                        else
                        {
                            proj.SteerTowardsTarget();
                        }
                        if (___m_target_timer <= 0f)
                        {
                            proj.FindATarget();
                            ___m_target_timer = 0.15f;
                        }
                    }
                    else
                    {
                        ___m_cur_target          = null;
                        ___m_cur_target_robot    = null;
                        ___m_cur_target_player   = null;
                        ___m_homing_cur_strength = 0f;
                    }
                }
            }
        }
Beispiel #2
0
 public static float MaxDegrees(Projectile proj, float m_homing_cur_strength)
 {
     return(MPHoming.UseNonFixedHoming(proj) ?
            m_homing_cur_strength * RUtility.FRAMETIME_GAME / RUtility.FRAMETIME_FIXED * 1.8f + 0.08f :
            m_homing_cur_strength *RUtility.FIXED_FT_RATIO);
 }