コード例 #1
0
ファイル: WeaponDepot.cs プロジェクト: justshiv/LightSavers
        public void Construct(Vector3 center)
        {
            this._position = center;
            this._rotation = (float)Globals.random.NextDouble();

            this.mesh           = new Mesh();
            this.mesh.Model     = AssetLoader.mdl_weapon_depot;
            this.mesh.Transform = Matrix.CreateTranslation(_position);

            this.gunindex       = -1;
            this.gunmesh        = null;
            this.gunmeshReceipt = null;

            Globals.gameInstance.sceneGraph.Setup(this.mesh);
            Globals.gameInstance.sceneGraph.Add(this.mesh);

            this.light           = new Light();
            this.light.LightType = Light.Type.Point;
            this.light.Radius    = 3;
            this.light.Intensity = 0.4f;
            this.light.Color     = Color.White;
            this.light.Transform = Matrix.CreateTranslation(this._position + Vector3.Up * 2);
            this.light.Enabled   = false;

            Globals.gameInstance.sceneGraph.Setup(this.light);
            Globals.gameInstance.sceneGraph.Add(this.light);
        }
コード例 #2
0
ファイル: WeaponDepot.cs プロジェクト: justshiv/LightSavers
        public void SetGun(int index)
        {
            this.gunindex          = index;
            this.light.Enabled     = true;
            this.gunmesh           = new Mesh();
            this.gunmesh.Model     = GetModelForIndex(gunindex);
            this.gunmesh.Transform = gunTransforms[gunindex] * Matrix.CreateTranslation(_position + Vector3.Up);

            Globals.gameInstance.sceneGraph.Setup(this.gunmesh);
            this.gunmeshReceipt = Globals.gameInstance.sceneGraph.Add(this.gunmesh);
        }
コード例 #3
0
 public BaseGun()
 {
     mesh              = null;
     receipt           = null;
     holdTransform     = Matrix.Identity;
     emmitterVector    = Vector3.Zero;
     emmitterPosition  = Vector3.Zero;
     lastShot          = DateTime.Now;
     coolDown          = TimeSpan.Zero;
     animationCoolDown = TimeSpan.Zero;
 }
コード例 #4
0
        public virtual void Construct(Vector3 startPos, float rotation)
        {
            this.position  = startPos;
            this.rotation  = rotation;
            this.rotationM = Matrix.CreateRotationY(rotation);

            this.mustBeDeleted  = false;
            this.aging          = false;
            this.ageMs          = 0;
            this.mesh.Transform = rotationM * Matrix.CreateTranslation(this.position);

            this.modelReceipt = Globals.gameInstance.sceneGraph.Add(mesh);

            this.delta = Vector3.Transform(new Vector3(speed, 0, 0), rotationM);
        }
コード例 #5
0
        public void Construct(Vector3 o)
        {
            this.position      = o;
            this.rotation      = (float)Globals.random.NextDouble() * MathHelper.TwoPi;
            this.mustBeDeleted = false;
            this.rotationM     = Matrix.CreateRotationY(this.rotation);

            this.delta = Vector3.Transform(new Vector3(0, -1, 0.4f), rotationM);

            this.mesh.Transform = rotationM * rotationM * Matrix.CreateTranslation(this.position);

            if (this.receipt != null)
            {
                this.receipt.graph.Remove(this.receipt);
            }
            this.receipt = Globals.gameInstance.sceneGraph.Add(mesh);
        }
コード例 #6
0
ファイル: PlayerObject.cs プロジェクト: justshiv/LightSavers
        public PlayerObject(PlayerIndex playerIndex, Color color, Vector3 pos, float initialYRot)
        {
            this.playerIndex = playerIndex;
            this.color       = color;

            // initial transform
            this._position = pos;
            rotation       = initialYRot;

            SetupLights();

            mesh       = new SkinnedMesh();
            mesh.Model = AssetLoader.mdl_character;

            //Create a new Animation Player that will take the bone dictionaries as arguments allowing individual animation with upper and lower body
            upPlayer  = new DurationBasedAnimator(mesh.SkinningData, mesh.SkinningData.AnimationClips["Take 001"], Animation_States.upperCharacterBones);
            lowPlayer = new DurationBasedAnimator(mesh.SkinningData, mesh.SkinningData.AnimationClips["Take 001"], Animation_States.lowerCharacterBonesandRoot);
            //Load the animations from the asset loader (these are in an Animation Package)
            upPlayer.AddAnimationPackage = AssetLoader.ani_character;
            upPlayer.StartClip(moving + shooting + weapon);
            lowPlayer.AddAnimationPackage = AssetLoader.ani_character;
            lowPlayer.StartClip(moving + weapon);


            UpdateAnimation(0);
            UpdateMajorTransforms(0);

            Globals.gameInstance.sceneGraph.Setup(mesh);
            modelReceipt  = Globals.gameInstance.sceneGraph.Add(mesh);
            light1receipt = Globals.gameInstance.sceneGraph.Add(torchlight);
            light2receipt = Globals.gameInstance.sceneGraph.Add(haloemitlight);
            light3receipt = Globals.gameInstance.sceneGraph.Add(halolight);

            SetupWeapons();
            SwitchWeapon(0);

            collisionRectangle = new RectangleF(
                _position.X - boundingBoxSize,
                _position.Y - boundingBoxSize,
                boundingBoxSize * 2,
                boundingBoxSize * 2
                );
        }