Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using ICities;
  6. using UnityEngine;
  7.  
  8. namespace PropRotating
  9. {
  10. public class PropRotatingMod : LoadingExtensionBase, IUserMod
  11. {
  12. public string Name => "PropRotating Params";
  13. public string Description => "Loads PropRotating parameters.";
  14.  
  15. public override void OnLevelLoaded(LoadMode mode)
  16. {
  17. base.OnLevelLoaded(mode);
  18. ApplyParams();
  19. }
  20.  
  21. public override void OnLevelUnloading()
  22. {
  23. base.OnLevelUnloading();
  24. }
  25.  
  26. private void ApplyParams()
  27. {
  28. for (uint i = 0; i < PrefabCollection<PropInfo>.LoadedCount(); i++)
  29. {
  30. var prefab = PrefabCollection<PropInfo>.GetLoaded(i);
  31. if (prefab == null) continue;
  32. if (prefab.m_mesh.name.Contains("PropRotating") == true)
  33. {
  34. string[] floats = prefab.m_mesh.name.Split(' ');
  35. var vec = new Vector4(Convert.ToSingle(floats[1]), Convert.ToSingle(floats[2]), Convert.ToSingle(floats[3]), Convert.ToSingle(floats[4]));
  36. prefab.m_rollParams[0] = vec;
  37. var vec2 = new Vector4(Convert.ToSingle(floats[5]), Convert.ToSingle(floats[6]), Convert.ToSingle(floats[7]), 1.0f);
  38. prefab.m_rollLocation[0] = vec2;
  39. }
  40. }
  41. }
  42. }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement