コード例 #1
0
 public void Vomit()
 {
     if (state != RioterState.Vomiting)
     {
         physicalData.LinearVelocity = Vector3.Zero;
         PlayAnimation("k_puke");
         state             = RioterState.Vomiting;
         vomitCounter      = anims.GetAniMillis("k_puke") - 20;
         vomitSoundCounter = 2000;
     }
 }
コード例 #2
0
        public override void Update(GameTime gameTime)
        {
            Vector3 diff;

            switch (state)
            {
            case RioterState.Idling:
                if (curAnim != "k_idle1")
                {
                    PlayAnimation("k_idle1");
                }
                break;

            case RioterState.Following:
                if (attackingObj != null)
                {
                    state = RioterState.Attacking;
                }
                diff = playerData.Position - physicalData.Position;
                if (Math.Abs(diff.X) + Math.Abs(diff.Z) > 15)
                {
                    newDir = GetPhysicsYaw(diff);
                    AdjustDir(runSpeed, .12f);
                    if (curAnim != "k_walk")
                    {
                        PlayAnimation("k_walk");
                    }
                }
                else
                {
                    if (curAnim != "k_idle1")
                    {
                        PlayAnimation("k_idle1");
                    }
                }
                break;

            case RioterState.Attacking:
                diff   = attackingObj.Position - physicalData.Position;
                newDir = GetPhysicsYaw(diff);
                AdjustDir(runSpeed, .18f);

                jumpCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (jumpCounter <= 0)
                {
                    physicalData.LinearVelocity += Vector3.Up * 55;
                    jumpCounter = (Game as Game1).rand.Next(1000, 2500);
                }

                nextPunchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (nextPunchCounter <= 0)
                {
                    PlayAnimation("k_punch");
                    nextPunchCounter = (Game as Game1).rand.Next(1000, 3000);
                    punched          = false;
                    punchCounter     = 315;
                    stopPunchCounter = 780;
                }

                stopPunchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (stopPunchCounter <= 0)
                {
                    PlayAnimation("k_walk");
                    stopPunchCounter = 5000;
                }

                punchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (!punched && punchCounter <= 0)
                {
                    Game.PlayWhooshSound();
                    (Game.Services.GetService(typeof(EntityManager)) as EntityManager).CreatePunch(physicalData.Position, physicalData.OrientationMatrix.Forward, false);
                    punched = true;
                }
                break;

            case RioterState.Vomiting:
                (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).SetEmitterVel("vomit", 60, "Bone_015");
                vomitCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (vomitCounter <= 0)
                {
                    state = RioterState.Following;
                    PlayAnimation("k_idle1");
                    (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).RemoveEmitter("vomit");
                }

                vomitSoundCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                if (vomitSoundCounter <= 0)
                {
                    (Game as Game1).SoftVomitSound();
                    (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).AddEmitter(typeof(VomitSystem), "vomit", 150, 0, Vector3.Zero, "Bone_015");
                    vomitSoundCounter = double.MaxValue;
                }
                break;
            }

            base.Update(gameTime);
        }
コード例 #3
0
 public void MakePlayerMinion()
 {
     state = RioterState.Following;
 }
コード例 #4
0
ファイル: RioterController.cs プロジェクト: jdcook/Veishea
        public override void Update(GameTime gameTime)
        {
            Vector3 diff;
            switch (state)
            {
                case RioterState.Idling:
                    if (curAnim != "k_idle1")
                    {
                        PlayAnimation("k_idle1");
                    }
                    break;
                case RioterState.Following:
                    if (attackingObj != null)
                    {
                        state = RioterState.Attacking;
                    }
                    diff = playerData.Position - physicalData.Position;
                    if (Math.Abs(diff.X) + Math.Abs(diff.Z) > 15)
                    {
                        newDir = GetPhysicsYaw(diff);
                        AdjustDir(runSpeed, .12f);
                        if (curAnim != "k_walk")
                        {
                            PlayAnimation("k_walk");
                        }
                    }
                    else
                    {
                        if (curAnim != "k_idle1")
                        {
                            PlayAnimation("k_idle1");
                        }
                    }
                    break;
                case RioterState.Attacking:
                    diff = attackingObj.Position - physicalData.Position;
                    newDir = GetPhysicsYaw(diff);
                    AdjustDir(runSpeed, .18f);

                    jumpCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (jumpCounter <= 0)
                    {
                        physicalData.LinearVelocity += Vector3.Up * 55;
                        jumpCounter = (Game as Game1).rand.Next(1000, 2500);
                    }

                    nextPunchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (nextPunchCounter <= 0)
                    {
                        PlayAnimation("k_punch");
                        nextPunchCounter = (Game as Game1).rand.Next(1000, 3000);
                        punched = false;
                        punchCounter = 315;
                        stopPunchCounter = 780;
                    }

                    stopPunchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (stopPunchCounter <= 0)
                    {
                        PlayAnimation("k_walk");
                        stopPunchCounter = 5000;
                    }

                    punchCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (!punched && punchCounter <= 0)
                    {
                        Game.PlayWhooshSound();
                        (Game.Services.GetService(typeof(EntityManager)) as EntityManager).CreatePunch(physicalData.Position, physicalData.OrientationMatrix.Forward, false);
                        punched = true;

                    }
                    break;
                case RioterState.Vomiting:
                    (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).SetEmitterVel("vomit", 60, "Bone_015");
                    vomitCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (vomitCounter <= 0)
                    {
                        state = RioterState.Following;
                        PlayAnimation("k_idle1");
                        (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).RemoveEmitter("vomit");
                    }

                    vomitSoundCounter -= gameTime.ElapsedGameTime.TotalMilliseconds;
                    if (vomitSoundCounter <= 0)
                    {
                        (Game as Game1).SoftVomitSound();
                        (Entity.GetComponent(typeof(AnimatedModelComponent)) as AnimatedModelComponent).AddEmitter(typeof(VomitSystem), "vomit", 150, 0, Vector3.Zero, "Bone_015");
                        vomitSoundCounter = double.MaxValue;
                    }
                    break;
            }

            base.Update(gameTime);
        }
コード例 #5
0
ファイル: RioterController.cs プロジェクト: jdcook/Veishea
 public void MakePlayerMinion()
 {
     state = RioterState.Following;
 }
コード例 #6
0
ファイル: RioterController.cs プロジェクト: jdcook/Veishea
 public void Vomit()
 {
     if (state != RioterState.Vomiting)
     {
         physicalData.LinearVelocity = Vector3.Zero;
         PlayAnimation("k_puke");
         state = RioterState.Vomiting;
         vomitCounter = anims.GetAniMillis("k_puke") - 20;
         vomitSoundCounter = 2000;
     }
 }