Пример #1
0
        public DroneObj(float posx, float posy, float posz)
            : base()
        {
            ObjectModel = CreateModelGeo("DroneObj");
            CollisionMode = CollisionVolumeType.BoundingSphere;

            // Positions and orients
            WorldMat = Matrix.CreateRotationX(0)
                     * Matrix.CreateRotationY(0)
                     * Matrix.CreateRotationZ(0)
                     * Matrix.CreateTranslation(posx, posy, posz);

            mPathOffset = new Vector3(posx, posy, posz);  // for an example of relative path

            mPath = ResourceGetPath("DronePth");

            WorldMat = Matrix.CreateWorld(
                                new Vector3(0, 1, 0),
                                new Vector3(0, 0, -1),
                                new Vector3(0, 1, 0));
        }
        /// <summary>
        /// Load a path for later use
        /// </summary>
        /// <param name="key">The key used to retrieve the file.</param>
        /// <param name="path">Path to the resource on disk.</param>
        public void LoadPath(string key, string fileName)
        {
            IridelPath temp;

            if (key == "") throw new Exception("Cannot use an empty string as key for resource " + fileName);

            //try
            //{
            temp = new IridelPath(game.GameContent.RootDirectory + "/" + fileName + ".ma", key);
            //}
            //catch (Exception e)
            //{
            //    throw new Exception("An error occured while parsing '" + fileName + "' for path name '" + key + "'. ", e);
            //}

            try
            {
                mPaths.Add(key, temp);
            }
            catch (ArgumentException e)
            {
                throw new Exception("The key '" + key + "' is already assigned to another Path.", e);
            }
        }