public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                Render.DrawSprite(PlaceholderRockTexture, Position, Size, Rotation);
            }
            else
#endif

            if (miningPlatform == null)
            {
                Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector3 Size3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X() + this.Size.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
                float   Size     = Vector2.Distance(Position, new Vector2(Size3.X, Size3.Y) - Render.CurrentView.Position) / 1.6f;
                Position.Y -= Size;

                Render.DrawSprite(MiningPlatform.MRockPointer, Position, new Vector2(Size), 0, TeamInfo.GetColor(GetTeam()));
                base.Draw2D(DrawTag);
            }
        }
Ejemplo n.º 2
0
    private static void enrichXmlWithGameObjectAttributes(XmlDocument xmlDoc, GameObjectTag tag, XmlNode node)
    {
        enrichXmlWithTransformAttributes(xmlDoc, tag, node);

        if (tag.strength >= 0)
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("strength");
            attribute.Value = tag.strength.ToString().Replace(",", ".");;
            node.Attributes.Append(attribute);
        }

        if (tag.density >= 0)
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("density");
            attribute.Value = tag.density.ToString().Replace(",", ".");;
            node.Attributes.Append(attribute);
        }

        if (tag.size != null && !$"{tag.size.x} {tag.size.y} {tag.size.z}".Equals("0 0 0"))
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("size");
            attribute.Value = $"{tag.size.x} {tag.size.y} {tag.size.z}".Replace(",", ".");;
            node.Attributes.Append(attribute);
        }

        if (!tag.collide)
        {
            XmlAttribute attribute = xmlDoc.CreateAttribute("collide");
            attribute.Value = "false";
            node.Attributes.Append(attribute);
        }
    }
Ejemplo n.º 3
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (SizeBonus == 0)
            {
                return;
            }

            Render.DrawSolidRect(InterpolatedPositionL, InterpolatedPositionR, new Color(0, 0, 0, 0.5f));

            int i;

            for (i = 0; i < CurrentCards.Count; i++)
            {
                CurrentCards[i].Draw(InterpolatedPositionL + new Vector2(InterpolatedDifference.X * ((0.1f + (float)i) / CurrentCards.Count), InterpolatedDifference.Y * 0.1f),
                                     InterpolatedPositionL + new Vector2(InterpolatedDifference.X * ((0.9f + (float)i) / CurrentCards.Count), InterpolatedDifference.Y * 0.9f), i == SelectedSlot ? 1 : OtherAlpha);
            }


            if (SinglePlayer || WaveManager.CurrentWave < PickEnemyState.RandomRounds + 1)
            {
                Render.DrawSprite(WaveCard.UnitPicker, InterpolatedPositionL + new Vector2((SingleSelectedNode + 0.5f) * InterpolatedDifference.X / CurrentCards.Count, InterpolatedDifference.Y + i * 15),
                                  new Vector2(InterpolatedDifference.X / CurrentCards.Count * 1.5f, 90), 0, new Color(1, 0.5f, 0.5f));
            }
            else
            {
                i = 0;
                foreach (int key in TeamFloatingSelection.Keys)
                {
                    Render.DrawSprite(WaveCard.UnitPicker, InterpolatedPositionL + new Vector2((TeamFloatingSelection[key] + 0.5f) * InterpolatedDifference.X / CurrentCards.Count, InterpolatedDifference.Y + i * 15)
                                      , new Vector2(InterpolatedDifference.X / CurrentCards.Count * 1.5f, 90), 0, TeamInfo.GetColor(key));
                }
            }

            base.Draw2D(DrawTag);
        }
 public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
 {
     base.Draw3D(camera, DrawTag);
     ParticleManager.ParticleDepthStencil = Microsoft.Xna.Framework.Graphics.DepthStencilState.DepthRead;
     ParticleManager.PreDraw(camera);
     ParticleManager.Draw(camera);
 }
Ejemplo n.º 5
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            return;

            if (Drawing)
            {
                for (int x = 0; x < CellsX.get(); x++)
                {
                    for (int y = 0; y < CellsY.get(); y++)
                    {
                        if (CellAlpha[x, y] > 0)
                        {
                            Vector2 TransformedPosition = new Vector2(x, y) * Divisor + Parent2DScene.MinBoundary.get();

                            Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                                new Vector3(TransformedPosition.X, 0, TransformedPosition.Y), StarshipScene.CurrentCamera.ProjectionMatrix,
                                StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                            Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
                            float   Size     = 6;

                            Render.DrawSolidRect(Position - new Vector2(Size), Position + new Vector2(Size),
                                                 Color.White * CellAlpha[x, y]);

                            base.Draw2D(DrawTag);
                        }
                    }
                }
            }
        }
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (ShieldDamage > 0 || HullDamage > 0)
            {
                float HealthMult = 1 - (((HullDamage > HullToughness ? HullToughness : HullDamage) +
                                         (ShieldDamage > ShieldToughness ? ShieldToughness : ShieldDamage)) /
                                        (ShieldToughness + HullToughness));
                float TimeMult = 1 - GhostTime / MaxGhostTime;
                if (TimeMult < HealthMult)
                {
                    HealthMult = TimeMult;
                }

                Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector3 Size3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X() + this.Size.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
                float   Size     = Vector2.Distance(Position, new Vector2(Size3.X, Size3.Y) - Render.CurrentView.Position) / 1.6f;
                Position.Y -= Size;

                DrawHealthBar(HealthMult, Position, Size);
            }
        }
Ejemplo n.º 7
0
    private void SpawnMatrix()
    {
        float  xDiffValue = 0;
        float  yDiffValue = 0;
        string namePos;

        for (int i = 0; i < 10; i++)
        {
            yDiffValue = (4.5f - i);
            for (int j = 0; j < 10; j++)
            {
                xDiffValue = (j - 4.5f);
                namePos    = i.ToString() + " : " + j.ToString();
                posObject  = MatrixPosition[i, j];
                posObject  = new GameObject(namePos).transform;
                posObject.SetParent(matrixParentTransform);
                posObject.position = new Vector3(xDiffValue * distanceSpawn, yDiffValue * distanceSpawn, 0);
                posObject.tag      = GameObjectTag.Instance().TCells;
                posObject.gameObject.AddComponent <SpriteRenderer>().sprite    = SquareImg;
                posObject.GetComponent <SpriteRenderer>().color                = new Color(0.1f, 0.3f, 0.5f, 1);
                posObject.gameObject.AddComponent <BoxCollider2D>().isTrigger  = true;
                posObject.gameObject.AddComponent <Rigidbody2D>().gravityScale = 0;
                MatrixPosition[i, j] = posObject;
            }
        }
    }
Ejemplo n.º 8
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (DrawCamera == null)
            {
                return;
            }
            Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, null, null, null, null, DrawCamera.ViewMatrix);
            Render.AdditiveBlending = false;
            DrawGrid();

            foreach (GameObject g in DrawChildren)
            {
                g.Draw2D(GameObjectTag._2DForward);
            }

#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                objectControls.DrawControls();
            }
#endif
            Game1.spriteBatch.End();

            Game1.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive, null, null, null, null, DrawCamera.ViewMatrix);
            Render.AdditiveBlending = true;
            foreach (GameObject g in DrawChildren)
            {
                g.Draw2D(GameObjectTag._2DForward);
            }
            Game1.spriteBatch.End();

            base.Draw2D(DrawTag);
        }
        public override void Draw2D(GameObjectTag DrawTag)
        {
            bool IsUpgraded = false;

            if (GetType().IsSubclassOf(typeof(UnitTurret)))
            {
                UnitTurret u = (UnitTurret)this;
                IsUpgraded = u.IsUpdgraded;
            }

            if (ShieldDamage > 0 || HullDamage > 0 || Dead || IsUpgraded || GetType().IsSubclassOf(typeof(MiningPlatform)))
            {
                float HealthMult = 1 - (((HullDamage > HullToughness ? HullToughness : HullDamage) +
                                         (ShieldDamage > ShieldToughness ? ShieldToughness : ShieldDamage)) /
                                        (ShieldToughness + HullToughness));

                Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector3 Size3 = Game1.graphicsDevice.Viewport.Project(
                    new Vector3(this.Position.X() + this.Size.X(), Y, this.Position.Y()), StarshipScene.CurrentCamera.ProjectionMatrix,
                    StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
                float   Size     = Vector2.Distance(Position, new Vector2(Size3.X, Size3.Y) - Render.CurrentView.Position) / 1.6f;
                Position.Y -= Size;

                DrawHealthBar(HealthMult, Position, Size);
            }

            base.Draw2D(DrawTag);
        }
Ejemplo n.º 10
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (LineCount < 1)
            {
                return;
            }


            int i = 0;
            LinkedListNode <GameObject> n = Nodes.Value.First;

            if (n != null)
            {
                while (n.Next != null)
                {
                    Path3DNode p = (Path3DNode)n.Value;
                    LineVerteces[i++].Position = p.GetPosition();
                    p = (Path3DNode)n.Next.Value;
                    LineVerteces[i++].Position = p.GetPosition();
                    n = n.Next;
                }
            }
            ShapeRenderer.Load();
            ShapeRenderer.ColorEffectHolder.SetFromCamera(camera);
            ShapeRenderer.ColorEffectHolder.SetWorld(Matrix.Identity);
            ShapeRenderer.ColorEffectHolder.Apply();
            ShapeRenderer.ColorEffectHolder.MyEffect.Parameters["ObjectColor"].SetValue(drawColor);
            Game1.graphics.GraphicsDevice.DrawUserIndexedPrimitives <VertexPositionColor>(
                PrimitiveType.LineList, LineVerteces, 0, LineCount * 2, LineIndicies, 0, LineCount);
            base.Draw3D(camera, DrawTag);
        }
Ejemplo n.º 11
0
 public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
 {
     PointEffect.SetFromCamera(camera);
     PointEffect.SetFromObject(this);
     Render.DrawModel(PointModel, PointEffect.MyEffect);
     base.Draw3D(camera, DrawTag);
 }
Ejemplo n.º 12
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (other.transform.tag == GameObjectTag.Instance().TCells)
     {
         RemoveMyBitsToMatrixPos();
     }
 }
Ejemplo n.º 13
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.transform.tag == GameObjectTag.Instance().TCells)
     {
         originColorBit = other.gameObject.GetComponent <SpriteRenderer>().color;
     }
 }
        public override void Draw2D(GameObjectTag DrawTag)
        {
#if EDITOR
            if (FinalTarget == null)
            {
                Console.WriteLine("Final Target is null");
            }
#endif

            MasterManager.SetViewportToFullscreen();
            Game1.graphicsDevice.Clear(Color.Black);

            Game1.graphicsDevice.BlendState        = BlendState.Opaque;
            Game1.graphicsDevice.DepthStencilState = DepthStencilState.None;

            Game1.graphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            Game1.graphicsDevice.Textures[0]      = FinalTarget;
            PasteEffect.CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                objectControls.Draw3D(DrawCamera);
            }
#endif
        }
Ejemplo n.º 15
0
 public static GameObjectTag Instance()
 {
     if (instance == null)
     {
         instance = FindObjectOfType <GameObjectTag>();
     }
     return(instance);
 }
Ejemplo n.º 16
0
 public override void Draw2D(GameObjectTag DrawTag)
 {
     if (ParentLevel.LevelForEditing)
     {
         Render.DrawSprite(CameraIcon, Position, Size, Rotation);
     }
     base.Draw2D(DrawTag);
 }
Ejemplo n.º 17
0
 void attachGameObjectProperties(GameObjectTag tag, XmlNode xmlNode)
 {
     attachTransformProperties(tag, xmlNode);
     tag.collide  = readBool(xmlNode, "collide", true);
     tag.size     = readVec3(xmlNode, "size");
     tag.density  = readFloat(xmlNode, "density");
     tag.strength = readFloat(xmlNode, "strength");
 }
Ejemplo n.º 18
0
 public virtual void RemoveTag(GameObjectTag Tag)
 {
     if (Tags.Contains(Tag))
     {
         TagsReady = false;
         Tags.Remove(Tag);
         ReadyTag(Tag);
     }
 }
Ejemplo n.º 19
0
        protected ParquetParent(Range <GameObjectID> in_bounds, GameObjectID in_id, string in_name, string in_description,
                                string in_comment, GameObjectID in_itemID, GameObjectTag in_addsToBiome, GameObjectTag in_addsToRoom)
            : base(in_bounds, in_id, in_name, in_description, in_comment)
        {
            Precondition.IsInRange(in_itemID, All.ItemIDs, nameof(in_itemID));

            ItemID      = in_itemID;
            AddsToBiome = string.IsNullOrEmpty(in_addsToBiome) ? GameObjectTag.None : in_addsToBiome;
            AddsToRoom  = string.IsNullOrEmpty(in_addsToRoom) ? GameObjectTag.None : in_addsToRoom;
        }
 public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
 {
     if (EditorSelected)
     {
         RingEffect.SetFromCamera(camera);
         RingEffect.SetFromObject(this);;
         Render.DrawModel(RingModel, RingEffect.MyEffect);
         base.Draw3D(camera, DrawTag);
     }
 }
Ejemplo n.º 21
0
 public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
 {
     Game1.graphicsDevice.BlendState        = Additive.get() ? BlendState.Additive : BlendState.Opaque;
     Game1.graphicsDevice.DepthStencilState = DepthRead.get() ? DepthStencilState.DepthRead : DepthStencilState.Default;
     if (!Applied)
     {
         Applied = true;
         ApplyEffects();
     }
     base.Draw3D(camera, DrawTag);
 }
Ejemplo n.º 22
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (Alpha < 0.1f || (RestrictedView != -1 && Render.ViewIndex - 1 != RestrictedView))
            {
                return;
            }

            DrawAsForm(DrawPosition, DrawSize);

            base.Draw2D(DrawTag);
        }
Ejemplo n.º 23
0
        public virtual LinkedList <GameObject> AddTag(GameObjectTag Tag)
        {
            Tags.AddFirst(Tag);

            if (ParentScene == null)
            {
                ParentScene = Level.ReferenceScene;
            }

            ReadyTag(Tag);
            return(null);
        }
Ejemplo n.º 24
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (ColorParameter != null)
            {
                ColorParameter.SetValue(OldColor * FlickerMult);
            }
            if (SpecularParameter != null)
            {
                SpecularParameter.SetValue(OldSpecular * FlickerMult);
            }

            base.Draw3D(camera, DrawTag);
        }
Ejemplo n.º 25
0
 private void OnTriggerStay2D(Collider2D other)
 {
     if (other.transform.tag == GameObjectTag.Instance().TCells)
     {
         distanceCollision = Vector3.Distance(transform.position, other.transform.position);
         if (distanceCollision < diagonalScale)
         {
             RemoveMyBitsToMatrixPos();
             GetFirstBitPosInMatrix1010(other.transform);
             InsertMyBitsToMatrixPos();
         }
     }
 }
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (!Sphere.get())
            {
                ShapeRenderer.DrawCube(WorldMatrix, camera, drawColor);
            }
            else
            {
                ShapeRenderer.DrawSphere(WorldMatrix, camera, drawColor);
            }

            base.Draw3D(camera, DrawTag);
        }
Ejemplo n.º 27
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (lightState == BasicLight.LightState.Dead || MyEffect.get() != null)
            {
                base.Draw3D(camera, DrawTag);
                return;
            }

            MyEffect.get().CurrentTechnique.Passes[0].Apply();
            FullscreenQuad.Draw();

            base.Draw3D(camera, DrawTag);
        }
        /// <summary>
        ///  This helper checks whether the passed node is the GameObject.Tag type
        /// </summary>
        /// <param name="context">Analyzer context</param>
        /// <param name="node">node to analyze for GameObject.Tag</param>
        /// <returns>true if it is GameObject.tag, false otherwise</returns>
        private static bool IsGameObjectTagProperty(ref SyntaxNodeAnalysisContext context, ExpressionSyntax node)
        {
            const string GameObjectTag = "UnityEngine.GameObject.tag";
            const string ComponentTag  = "UnityEngine.Component.tag";
            var          prop          = context.SemanticModel.GetSymbolInfo(node).Symbol as IPropertySymbol;

            if (prop != null)
            {
                return(GameObjectTag.Equals(prop.ToString()) || ComponentTag.Equals(prop.ToString()));
            }

            return(false);
        }
Ejemplo n.º 29
0
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (MyModel.get() != null && MyEffect.get() != null)
            {
                Game1.graphicsDevice.BlendState = BlendState.AlphaBlend;
                _3DEffect effect3D = (_3DEffect)MyEffect.Holder;

                effect3D.SetFromObject(this);
                effect3D.SetFromCamera(camera);

                Render.DrawModel(MyModel.get(), MyEffect.get());
            }
            base.Draw3D(camera, DrawTag);
        }
        public override void Draw3D(Camera3D camera, GameObjectTag DrawTag)
        {
            if (lightState == BasicLight.LightState.Dead)
            {
                base.Draw3D(camera, DrawTag);
                return;
            }

            if (DrawTag == GameObjectTag._3DPreDraw)
            {
                if (RealtimeShadows.get())
                {
                    DrawShadows();
                }
            }
            else
            {
#if EDITOR && WINDOWS
                if (DrawTag == GameObjectTag._3DForward)
                {
                    if (EditorSelected)
                    {
                        Vector4 Col = Vector4.One;
                        ShapeRenderer.DrawSphere(WorldMatrix, camera, Col);
                    }
                    if (ShadowCube != null)
                    {
                        ShapeRenderer.DrawSphere(WorldMatrix, camera, ShadowCube.Value);
                    }
                }
                else
#endif
                if (MyEffect.Holder != null)
                {
                    Game1.graphicsDevice.RasterizerState = RasterizerState.CullClockwise;
                    DeferredLightEffect effect3D = (DeferredLightEffect)MyEffect.Holder;

                    effect3D.SetTextureSize(ParentScene.WindowSize);
                    effect3D.SetUV(camera);
                    effect3D.SetInverseCamera(camera);
                    effect3D.SetLight(Position.get(), Scale.get() / 2);
                    effect3D.SetFromObject(this);
                    effect3D.SetFromCamera(camera);
                    effect3D.MyEffect.CurrentTechnique.Passes[0].Apply();
                    Render.DrawModel(SphereModel, MyEffect.get());
                }
            }
            base.Draw3D(camera, DrawTag);
        }