Example #1
0
        private ObjHudPanel CreateHudPanel(string aBmpPath, ObjHudPanel.Anchors anAnchor)
        {
            ObjMaterial tempMaterial = TheResourceManager.GetFromFile(hudProgram, aBmpPath);
            Size        tempSize     = tempMaterial.DiffuseMap.Size;

            Vector2 tempLoc2 = new Vector2(0, 0);

            ObjHudPanel tempObjObject2 =
                new ObjHudPanel(ObjectPrimitives.CreateSquareWithNormalsYorZ(new Vector3(0, 0, 0),
                                                                             new Vector3(tempSize.Width,
                                                                                         tempSize.Height,
                                                                                         0), true))
            {
                Anchor   = anAnchor,
                Position =
                    tempLoc2,
                Size = tempSize
            };

            tempObjObject2.Size = tempSize;
            tempObjObject2.UpdatePosition(Width, Height);
            tempObjObject2.Material = tempMaterial;
            return(tempObjObject2);
        }
Example #2
0
        private List <ObjGroup> CreateRenderGameObjects()
        {
            Dictionary <ObjectGame.ObjcetIds, PlainBmpTexture> gameObjectsTextures =
                RenderObjects.RenderObjects.CreateGameObjectsTextures(new Size(20, 20), program);
            List <ObjGroup>   tempObjList = new List <ObjGroup>();
            List <ObjectGame> gameObjects = TheGameStatus.GameObjects;

            foreach (ObjectGame gameObject in gameObjects)
            {
                Vector             tempLoc;
                ObjGroupGameObject tempGroup = null;
                ObjGameObject      tempObjObject;
                switch (gameObject.TheObjectId)
                {
                case ObjectGame.ObjcetIds.Player:
                    tempGroup = new ObjGroupGameObjectPlayer(program)
                    {
                        TheObjectGame = gameObject
                    };
                    tempLoc       = new Vector(0.0f, 0.0f);
                    tempLoc      -= new Vector(gameObject.Diameter * 0.5f, gameObject.Diameter * 0.5f);
                    tempObjObject =
                        new ObjGameObject(ObjectPrimitives.CreateCube(new Vector3(tempLoc.X, 0, tempLoc.Y),
                                                                      new Vector3(tempLoc.X + gameObject.Diameter, gameObject.Diameter,
                                                                                  tempLoc.Y + gameObject.Diameter),
                                                                      true));
                    ObjMaterial tempMaterial = TheResourceManager.GetFromFile(program, "tileTestMike200x200.png");
                    tempObjObject.Material = tempMaterial;
                    tempGroup.AddObject(tempObjObject);
                    playerObjObject    = tempGroup;
                    tempGroup.Location = gameObject.Location;
                    break;

                case ObjectGame.ObjcetIds.Enemy:
                    tempGroup = new ObjGroupGameObjectEnemy(program)
                    {
                        TheObjectGame = gameObject
                    };
                    tempLoc       = new Vector(0.0f, 0.0f);
                    tempLoc      -= new Vector(gameObject.Diameter * 0.5f, gameObject.Diameter * 0.5f);
                    tempObjObject =
                        new ObjGameObject(ObjectPrimitives.CreateCube(new Vector3(tempLoc.X, 0, tempLoc.Y),
                                                                      new Vector3(tempLoc.X + gameObject.Diameter, gameObject.Diameter,
                                                                                  tempLoc.Y + gameObject.Diameter),
                                                                      true));
                    ObjMaterial tempMaterial1 = TheResourceManager.GetFromFile(program, "tileTestMike200x200.png");
                    tempObjObject.Material = tempMaterial1;
                    tempGroup.AddObject(tempObjObject);
                    tempGroup.Location = gameObject.Location;
                    break;

                case ObjectGame.ObjcetIds.Turret:

                    ObjGroup     tempGroup1 = ObjLoader.LoadObjFileToObjMesh(program, @"./Resources/Models/Turret1.obj");
                    ObjectTurret tempTurret = (ObjectTurret)gameObject;
                    tempGroup = new ObjGroupGameObjectTurret(tempGroup1)
                    {
                        Location      = gameObject.Location,
                        Scale         = Vector3.UnitScale * 0.3f,
                        TheObjectGame = tempTurret
                    };
                    //                        tempGroup.Orientation = tempTurret.Orientation;

                    break;

                default:
                    tempLoc       = new Vector(0.0f, 0.0f);
                    tempLoc      -= new Vector(gameObject.Diameter * 0.5f, gameObject.Diameter * 0.5f);
                    tempObjObject =
                        new ObjGameObject(ObjectPrimitives.CreateCube(new Vector3(tempLoc.X, 0, tempLoc.Y),
                                                                      new Vector3(tempLoc.X + gameObject.Diameter, gameObject.Diameter,
                                                                                  tempLoc.Y + gameObject.Diameter),
                                                                      true))
                    {
                        Material = gameObjectsTextures[gameObject.TheObjectId].Material
                    };

                    tempGroup.AddObject(tempObjObject);
                    tempGroup.TheObjectGame = gameObject;
                    break;
                }

                tempObjList.Add(tempGroup);
            }
            return(tempObjList);
        }