Esempio n. 1
0
 protected override void RenderShadow()
 {
     if (!hidden)
     {
         GraphicsComponent?.Render(true);
     }
 }
Esempio n. 2
0
        public static Entity GetNose(Color color, float angle = 0, float distFromParent = 8)
        {
            float radius = 5f;

            var noseEntity = new Entity("nose");

            var pos = distFromParent * new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle));

            var transform = new TransformComponent(noseEntity)
            {
                LocalPosition = pos,
                LocalRotation = new Rotation(angle),
                LocalDepth    = 0.095f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(noseEntity)
            {
                TexturePath = TextureAtlas.NosePath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };

            var noseComp = new NoseComponent(noseEntity)
            {
                NoseRange = 50,
            };

            noseEntity.AddComponents(transform, graphics, noseComp);

            return(noseEntity);
        }
Esempio n. 3
0
        private void CreateFloor()
        {
            gameMesh = new IGraphicsComponent[numberOfBlocks, numberOfBlocks, 2];
            for (int i = 0; i < gameMesh.GetLength(1); ++i)
            {
                for (int j = 0; j < gameMesh.GetLength(0); ++j)
                {
                    IGameObject block;
                    if (IsSpawnPoint(i, j))
                    {
                        block = new GameBlock(BlockType.Dirt, new Point3D(i, j, 0));
                    }
                    else if (IsFinishPoint(i, j))
                    {
                        block = new GameBlock(BlockType.Dirt, new Point3D(i, j, 0));
                        IGameObject        blockFinish  = new GameBlock(BlockType.Dirt, new Point3D(i, j, 0));
                        IGraphicsComponent portalObject = new GraphicsComponent(blockFinish, resourceManager, gameCanvas);
                        gameMesh[i, j, 1] = portalObject;
                    }

                    else if (IsEdgeOfMap(i, j))
                    {
                        block = new GameBlock(BlockType.Edge, new Point3D(i, j, 0));
                    }
                    else
                    {
                        block = new GameBlock(resourceManager, new Point3D(i, j, 0));
                    }
                    IGraphicsComponent blockObject = new GraphicsComponent(block, resourceManager, gameCanvas);
                    gameMesh[i, j, 0] = blockObject;
                }
            }
        }
Esempio n. 4
0
        public static Entity GetEye(Color color, float angle = 0, float fov = 60, float distFromParent = 8)
        {
            float radius = 5f;

            var eyeEntity = new Entity("eye");

            var pos = distFromParent * new Vector2(1, 0);

            var transform = new TransformComponent(eyeEntity)
            {
                LocalPosition = pos,
                LocalRotation = new Rotation(angle),
                LocalDepth    = 0.1f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(eyeEntity)
            {
                TexturePath = TextureAtlas.EyePath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };

            var eyeComp = new EyeComponent(eyeEntity)
            {
                EyeRange = 150,
                Fov      = MathHelper.ToRadians(fov),
            };

            eyeEntity.AddComponents(transform, graphics, eyeComp);

            return(eyeEntity);
        }
Esempio n. 5
0
        public static Entity GetMouth(Color color)
        {
            float radius = 10f;

            var mouthEntity = new Entity("mouth");

            var transform = new TransformComponent(mouthEntity)
            {
                LocalPosition = Vector2.Zero,
                LocalRotation = new Rotation(0),
                LocalDepth    = 0.09f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(mouthEntity)
            {
                TexturePath = TextureAtlas.MouthPath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };

            var mouthComp = new MouthComponent(mouthEntity)
            {
            };

            var collider = new CircleColliderComponent(mouthEntity)
            {
                Radius = radius,
            };

            mouthEntity.AddComponents(transform, graphics, mouthComp, collider);

            return(mouthEntity);
        }
Esempio n. 6
0
 public void SaveProperties(GraphicsComponent graphic)
 {
     Position = graphic.Position;
     Origin   = graphic.Origin;
     Scale    = graphic.Scale;
     Zoom     = graphic.Zoom;
     Rotation = graphic.Rotation;
 }
Esempio n. 7
0
 public static void RestoreProperties(GraphicsComponent graphic, GraphicProperties properties)
 {
     graphic.Position = properties.Position;
     graphic.Origin   = properties.Origin;
     graphic.Scale    = properties.Scale;
     graphic.Zoom     = properties.Zoom;
     graphic.Rotation = properties.Rotation;
 }
Esempio n. 8
0
        public void RenderShadow()
        {
            if (hidden)
            {
                return;
            }

            GraphicsComponent.Render(true);
        }
Esempio n. 9
0
        public void SpawnFinishPoint(BlockType type)
        {
            if (!type.Equals(BlockType.FinishLocked) && !type.Equals(BlockType.FinishUnlocked))
            {
                throw new ArgumentException("Invalid finish type parameter!");
            }
            IGameObject        finishPoint  = new GameBlock(type, new Point3D(numberOfBlocks - 2, numberOfBlocks - 2, 1));
            IGraphicsComponent portalObject = new GraphicsComponent(finishPoint, resourceManager, gameCanvas);

            gameMesh[numberOfBlocks - 2, numberOfBlocks - 2, 1] = portalObject;
        }
Esempio n. 10
0
        public void Start()
        {
            inputComponent    = new PlayerInputComponent();
            physicsComponent  = new PlayerPhysicsComponent();
            graphicsComponent = new PlayerGraphicsComponent();

            ComponentList.Add(inputComponent);
            ComponentList.Add(physicsComponent);
            ComponentList.Add(graphicsComponent);

            Debug.Log("Game Components Initialization Finish...");
            Debug.Log("Please enter LeftArrow or RightArrow button to play...");
        }
Esempio n. 11
0
        public void LoadLevel(string fileName, out int numberOfFruits, out int numberOfLevels)
        {
            gameMesh       = new IGraphicsComponent[numberOfBlocks, numberOfBlocks, 2];
            numberOfFruits = 0;
            Stack <IGameObject> characters = new Stack <IGameObject>();
            Stack <IGameObject> fruits     = new Stack <IGameObject>();

            IGameObject[,,] gameMeshObjects;
            using (FileStream fs = new FileStream($"{fileName}.dat", FileMode.Open, FileAccess.Read))
            {
                BinaryReader    br = new BinaryReader(fs);
                BinaryFormatter bf = new BinaryFormatter();
                gameMeshObjects = (IGameObject[, , ])bf.Deserialize(fs);
                numberOfLevels  = br.Read();
            };

            for (int i = 0; i < gameMeshObjects.GetLength(0); i++)
            {
                for (int j = 0; j < gameMeshObjects.GetLength(1); j++)
                {
                    for (int z = 0; z < gameMeshObjects.GetLength(2); z++)
                    {
                        if (gameMeshObjects[i, j, z] != null)
                        {
                            if (gameMeshObjects[i, j, z].ClassType.Equals(ClassType.GameCharacter))
                            {
                                characters.Push(gameMeshObjects[i, j, z]);
                                continue;
                            }
                            if (gameMeshObjects[i, j, z].ClassType.Equals(ClassType.GameFruit))
                            {
                                fruits.Push(gameMeshObjects[i, j, z]);
                                continue;
                            }
                            gameMesh[i, j, z] = new GraphicsComponent(gameMeshObjects[i, j, z], resourceManager, gameCanvas);
                        }
                    }
                }
            }
            foreach (var fruit in fruits)
            {
                gameMesh[(int)fruit.Coordinates.X, (int)fruit.Coordinates.Y, (int)fruit.Coordinates.Z] = new GraphicsComponent(fruit, resourceManager, gameCanvas);
                numberOfFruits++;
            }
            foreach (var item in characters)
            {
                Player = gameMesh[(int)item.Coordinates.X, (int)item.Coordinates.Y, (int)item.Coordinates.Z] = new GraphicsComponent(item, resourceManager, gameCanvas);
            }
            SetGameGrid();
        }
Esempio n. 12
0
 void Start()
 {
     inputs = new Dictionary <string, bool>();
     inputs.Add("R", false);  //Throw Object
     inputs.Add("E", false);  //Grab Object
     inputs.Add("F", false);  //Put Object
     inputs.Add("T", false);  //Stop Time
     inputs.Add("Jump", false);
     inputs.Add("Up", false); //Enter door
     inputs.Add("Z", false);  //Throw snowball
     inputs.Add("C", false);  //Era change
     inputComponent    = GetComponent <InputComponent>();
     graphicsComponent = GetComponent <GraphicsComponent>();
     physicsComponent  = GetComponent <PhysicsComponent>();
 }
Esempio n. 13
0
        private void RenderShadow()
        {
            if (!hasShadow)
            {
                return;
            }

            if (separateShadow)
            {
                Graphics.Render(shadow, Position + new Vector2(0, Height + shadow.Height), 0, Vector2.Zero, MathUtils.InvertY);
            }
            else
            {
                GraphicsComponent?.Render(true);
            }
        }
Esempio n. 14
0
        public static Entity GetFoodPellet(Color color)
        {
            float radius = 10f;

            var foodEntity = new Entity("food");

            var transform = new TransformComponent(foodEntity)
            {
                LocalPosition = Vector2.Zero,
                LocalRotation = new Rotation(0),
                LocalDepth    = 0.09f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(foodEntity)
            {
                TexturePath = TextureAtlas.SoupPath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };

            var colourComp = new VisibleColourComponent(foodEntity)
            {
                RealR = 0.9f,
                RealB = 0.05f,
                RealG = 0.05f,
            };

            var energy = new EnergyComponent(foodEntity)
            {
                Energy = 3
            };

            var edible = new EdibleComponent(foodEntity)
            {
            };


            var collider = new CircleColliderComponent(foodEntity)
            {
                Radius = radius,
            };

            foodEntity.AddComponents(transform, graphics, energy, edible, collider, colourComp);

            return(foodEntity);
        }
Esempio n. 15
0
        private Rectangle GetCorrectedBoundsRectangle(Entity item, GraphicsComponent image)
        {
            Rectangle correctedRectangle;

            switch (item)
            {
            case MainModeButton mainModeButton:

                correctedRectangle = new Rectangle(
                    (int)(mainModeButton.X - 20),
                    (int)(mainModeButton.Y - 20),
                    (int)(image.Width + 1.5),
                    (int)(image.Height + 1.5));
                break;

            case BladeButton bladeButton:

                correctedRectangle = new Rectangle(
                    (int)(bladeButton.X),
                    (int)(bladeButton.Y - 16),
                    (int)(image.Width + 1.5),
                    (int)(image.Height));

                break;

            case OptionsButton optionsButton:

                correctedRectangle = new Rectangle(
                    (int)optionsButton.X - 20,
                    (int)optionsButton.Y - 10,
                    (int)image.Width * 6,
                    (int)image.Height * 2);

                break;

            default:
                correctedRectangle = new Rectangle((int)item.Position.X, (int)item.Position.Y,
                                                   (int)image.Width, (int)image.Height);
                break;
            }

            return(correctedRectangle);
        }
Esempio n. 16
0
 private void SpawnEnemies(int numberOfEnemies)
 {
     for (int i = 0; i < numberOfEnemies; i++)
     {
         IGraphicsComponent spawnPoint  = GetRandomSpawnPoint(500);
         IGameObject        enemy       = new GameCharacter(CharacterType.Enemy, new Point3D(spawnPoint.ObjectContext.Coordinates.X, spawnPoint.ObjectContext.Coordinates.Y, 1));
         IGraphicsComponent enemyObject = new GraphicsComponent(enemy, resourceManager, gameCanvas);
         for (int x = 0; x < gameMesh.GetLength(1); x++)
         {
             for (int y = 0; y < gameMesh.GetLength(0); y++)
             {
                 if (gameMesh[x, y, 0].Equals(spawnPoint))
                 {
                     gameMesh[x, y, 1] = enemyObject;
                 }
             }
         }
     }
 }
Esempio n. 17
0
        private void SpawnFruits(int numberOfFruits)
        {
            for (int i = 0; i < numberOfFruits; i++)
            {
                IGraphicsComponent spawnPoint = GetRandomSpawnPoint(50);

                IGameObject        fruit       = new GameFruit(resourceManager, new Point3D(spawnPoint.ObjectContext.Coordinates.X, spawnPoint.ObjectContext.Coordinates.Y, 1));
                IGraphicsComponent fruitObject = new GraphicsComponent(fruit, resourceManager, gameCanvas);

                for (int x = 0; x < gameMesh.GetLength(1); x++)
                {
                    for (int y = 0; y < gameMesh.GetLength(0); y++)
                    {
                        if (gameMesh[x, y, 0].Equals(spawnPoint))
                        {
                            gameMesh[x, y, 1] = fruitObject;
                        }
                    }
                }
            }
        }
Esempio n. 18
0
        public static Entity GetWeapon(Color color)
        {
            float radius = 8f;

            var weaponEntity = new Entity("weapon");

            var transform = new TransformComponent(weaponEntity)
            {
                LocalPosition = Vector2.Zero,
                LocalRotation = new Rotation(0),
                LocalDepth    = 0.09f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(weaponEntity)
            {
                TexturePath = TextureAtlas.BoxingGloveRetractedPath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };

            var collider = new CircleColliderComponent(weaponEntity)
            {
                Radius = radius,
            };

            var weaponComp = new WeaponComponent(weaponEntity)
            {
                ActivateThreshold   = 0.75f,
                AttackCost          = 0.1f,
                AttackTimeSeconds   = 0.1f,
                CooldownTimeSeconds = 1.2f,
                Damage = 34f
            };

            weaponEntity.AddComponents(transform, graphics, weaponComp, collider);

            return(weaponEntity);
        }
        /*************************************** Graphics Functions ***************************************/

        //Custom draw method for animal actors with health bars.
        public static void drawWithHealthBar(Actor a)
        {
            //Readability vars...
            AnimalActor       aa        = (AnimalActor)a;
            Handle            tex       = aa.sprite;
            Vector2           spritePos = aa.position + aa.world2model;
            Color             actorTint = aa.tint * aa.color;
            GraphicsComponent gcomp     = aa.world.engine.graphicsComponent;

            //Draw the animal's sprite
            gcomp.drawTex(tex, (int)(spritePos.x + aa.xoffset), (int)(spritePos.y + aa.yoffset), actorTint);

            //Draw the health bar
            int hBarW = 32; //TODO: Grab the width of the sprite programmatically
            int hBarH = hBarW / 8;

            //Draw the border of the health bar
            gcomp.drawRect((int)(spritePos.x + aa.xoffset), (int)(spritePos.y + aa.yoffset), hBarW, hBarH, Color.BLACK);
            //Draw the health
            hBarW = (int)(hBarW * (aa.life.health / aa.life.maxlife));
            gcomp.drawRect((int)(spritePos.x + aa.xoffset + 1), (int)(spritePos.y + aa.yoffset + 1), hBarW - 2, hBarH - 2, aa.teamColor);
        }
Esempio n. 20
0
 protected virtual void RenderShadow()
 {
     GraphicsComponent.Render(true);
 }
Esempio n. 21
0
 public CameraManager(Game engine, int num_teams)
 {
     gc  = engine.graphicsComponent;
     cam = engine.graphicsComponent.camera;
 }
Esempio n. 22
0
        public override void Render()
        {
            if (Hidden || !TryGetComponent <InteractableComponent>(out var component))
            {
                return;
            }

            var cursed        = item != null && item.Scourged;
            var interact      = component.OutlineAlpha > 0.05f;
            var renderOutline = interact || cursed;

            if (item == null && renderOutline)
            {
                var shader = Shaders.Entity;
                Shaders.Begin(shader);

                shader.Parameters["flash"].SetValue(component.OutlineAlpha);
                shader.Parameters["flashReplace"].SetValue(1f);
                shader.Parameters["flashColor"].SetValue(ColorUtils.White);

                foreach (var d in MathUtils.Directions)
                {
                    Graphics.Render(((SliceComponent)GraphicsComponent).Sprite, Position + d);
                }

                Shaders.End();
            }

            GraphicsComponent.Render(false);

            if (item == null)
            {
                return;
            }

            Graphics.Color = Level.ShadowColor;
            Graphics.Render(itemShadow, Position + shadowOffset);
            Graphics.Color = ColorUtils.WhiteColor;

            var t = item.Animation == null?item.GetComponent <ItemGraphicsComponent>().T : 0;

            var angle = (float)Math.Cos(t * 3f) * 0.4f;

            var region   = item.Region;
            var animated = item.Animation != null;
            var pos      = item.Center + new Vector2(0, (animated ? 0 : (float)(Math.Sin(t * 3f) * 0.5f + 0.5f) * -5.5f - 3) - 5.5f);

            if (renderOutline)
            {
                var shader = Shaders.Entity;
                Shaders.Begin(shader);

                shader.Parameters["flash"].SetValue(cursed ? 1f : component.OutlineAlpha);
                shader.Parameters["flashReplace"].SetValue(1f);
                shader.Parameters["flashColor"].SetValue(!cursed ? ColorUtils.White : ColorUtils.Mix(ItemGraphicsComponent.ScourgedColor, ColorUtils.White, component.OutlineAlpha));

                foreach (var d in MathUtils.Directions)
                {
                    Graphics.Render(region, pos + d, animated ? 0 : angle, region.Center);
                }

                Shaders.End();
            }

            if (animated)
            {
                Graphics.Render(region, pos, 0, region.Center);
            }
            else
            {
                if (item.Masked)
                {
                    Graphics.Color = ItemGraphicsComponent.MaskedColor;
                    Graphics.Render(region, pos, angle, region.Center);
                    Graphics.Color = ColorUtils.WhiteColor;
                }
                else
                {
                    var shader = Shaders.Item;

                    Shaders.Begin(shader);
                    shader.Parameters["time"].SetValue(t * 0.1f);
                    shader.Parameters["size"].SetValue(ItemGraphicsComponent.FlashSize);

                    Graphics.Render(region, pos, angle, region.Center);
                    Shaders.End();
                }
            }
        }
Esempio n. 23
0
 private void RenderShadow()
 {
     Graphics.Color.A = (byte)(a * 255f);
     GraphicsComponent.Render(true);
     Graphics.Color.A = 255;
 }
Esempio n. 24
0
 internal override void Render(GraphicsComponent.RenderState state)
 {
     state.spriteBatch.Draw(texture.texture, position, null, filter, rotation, texture.center, scale, SpriteEffects.None, layer);
 }
Esempio n. 25
0
 private void RenderShadow()
 {
     GraphicsComponent.Render(true);
 }
Esempio n. 26
0
 internal override void Render(GraphicsComponent.RenderState state)
 {
     state.spriteBatch.DrawString(font.font, text, position, filter, rotation, font.font.MeasureString(text) / 2f, scale, SpriteEffects.None, layer);
 }
Esempio n. 27
0
        public static Entity GetCritter(Color color)
        {
            float radius = 10f;

            var critter = new Entity();

            var pos = new Vector2(0, 0);

            var transform = new TransformComponent(critter)
            {
                LocalPosition = pos,
                LocalRotation = new Rotation(MathHelper.PiOver4),
                LocalDepth    = 0.1f,
                Scale         = new Vector2(1, 1)
            };

            var graphics = new GraphicsComponent(critter)
            {
                TexturePath = TextureAtlas.CirclePath,
                Dimensions  = new Point((int)(radius * 2), (int)(radius * 2)),
                Color       = color
            };


            var velocity = new VelocityComponent(critter)
            {
                RotationalVelocity = 0,
                Velocity           = Vector2.Zero
            };

            var circleCollider = new CircleColliderComponent(critter)
            {
                Radius = radius
            };


            var rigidbody = new RigidBodyComponent(critter)
            {
                Mass        = 0.05f,
                Restitution = 0.1f
            };

            var drag = new DragComponent(critter)
            {
                MovementDragCoefficient = 0.1f,
                RotationDragCoefficient = 10f
            };

            var movementControl = new MovementControlComponent(critter)
            {
                MaxMovementForceNewtons = 10.0f,
                MaxRotationForceNewtons = 10.0f,
                MovementMode            = MovementMode.TwoWheels,
            };

            var colour = new VisibleColourComponent(critter)
            {
            };

            var energy = new EnergyComponent(critter)
            {
                Energy = 4f
            };

            var reproduction = new ReproductionComponent(critter)
            {
                Efficency = 0.7f,
                ReproductionEnergyCost = 8f,
                Reproduce               = 0,
                ReproductionThreshold   = 0.5f,
                RequiredRemainingEnergy = 1f,
                ChildDefinitionId       = "Soupling"
            };

            var health = new HealthComponent(critter)
            {
                Health    = 100,
                MaxHealth = 100,
            };

            var age = new OldAgeComponent(critter)
            {
                MaxAge = 5 * 60
            };

            var brain = new BrainComponent(critter)
            {
                InputMap = new Dictionary <string, string>
                {
                    { "eye1R", "eye1.EyeComponent.ActivationR" },
                    { "eye1G", "eye1.EyeComponent.ActivationG" },
                    { "eye1B", "eye1.EyeComponent.ActivationB" },

                    { "eye2R", "eye2.EyeComponent.ActivationR" },
                    { "eye2G", "eye2.EyeComponent.ActivationG" },
                    { "eye2B", "eye2.EyeComponent.ActivationB" },

                    { "eye3R", "eye3.EyeComponent.ActivationR" },
                    { "eye3G", "eye3.EyeComponent.ActivationG" },
                    { "eye3B", "eye3.EyeComponent.ActivationB" },

                    { "eye4R", "eye4.EyeComponent.ActivationR" },
                    { "eye4G", "eye4.EyeComponent.ActivationG" },
                    { "eye4B", "eye4.EyeComponent.ActivationB" },

                    { "mouth", "mouth.MouthComponent.Eating" },
                    { "nosecos", "nose.NoseComponent.CosActivation" },
                    { "nosesin", "nose.NoseComponent.SinActivation" },
                    { "health", "HealthComponent.HealthPercent" },
                    { "myRed", "VisibleColourComponent.RealR" },
                    { "myGreen", "VisibleColourComponent.RealG" },
                    { "myBlue", "VisibleColourComponent.RealB" },
                    { "Random", "Random" },
                    { "Bias", "Bias" },
                },
                //OutputMap = new Dictionary<string, string>
                //    {
                //        {"forwardback", "MovementControlComponent.WishForceForward" },
                //        {"rotation", "MovementControlComponent.WishRotForce" },
                //        {"reproduce", "ReproductionComponent.Reproduce" },
                //        {"red", "VisibleColourComponent.R" },
                //        {"green", "VisibleColourComponent.G" },
                //        {"blue", "VisibleColourComponent.B" },
                //        {"attack", "weapon.WeaponComponent.Activation" }
                //    }
                OutputMap = new Dictionary <string, string>
                {
                    { "wheelLeft", "MovementControlComponent.WishWheelLeftForce" },
                    { "wheelRight", "MovementControlComponent.WishWheelRightForce" },
                    { "reproduce", "ReproductionComponent.Reproduce" },
                    { "red", "VisibleColourComponent.R" },
                    { "green", "VisibleColourComponent.G" },
                    { "blue", "VisibleColourComponent.B" },
                    { "attack", "weapon.WeaponComponent.Activation" }
                }
            };

            critter.AddComponents(transform, graphics, velocity, circleCollider, rigidbody, drag, movementControl, reproduction, colour, energy, health, age, brain);

            var eye1 = Eye.GetEye(Color.White, MathHelper.ToRadians(30));

            eye1.Tag = "eye1";
            critter.AddChild(eye1);

            var eye2 = Eye.GetEye(Color.White, MathHelper.ToRadians(-30));

            eye2.Tag = "eye2";
            critter.AddChild(eye2);

            var eye3 = Eye.GetEye(Color.White, MathHelper.ToRadians(90));

            eye3.Tag = "eye3";
            critter.AddChild(eye3);

            var eye4 = Eye.GetEye(Color.White, MathHelper.ToRadians(-90));

            eye4.Tag = "eye4";
            critter.AddChild(eye4);


            var mouth = Mouth.GetMouth(Color.White);

            critter.AddChild(mouth);
            mouth.GetComponent <TransformComponent>().LocalPosition = new Vector2(15, 0);

            var nose = Nose.GetNose(Color.White, 0, 10);

            nose.Tag = "nose";
            critter.AddChild(nose);

            var weapon = Weapon.GetWeapon(Color.White);

            weapon.Tag = "weapon";
            critter.AddChild(weapon);
            weapon.GetComponent <TransformComponent>().LocalPosition = new Vector2(30, 0);

            return(critter);
        }
Esempio n. 28
0
 private void RenderShadow()
 {
     GraphicsComponent.Offset.Y -= 7;
     GraphicsComponent.Render(true);
     GraphicsComponent.Offset.Y += 7;
 }