This class represent a first aid item that rotates with time
Inheritance: CDrawableComponent
Ejemplo n.º 1
0
        /// <summary>
        /// Add a new medkit at a random location on the terrain
        /// </summary>
        private void addFirstAidKit()
        {
            float y = Constants.TERRAIN_HEIGHT;
            float x = 0, z = 0;

            while (y > .7 * Constants.TERRAIN_HEIGHT)
            {
                x = (float)(rnd.NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z);
                z = (float)(rnd.NextDouble() * Constants.FIELD_MAX_X_Z * 2 - Constants.FIELD_MAX_X_Z);
                y = myGame.GetHeightAtPosition(x, z);
            }
            Vector3  pos      = new Vector3(x, y, z) + Constants.MEDKIT_OFFSET;
            Unit     unit     = new Unit(myGame, pos, Vector3.Zero, Constants.MEDKIT_SCALE);
            FirstAid firstAid = new FirstAid(myGame, myGame.Content.Load <Model>(@"model/First Aid Kit2"), unit);

            firstAidKits.Add(firstAid);
        }
        private void addFirstAidKit()
        {
            float y = Constants.TERRAIN_HEIGHT;
            float x = 0, z = 0;
            while (y > .7 * Constants.TERRAIN_HEIGHT)
            {
                x = (float)(rnd.NextDouble() * 4700 - Constants.FIELD_MAX_X_Z);
                z = (float)(rnd.NextDouble() * 4700 - Constants.FIELD_MAX_X_Z);
                y = myGame.GetHeightAtPosition(x, z);
            }
            Vector3 pos = new Vector3(x, y + 30, z);
            Unit unit = new Unit(myGame, pos, Vector3.Zero, Constants.MEDKIT_SCALE);
            FirstAid firstAid = new FirstAid(myGame, myGame.Content.Load<Model>(@"model/First Aid Kit2"), unit);

            firstAidKits.Add(firstAid);
        }