コード例 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="data">The asset data for the custom animation.</param>
 public AvatarAnimationWrapper( CustomAvatarAnimationData data )
 {
     animation = null;
     customAnimation = new CustomAvatarAnimation( data.Name, data.Length, data.Keyframes );
     customAnimation.CurrentPosition = TimeSpan.Zero;
     customID = data.Name;
 }
コード例 #2
0
ファイル: Avatar.cs プロジェクト: yxrkt/AvatarHamsterPanic
 public Avatar( AvatarDescription body, CustomAvatarAnimationData anim, float scale, Vector3 dir, Vector3 pos )
     : this(body, new AvatarAnimationWrapper( anim ), scale, dir, pos)
 {
 }
コード例 #3
0
ファイル: Avatar.cs プロジェクト: yxrkt/AvatarHamsterPanic
 public void SetAnimation( CustomAvatarAnimationData data )
 {
     if ( !currentAnimation.IsOfType( data.Name ) && ( targetAnimation == null || !targetAnimation.IsOfType( data.Name ) ) )
       {
     if ( !customs.ContainsKey( data ) )
       customs.Add( data, new AvatarAnimationWrapper( data ) );
     targetAnimation = customs[data];
     targetAnimation.CurrentPosition = TimeSpan.Zero;
     blendTimeCurrent = 0f;
       }
 }
コード例 #4
0
ファイル: Player.cs プロジェクト: yxrkt/AvatarHamsterPanic
        public Player( GameplayScreen screen, int playerNumber, PlayerIndex playerIndex, Avatar avatar, Vector2 pos, uint id )
            : base(screen)
        {
            WheelModel = screen.Content.Load<CustomModel>( "Models/hamsterBall" );
              foreach ( CustomModelSample.CustomModel.ModelPart part in WheelModel.ModelParts )
              {
            part.Effect.CurrentTechnique = part.Effect.Techniques["Color"];
            part.Effect.Parameters["Color"].SetValue( new Vector4( .8f, .7f, 1f, .225f ) );
            part.Effect.Parameters["SpecularPower"].SetValue( 400 );
            part.Effect.Parameters["Mask"].SetValue( MaskHelper.MotionBlur( 1 ) );
              }

              DrawOrder = 8;

              WinState = PlayerWinState.None;

              soundPosition = Vector3.Zero;
              soundVelocity = Vector3.Zero;

              float depth = screen.Camera.Position.Z;
              DeathLine = depth * (float)Math.Tan( screen.Camera.Fov / 2f );

              RespawnTime = float.MaxValue;

              shrinkBegin = 0;
              Scale = 1f;
              ScaleSpring = new SpringInterpolater( 1, 200, SpringInterpolater.GetCriticalDamping( 200 ) );
              ScaleSpring.Active = true;
              ScaleSpring.SetSource( Scale );
              ScaleSpring.SetDest( Scale );

              PlayerIndex = playerIndex;
              PlayerNumber = playerNumber;
              BoostBurnRate = 1f;
              BoostRechargeRate = .25f;

              Avatar = avatar;
              BoundingCircle = new PhysCircle( Size / 2f, pos, 10f );
              BoundingCircle.Parent = this;
              BoundingCircle.Elasticity = .4f;
              BoundingCircle.Friction = .5f;
              BoundingCircle.Collided += HandleCollision;
              BoundingCircle.Responded += HandleCollisionResponse;
              screen.PhysicsSpace.AddBody( BoundingCircle );

              walkAnim = CustomAvatarAnimationData.GetAvatarAnimationData( "Walk", Screen.Content );
              runAnim  = CustomAvatarAnimationData.GetAvatarAnimationData( "Run", Screen.Content );

              // pre-load animations for podium screen
              avatar.SetAnimation( AvatarAnimationPreset.Celebrate );
              avatar.SetAnimation( AvatarAnimationPreset.Clap );
              avatar.SetAnimation( AvatarAnimationPreset.FemaleAngry );
              avatar.SetAnimation( AvatarAnimationPreset.MaleCry );

              standAnim = (AvatarAnimationPreset)( (int)AvatarAnimationPreset.Stand0 + random.Next( 8 ) );
              avatar.SetAnimation( standAnim );

              if ( playerIndex >= PlayerIndex.One )
              {
            HUD = new PlayerHUD( this, SignedInGamer.SignedInGamers[playerIndex] );
              }
              else
              {
            HUD = new PlayerHUD( this, null );
            playerAI = new PlayerAI( this );
              }

              vertexDeclaration = new VertexDeclaration( screen.ScreenManager.GraphicsDevice,
                                                 VertexPositionNormalTexture.VertexElements );

              boosterSound = GameCore.Instance.AudioManager.Play2DCue( "booster", 1f );
              boosterSound.Pause();

              glow = new CircularGlow( new Vector3( BoundingCircle.Position, 0 ), Color.OrangeRed, Size );
              glow.Player = this;
              screen.ObjectTable.Add( glow );

              glowSpring = new SpringInterpolater( 1, 500, .75f * SpringInterpolater.GetCriticalDamping( 500 ) );
              glowSpring.Active = true;
              glowSpring.SetSource( 0 );
              glowSpring.SetDest( 0 );

              Tag = new PlayerTag( this, screen.Content.Load<SpriteFont>( "Fonts/playerTagFont" ) );

              SetID( id );
        }