Advertisement
Guest User

Attempt #1

a guest
Jul 16th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Diagnostics;
  4. using UnityEngine;
  5. using Verse;
  6. using RimWorld;
  7.  
  8. namespace M13Watermills
  9. {
  10.     [StaticConstructorOnStartup]
  11.     public class CompTweakedWatermill : CompPowerPlantWater
  12.     {
  13.         private float spinPosition;
  14.  
  15.         public static readonly Material BladesMat = MaterialPool.MatFrom("Tweaked_WatermillBlades");
  16.  
  17.         public override void PostDraw()
  18.         {
  19.             base.PostDraw();
  20.             Vector3 a = this.parent.TrueCenter();
  21.             a += this.parent.Rotation.FacingCell.ToVector3() * 2.36f;
  22.             for (int i = 0; i < 9; i++)
  23.             {
  24.                 float num = this.spinPosition + 6.28318548f * (float)i / 9f;
  25.                 float x = Mathf.Abs(4f * Mathf.Sin(num));
  26.                 bool flag = num % 6.28318548f < 3.14159274f;
  27.                 Vector2 vector = new Vector2(x, 1f);
  28.                 Vector3 s = new Vector3(vector.x, 1f, vector.y);
  29.                 Matrix4x4 matrix = default(Matrix4x4);
  30.                 matrix.SetTRS(a + Vector3.up * 0.046875f * Mathf.Cos(num), this.parent.Rotation.AsQuat, s);
  31.                 Graphics.DrawMesh((!flag) ? MeshPool.plane10Flip : MeshPool.plane10, matrix, CompTweakedWatermill.BladesMat, 0);
  32.             }
  33.         }
  34.     }
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement