Example #1
0
        /// <summary>
        /// Draw the shield Field
        /// </summary>
        public void DrawShields()
        {
            if (!this.IsActive() || !this.m_ShowVisually_Active)
            {
                return;
            }

            if (this.m_StructuralIntegrityMode)
            {
                foreach (IntVec3 _Square in this.CellsToProtect)
                {
                    DrawSubField(Vectors.IntVecToVec(_Square), 0.8f);
                }
            }
            else
            {
                //Draw field
                this.DrawField(Vectors.IntVecToVec(base.Position));
            }

            //Initialize the spark particle array
            if (m_SparksParticle[0] == null)
            {
                for (int i = 0; i < m_SparksParticle.Length; i++)
                {
                    m_SparksParticle[i] = new ShieldBlendingParticle(this.DrawPos, (int)Math.Round(((float)i / (float)(m_SparksParticle.Length - 1)) * (float)ShieldBlendingParticle.transitionMax));
                }
            }
            //Animate spark particles
            for (int i = 0, l = m_SparksParticle.Length; i < l; i++)
            {
                m_SparksParticle[i].DrawMe();
            }
        }
        /// <summary>
        /// Draw the shield Field
        /// </summary>
        public void DrawShieldField()
        {
            if (shieldField.isOnline() || shieldField.shieldRecoverWarmup - shieldField.warmupPower < 60)
            {
                //Draw field
                //shield.DrawField(Vectors.IntVecToVec(base.Position) + (new Vector3(0.5f, 0f, 0.5f)));
                shieldField.DrawField(Vectors.IntVecToVec(base.Position));
                //Initialize the spark particle array
                if (sparksParticle[0] == null)
                {
                    for (int i = 0; i < sparksParticle.Length; i++)
                    {
                        sparksParticle[i] = new ShieldBlendingParticle(this.DrawPos, (int)Math.Round(((float)i / (float)(sparksParticle.Length - 1)) * (float)ShieldBlendingParticle.transitionMax));
                    }
                }
                //Animate spark particles
                for (int i = 0, l = sparksParticle.Length; i < l; i++)
                {
                    sparksParticle[i].DrawMe();
                }

                /*Matrix4x4 matrix = default(Matrix4x4);
                matrix.SetTRS(this.DrawPos + Altitudes.AltIncVect, Quaternion.Euler(0f, UnityEngine.Random.Range(0f, 30f), 0f), UnityEngine.Vector3.one);
                Graphics.DrawMesh(MeshPool.plane20, matrix, Building_Shield.ShieldSparksMat, 0);*/

                //float percentCharged = (float)this.warmup / (float)Building_Turret_Sentinel.warmup_max; ;
                //Fading charge top
                //top.shader = Shader.Find("Diffuse");
                //Graphics.DrawMesh(MeshPool.plane20, matrix, FadedMaterialPool.FadedVersionOf(Building_Turret_Sentinel.TurretTopCharging, percentCharged), 0);
            }
        }