public static void Postfix(Projectile __instance /*, Vector3 ___origin, Vector3 ___destination, float ___ticksToImpact*/)
        {
            if (__instance != null && AMAMod.settings.AllowProjectileGlow && __instance as Bullet_Explosive == null)
            {
                if (__instance.def.HasModExtension <GlowerProjectileExtension>())
                {
                    GlowerProjectileExtension glower = __instance.def.GetModExtensionFast <GlowerProjectileExtension>();
                    if (glower != null)
                    {
                        glower.Glow(__instance, __instance.ExactRotation);

                        /*
                         * Material material = glower.GlowMoteDef.graphic.MatSingle;
                         * if (glower.useGraphicColor)
                         * {
                         *  material.color = __instance.DrawColor;
                         * }
                         * else
                         * if (glower.useGraphicColorTwo)
                         * {
                         *  material.color = __instance.DrawColorTwo;
                         * }
                         *
                         * Mesh mesh2 = MeshPool.GridPlane(glower.GlowMoteDef.graphicData.drawSize * glower.GlowMoteSize);
                         * Graphics.DrawMesh(mesh2, __instance.DrawPos, __instance.ExactRotation, material, 0);
                         */
                    }
                }

                /*
                 * if (__instance.def.HasModExtension<ScattershotProjectileExtension>())
                 * {
                 *  ScattershotProjectileExtension scattershot = __instance.def.GetModExtensionFast<ScattershotProjectileExtension>();
                 *  if (scattershot != null)
                 *  {
                 *
                 *      for (int i = 0; i < length; i++)
                 *      {
                 *
                 *          float num = ArcHeightFactor * GenMath.InverseParabola(DistanceCoveredFraction());
                 *          Vector3 drawPos = __instance.DrawPos;
                 *          Vector3 position = drawPos + new Vector3(0f, 0f, 1f) * num;
                 *          if (__instance.def.projectile.shadowSize > 0f)
                 *          {
                 *              DrawShadow(__instance, drawPos, num);
                 *          }
                 *          Graphics.DrawMesh(MeshPool.GridPlane(__instance.def.graphicData.drawSize), position, __instance.ExactRotation, __instance.def.DrawMatSingle, 0);
                 *      }
                 *  }
                 * }
                 */
            }
        }
        //   [HarmonyPostfix]
        public static void Postfix(ProjectileCE __instance)
        {
            if (__instance != null)
            {
                if (__instance.def.HasModExtension <GlowerProjectileExtension>())
                {
                    GlowerProjectileExtension glower = __instance.def.GetModExtension <GlowerProjectileExtension>();
                    if (glower != null)
                    {
                        glower.Glow(__instance, __instance.ExactRotation);

                        /*
                         * Mesh mesh2 = MeshPool.GridPlane(glower.GlowMoteDef.graphicData.drawSize * glower.GlowMoteSize);
                         * Graphics.DrawMesh(mesh2, __instance.DrawPos, __instance.ExactRotation, glower.GlowMoteDef.graphic.MatSingle, 0);
                         */
                    }
                }
            }
        }
Exemple #3
0
 public void Draw(Material material)
 {
     if (this.lifeTime > 0)
     {
         Vector3 pos = this.targetCell.ToVector3() + Velocity(-Angle) * Mathf.Lerp(StartZ, 0f, 1f - (float)this.lifeTime / (float)this.maxLifeTime);
         pos.z += 1.25f;
         pos.y  = AltitudeLayer.MetaOverlays.AltitudeFor();
         Matrix4x4 matrix = default(Matrix4x4);
         matrix.SetTRS(pos, Quaternion.LookRotation((this.targetCell.ToVector3() - pos).Yto0()) /*Quaternion.Euler(0f, -Angle, 0f)*/, new Vector3(Scale, 1f, Scale));
         Graphics.DrawMesh(MeshPool.plane10, matrix, material, 0);
         if (ordnance.HasModExtension <GlowerProjectileExtension>())
         {
             GlowerProjectileExtension glower = ordnance.GetModExtensionFast <GlowerProjectileExtension>();
             if (glower != null)
             {
                 glower.Glow(material, pos, Quaternion.Euler(0f, Angle, 0f));
             }
         }
     }
 }