Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using UnityEngine;
- using Verse;
- using RimWorld;
- namespace M13Watermills
- {
- [StaticConstructorOnStartup]
- public class CompTweakedWatermill : CompPowerPlantWater
- {
- private float spinPosition;
- public static readonly Material BladesMat = MaterialPool.MatFrom("Tweaked_WatermillBlades");
- public override void PostDraw()
- {
- base.PostDraw();
- Vector3 a = this.parent.TrueCenter();
- a += this.parent.Rotation.FacingCell.ToVector3() * 2.36f;
- for (int i = 0; i < 9; i++)
- {
- float num = this.spinPosition + 6.28318548f * (float)i / 9f;
- float x = Mathf.Abs(4f * Mathf.Sin(num));
- bool flag = num % 6.28318548f < 3.14159274f;
- Vector2 vector = new Vector2(x, 1f);
- Vector3 s = new Vector3(vector.x, 1f, vector.y);
- Matrix4x4 matrix = default(Matrix4x4);
- matrix.SetTRS(a + Vector3.up * 0.046875f * Mathf.Cos(num), this.parent.Rotation.AsQuat, s);
- Graphics.DrawMesh((!flag) ? MeshPool.plane10Flip : MeshPool.plane10, matrix, CompTweakedWatermill.BladesMat, 0);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement