Example #1
0
        // View building //
        /// ///////////////
        /// ********************************
        /// IMapController
        /// IHexaGet
        /// ********************************
        public static void SetPickVariables(Boolean isPickColor, PickVariables pickVars)
        {
            pickVars.wasClickAnywhereLast = pickVars.wasClickAnywhereNow;
            pickVars.wasClickAnywhereNow = GameState.CurrentMouseState.LeftButton == ButtonState.Pressed;
            if (isPickColor)
            {
                if (!pickVars.pickActive)
                    pickVars.pickNewActive = true;
                pickVars.pickActive = true;

                if (GameState.CurrentMouseState.LeftButton == ButtonState.Pressed)
                {
                    if (!pickVars.wasClickAnywhereLast && !pickVars.pickPress)
                        pickVars.pickNewPress = true;
                    pickVars.pickPress = true;
                }
                else
                {
                    if (pickVars.pickPress)
                        pickVars.pickNewRelease = true;
                    pickVars.pickPress = false;
                }
            }
            else
            {
                pickVars.pickActive = false;
                pickVars.pickPress = false;
                pickVars.pickNewActive = false;
                pickVars.pickNewPress = false;
                pickVars.pickNewRelease = false;
            }
        }
Example #2
0
 public RoadView(RoadModel model, Matrix world)
 {
     this.model = model;
     this.roadID = model.GetRoadID();
     this.pickRoadColor = new Color(0.0f, 1.0f - roadID / 256.0f, 0.0f);
     this.world = Matrix.CreateTranslation(new Vector3(0.0f, 0.012f, 0.0f)) * Matrix.CreateScale(0.1f) * world;
     worldShape = Matrix.CreateTranslation(new Vector3(0.0f, 0.03f, 0.0f)) * Matrix.CreateScale(0.25f) * world;
     pickVars = new PickVariables(pickRoadColor);
     isBuildView = false;
 }
Example #3
0
        public TownView(TownModel model, Matrix world)
        {
            this.model = model;
            this.townID = model.GetTownID();
            townRotation = GameMaster.Inst().GetRandomInt(6);
            this.pickTownColor = new Color(0.0f, 0.0f, 1.0f - townID / 256.0f);

            Matrix rotation;
            rotation = (townRotation == 0) ? Matrix.Identity : Matrix.CreateRotationY(((float)Math.PI / 3.0f) * (townRotation));
            this.world = rotation * Matrix.CreateTranslation(new Vector3(0.0f, 0.01f, 0.0f)) * Matrix.CreateScale(0.00032f) * world;
            this.worldShape = Matrix.CreateTranslation(new Vector3(0.0f, 0.04f, 0.0f)) * Matrix.CreateScale(0.22f) * world;
            this.worldSphere = Matrix.CreateScale(0.0001f) * Matrix.CreateTranslation(new Vector3(0.0f, 0.15f, 0.0f)) * world;

            buildingIsBuild = new bool[3];
            for (int loop1 = 0; loop1 < buildingIsBuild.Length; loop1++)
                buildingIsBuild[loop1] = false;
            pickVars = new PickVariables(pickTownColor);
        }