예제 #1
0
파일: Bazooka.cs 프로젝트: ksuh90/P3
 public void Reload()
 {
     while (pies.Count < 10)
     {
         Pie addThisPie = new Pie(game);
         if (pies.Count % 3 == 0) { addThisPie.CurrPieType = Pie.PieType.Pie1; }
         if (pies.Count % 3 == 1) { addThisPie.CurrPieType = Pie.PieType.Pie2; }
         if (pies.Count % 3 == 2) { addThisPie.CurrPieType = Pie.PieType.Pie3; }
         pies.Enqueue(addThisPie);
     }
 }
예제 #2
0
 public Player(PrisonGame game)
 {
     this.game = game;
     victoria = new AnimatedModel(game, "Victoria");
     bazooka = new AnimatedModel(game, "PieBazooka");
     victoria.AddAssetClip("dance", "Victoria-dance");
     victoria.AddAssetClip("stance", "Victoria-stance");
     victoria.AddAssetClip("walk", "Victoria-walk");
     victoria.AddAssetClip("walkstart", "Victoria-walkstart");
     victoria.AddAssetClip("walkloop", "Victoria-walkloop");
     victoria.AddAssetClip("rightturn", "Victoria-rightturn");
     victoria.AddAssetClip("leftturn", "Victoria-leftturn");
     victoria.AddAssetClip("bazookacrouch", "Victoria-crouchbazooka");
     victoria.AddAssetClip("walkloopbazooka", "Victoria-walkloopbazooka");
     victoria.AddAssetClip("lowerbazooka", "Victoria-lowerbazooka");
     victoria.AddAssetClip("raisebazooka", "Victoria-raisebazooka");
     //victoria.AddAssetClip("crouchbazooka", "Victoria-crouchbazooka");
     victoria.AddAssetClip("walkstartbazooka", "Victoria-walkstartbazooka");
     SetPlayerTransform();
     pie = new Pie(game);
     currentSectionNumber = 1;
     victoria.CalculateBoundingBox();
 }
예제 #3
0
파일: PrisonGame.cs 프로젝트: ksuh90/P3
 public void ShootPie(Pie pie)
 {
     shootingPies.Add(pie);
 }
예제 #4
0
파일: PrisonGame.cs 프로젝트: ksuh90/P3
 public void RemovePie(Pie pie)
 {
     shootingPiesToRemove.Add(pie);
 }
예제 #5
0
파일: AlienParent.cs 프로젝트: ksuh90/P3
 public void AddPie(Pie pie)
 {
     myPie = pie;
 }
예제 #6
0
파일: AlienParent.cs 프로젝트: ksuh90/P3
        public void Update(GameTime gameTime)
        {
            double deltaTotal = gameTime.ElapsedGameTime.TotalSeconds;

            float speed = 0;
            float turn = 0;

            do
            {
                double delta = deltaTotal;

                if (myPie != null&&state!=AlienStates.EatPie) { state = AlienStates.StartEatPie; }

                //
                // State machine will go here
                //
                switch (state)
                {
                    case AlienStates.Start:
                        state = AlienStates.StanceStart;
                        delta = 0;
                        break;

                    /* Switching you from anything to the stance state */
                    case AlienStates.StanceStart:
                        alien.PlayClip("stance").Speed = 0;
                        state = AlienStates.Stance;
                        location.Y = 0;
                        break;

                    /* You'll be just standing. But if the speed is greater than zero, etner walkstart */
                    case AlienStates.Stance:
                        speed = GetDesiredSpeed(  );
                        turn = GetDesiredTurnRate(  );
                        if (speed > 0)
                        {
                            // We need to leave the stance state and start walking
                            alien.PlayClip("walkstart");
                            alien.Player.Speed = speed;
                            state = AlienStates.WalkLoop;
                        }
                        break;

                    /* Walk loop by editing the speed as necessary */
                    case AlienStates.WalkLoop:
                        //if (state == States.WalkStart) { victoria.PlayClip("lowerbazooka"); }
                        location.Y = 0;
                        if (delta > alien.Player.Clip.Duration - alien.Player.Time)
                        {
                            delta = alien.Player.Clip.Duration - alien.Player.Time;

                            // The clip is done after this update
                            state = AlienStates.WalkLoopStart;
                        }
                        speed = GetDesiredSpeed();
                        if (speed == 0)
                        {
                            delta = 0;
                            state = AlienStates.StanceStart;
                        }
                        else
                        {
                            alien.Player.Speed = speed;
                        }
                        break;

                    /* Start the walk loop by beginning the clip and entering walk loop */
                    case AlienStates.WalkLoopStart:
                        alien.PlayClip("walkloop").Speed = GetDesiredSpeed();
                        state = AlienStates.WalkLoop;
                        break;

                    case AlienStates.StartEatPie:
                        alien.PlayClip("catcheat");
                        state = AlienStates.EatPie;
                        location.Y = 0;
                        delta = 0;
                        break;

                    case AlienStates.EatPie:
                        if (alien.Player.Time > 2f)
                        {
                            myPie = null;
                        }
                        if (delta > alien.Player.Clip.Duration - alien.Player.Time)
                        {
                            delta = alien.Player.Clip.Duration - alien.Player.Time;

                            myPie = null;
                            // The clip is done after this update
                            state = AlienStates.WalkLoopStart;
                        }

                        break;
                }

                //
                // State update
                //

                alien.Update(delta);

                #region ComputeNewOrientation
                // Enable turning while walking
                float OrientationAdd1 = GetDesiredTurnRate() * (float)delta;

              //  Matrix deltaMatrix = alien.DeltaMatrix;
              //  float OrientationAdd2 = (float)Math.Atan2(deltaMatrix.Backward.X, deltaMatrix.Backward.Z);
                orientation += OrientationAdd1;// +OrientationAdd2;

                #endregion ComputeNewOrientation

                #region ComputeNewLocation
                // We are likely rotated from the angle the model expects to be in
                // Determine that angle.
                Matrix rootMatrix = alien.RootMatrix;
                float actualAngle = (float)Math.Atan2(rootMatrix.Backward.X, rootMatrix.Backward.Z);
                Vector3 newLocation = location + Vector3.TransformNormal(alien.DeltaPosition,
                               Matrix.CreateRotationY(orientation - actualAngle));
                #endregion

                #region LocationCheck
                string region = collisionDetector.TestRegion(newLocation);
                //If region doesn't exist, don't allow you to go in it
                if (region.Equals(String.Empty))
                {
                }
                //Otherwise, it's a valid location
                else
                {
                    //location is in the bounds of the map
                    location = newLocation;
                }
                #endregion

                SetPlayerTransform();

                deltaTotal -= delta;
            } while (deltaTotal > 0);
        }