Created
August 4, 2018 13:14
-
-
Save ronyx69/086dbfa867b3f3c0a701f3258a973eb6 to your computer and use it in GitHub Desktop.
Source code for the Rotors FlipXZ mod.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using ICities; | |
using UnityEngine; | |
namespace FlipXZ | |
{ | |
public class FlipXZMod : LoadingExtensionBase, IUserMod | |
{ | |
public string Name => "Rotors FlipXZ"; | |
public string Description => "Loads FlipXZ parameter for rotors shader vehicle sub meshes."; | |
public override void OnLevelLoaded(LoadMode mode) | |
{ | |
base.OnLevelLoaded(mode); | |
ApplyParams(); | |
} | |
public override void OnLevelUnloading() | |
{ | |
base.OnLevelUnloading(); | |
} | |
private void ApplyParams() | |
{ | |
foreach (VehicleInfoSub prefab in Resources.FindObjectsOfTypeAll<VehicleInfoSub>()) | |
{ | |
var shader = Shader.Find("Custom/Vehicles/Vehicle/Rotors"); | |
if (prefab.m_UIPriority == 120122 && prefab.m_material.shader == shader) prefab.m_material.SetFloat("_FlipTyreRotationXZ", 1.0f); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment