public void TurretGroupAimCursor() { if (selected_group == null) { return; } selected_group.follow_target = false; selected_group.direction = true; group_follows_cursor = !group_follows_cursor; selected_group.SetTgtDir(direction); selected_group.direction = true; current_group = selected_group; }
///<summary> This should be called from the third frame on </summary> private void BattleSymbolsUpdate() { // Defines Target Target target = player_script.target; ReferenceSystem ref_sys = SceneGlobals.ReferenceSystem; // Projects the player's "absolute" velocity (relative to the origin of the scene) if (PlayerShip != null && ref_sys.RelativeVelocity(PlayerShip.Velocity) != Vector3.zero) { Image prog = pointers["prograde_marker"]; ProjectVecOnScreen(ref_sys.RelativeVelocity(PlayerShip.Velocity), camera_transform, ref prog); } // Projects the players relative velocity to his selected target if (target.Exists) { if (!target.virt_ship) { if (PlayerShip.Velocity - target.Ship.Velocity != Vector3.zero) { Image tgt_vel = pointers["target_velocity_marker"]; ProjectVecOnScreen(PlayerShip.Velocity - target.Ship.Velocity, camera_transform, ref tgt_vel); } } } // Weapon indicators foreach (Weapon w in PlayerShip.Parts.GetAll <Weapon>()) { Image img = weapon_states[w]; Vector3 new_pos = MainCam.WorldToScreenPoint(player_transform.position + (player_transform.forward * 100000)); new_pos.z = 0; img.rectTransform.position = new_pos; if (w.ooo_time > 0) { float ratio = 1 - (w.ooo_time / w.init_ooo_time) * .75f; img.color = new Color(ratio, ratio, ratio); } else { img.color = new Color(1f, 1 - w.heat, 1 - w.heat); } } // Turret Indicators foreach (Turret t in PlayerShip.Parts.GetAll <Turret>()) { Image img = turret_states[t]; Vector3 new_pos = MainCam.WorldToScreenPoint(transform.position + (t.BarrelRot * Vector3.forward * 100000f)); new_pos.z = 0; img.rectTransform.position = new_pos; if (t.ooo_time > 0) { float ratio = 1 - (t.ooo_time / t.init_ooo_time) * .75f; img.color = new Color(ratio, ratio, ratio); } else { img.color = new Color(1f, 1 - t.heat, 1 - t.heat); } } // Draws the "direction pointer" (the velocity direction) Vector3 direction_projection = direction == Vector3.zero ? new Vector3(-200, -200) : MainCam.WorldToScreenPoint(direction + transform.position); direction_projection.z = 0; pointers ["direction_pointer"].transform.position = direction_projection; Vector3 velocity_dir = PlayerShip.Velocity == Vector3.zero ? new Vector3(-200, -200) : MainCam.WorldToScreenPoint(PlayerShip.Position + PlayerShip.Velocity.normalized * 1e9f); velocity_dir.z = 0; pointers ["prograde"].transform.position = velocity_dir; pointers ["prograde"].color = Vector3.Angle(PlayerShip.Velocity, camera_transform.forward) < 90f ? Color.green : Color.red; if (player_script.target != null) { if (player_script.target.Exists) { tgting_point = player_script.target.Position; } } if (group_follows_cursor) { if (current_group != null) { current_group.SetTgtDir(CursorWorldDirection); } } }