Beispiel #1
0
        public MovableEntity(GameState gameState, LevelInfo aLevelInfo, Model3D aModel, Path aPath, int uid, float spd, float rad, int maxh, int maxw, float waterSuckAmt, int waterRadius)
        {
            levelInfo = aLevelInfo;
            this.model = aModel;
            path = aPath;
            uniqueID = uid;
            speed = spd;
            radius = rad;
            maxHealth = maxh;
            health = maxh;
            maxWater = maxw;
            water = 0;
            this.waterSuckAmt = waterSuckAmt;
            this.waterRadius = waterRadius;

            position = path.getPosition();
            prevPosition = path.getPosition();
            hasMoved = true;
            waiting = 0;
            heading = new Vector3((float)Math.Cos(uid), (float)Math.Sin(uid), 0);
            normal = levelInfo.getNormal(position.X, position.Y);
            orientation = Matrix.Identity;
            setOrientation();

            selected = false;
            infoBar = new InfoBox(gameState);
            pathTool = new LineTool(gameState.getGraphics());
            ringTool = new LineTool(gameState.getGraphics());
            ringTool.setColor(new Vector3(1.0f, 0.0f, 0.0f));

            rebuildRing();
        }
Beispiel #2
0
        private Model3D loadModel(modelType model)
        {
            String modelString = "";
            float modelScale = 1.0f;

            switch (model) {
                case modelType.XYZ: modelString = "Models/xyz"; modelScale = 1.0f; break;
                case modelType.Truck: modelString = "Models/Truck/newtruck"; modelScale = 0.005f; break;
                case modelType.Car: modelString = "Models/Car/car"; modelScale = 0.75f; break;
                case modelType.Tank: modelString = "Models/Tank/tank"; modelScale = 0.005f; break;
                case modelType.Skybox: modelString = "Models/Skysphere/skysphere2"; modelScale = 10.0f; break;
            }

            Model newModel = content.Load<Model>(modelString);

            int textureCount = 0;
            foreach (ModelMesh mesh in newModel.Meshes)
                textureCount += mesh.Effects.Count;

            Texture2D[] newTextures = new Texture2D[textureCount];

            int i = 0;
            foreach (ModelMesh mesh in newModel.Meshes)
                foreach (BasicEffect basicEffect in mesh.Effects)
                    newTextures[i++] = basicEffect.Texture;

            foreach (ModelMesh mesh in newModel.Meshes)
                foreach (ModelMeshPart meshPart in mesh.MeshParts)
                    meshPart.Effect = modelEffect.Clone(graphics);

            isLoaded[(int)model] = true;

            models[(int)model] = new Model3D(newModel, newTextures, modelEffect, modelScale);

            return models[(int)model];
        }
Beispiel #3
0
 public Skybox(Camera camera, Sun sun, Model3D model)
 {
     this.camera = camera;
     this.sun = sun;
     this.model = model;
 }