Ejemplo n.º 1
0
        public BasicCube(Model model, Game game, SpectrumEnums.Cubes face, Camera camera, Vector3 offset, ModelManager modelManager)
            : base(model, game)
        {
            effect = ((Spectrum)game).grayEffect;
            this.camera = camera;
            this.game = game;
            this.texManager = ((Spectrum)game).texManager;
            cubeM = model;
            this.offset = offset;
            translation = Matrix.CreateTranslation(offset);
            this.modelManager = modelManager;
            texture = texManager.getCubeTexture(face);
            boundingBox = GetBoundingBox();
            this.left = offset.X - 1;
            this.right = offset.X + 1;
            this.down = offset.Y - 1;
            this.top = offset.Y + 1;
            this.rear = offset.Z - 1;
            this.front = offset.Z + 1;

            switch(face)
            {
                case SpectrumEnums.Cubes.Start:
                    posXFace = new StartFace(this, modelManager, 0);
                    negXFace = new StartFace(this, modelManager, 1);
                    posYFace = new StartFace(this, modelManager, 2);
                    negYFace = new StartFace(this, modelManager, 3);
                    posZFace = new StartFace(this, modelManager, 4);
                    negZFace = new StartFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Goal:
                    posXFace = new GoalFace(this, modelManager, 0);
                   negXFace = new GoalFace(this, modelManager, 1);
                    posYFace = new GoalFace(this, modelManager, 2);
                    negYFace = new GoalFace(this, modelManager, 3);
                    posZFace = new GoalFace(this, modelManager, 4);
                    negZFace = new GoalFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Grass:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Ice:
                    posXFace = new IceFace(this, modelManager, 0);
                    negXFace = new IceFace(this, modelManager, 1);
                    posYFace = new IceFace(this, modelManager, 2);
                    negYFace = new IceFace(this, modelManager, 3);
                    posZFace = new IceFace(this, modelManager, 4);
                    negZFace = new IceFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Mud:
                    posXFace = new MudFace(this, modelManager, 0);
                    negXFace = new MudFace(this, modelManager, 1);
                    posYFace = new MudFace(this, modelManager, 2);
                    negYFace = new MudFace(this, modelManager, 3);
                    posZFace = new MudFace(this, modelManager, 4);
                    negZFace = new MudFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Lava:
                    posXFace = new LavaFace(this, modelManager, 0);
                    negXFace = new LavaFace(this, modelManager, 1);
                    posYFace = new LavaFace(this, modelManager, 2);
                    negYFace = new LavaFace(this, modelManager, 3);
                    posZFace = new LavaFace(this, modelManager, 4);
                    negZFace = new LavaFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Cobblestone:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Sponge:
                    posXFace = new SpongeFace(this, modelManager, 0);
                    negXFace = new SpongeFace(this, modelManager, 1);
                    posYFace = new SpongeFace(this, modelManager, 2);
                    negYFace = new SpongeFace(this, modelManager, 3);
                    posZFace = new SpongeFace(this, modelManager, 4);
                    negZFace = new SpongeFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Error:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                default:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
            }
        }
Ejemplo n.º 2
0
 public GenericFace getFace(int orientation)
 {
     GenericFace returnFace = new GenericFace(this, modelManager, 0);
     switch (orientation)
     {
         case 0:
             returnFace = posXFace;
             break;
         case 1:
             returnFace = negXFace;
             break;
         case 2:
             returnFace = posYFace;
             break;
         case 3:
             returnFace = negYFace;
             break;
         case 4:
             returnFace = posZFace;
             break;
         case 5:
             returnFace = negZFace;
             break;
         default:
             break;
     }
     return returnFace;
 }