Exemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameItemBox(ItemBoxSpec spec)
            : base(spec.ModelFilePath)
        {
            this.specData = spec;

            Name = spec.Type.ToString();
        }
Exemplo n.º 2
0
        /// <summary>
        /// creates an item for level.
        /// reads an item information file(.spec) and configures the item class.
        /// The read item class is stored in the list.
        /// </summary>
        /// <param name="info">item information for level</param>
        /// <param name="sceneParent">3D scene parent node</param>
        /// <returns>item class for the game</returns>
        protected GameItemBox CreateItemBox(ref ItemInLevel info,
                                            NodeBase sceneParent)
        {
            ItemBoxSpec spec = LoadItemSpec(ref info);

            GameItemBox item = new GameItemBox(spec);

            item.WorldTransform = Matrix.CreateTranslation(info.Position);
            item.SetRootAxis(Matrix.CreateRotationX(MathHelper.ToRadians(-90.0f)));

            //  creates a collision data.
            Vector3 centerPos = Vector3.Transform(
                new Vector3(0.0f, spec.ModelRadius, 0.0f),
                Matrix.Invert(item.RootAxis));

            CollideSphere collide = new CollideSphere(centerPos, spec.ModelRadius);

            item.SetCollide(collide);

            item.EnableCulling  = true;
            item.ActiveFog      = true;
            item.ActiveLighting = false;

            //  adds item to the list.
            itemList.Add(item);

            //  adds item to parent scene node.
            sceneParent.AddChild(item);

            return(item);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameItemBox(ItemBoxSpec spec)
            : base(spec.ModelFilePath)
        {
            this.specData = spec;

            Name = spec.Type.ToString();
        }
Exemplo n.º 4
0
        /// <summary>
        /// loads an item's information using spec file (.spec).
        /// </summary>
        /// <param name="info">item information for level</param>
        /// <returns>item's spec information</returns>
        public static ItemBoxSpec LoadItemSpec(ref ItemInLevel info)
        {
            //  loads a spawn enemy information.
            ItemBoxSpec spec = new ItemBoxSpec();

            spec = (ItemBoxSpec)GameDataSpecManager.Load(info.SpecFilePath,
                                                         spec.GetType());

            return(spec);
        }