private void ddpMovements_SelectedIndexChanged(object sender, EventArgs e) { if (ddpMovements.SelectedItem != null) { Direction = (Enums.Movement)((VO_ListItem)ddpMovements.SelectedItem).Id; } }
/// <summary> /// Constructeur pour joueur /// </summary> public VO_CharacterSprite(VO_Character source, Enums.Movement startingPos, VO_Coords coords) { _AnimationsStanding = new List <VO_AnimatedSprite[]>(); _AnimationsWalking = new List <VO_AnimatedSprite[]>(); _AnimationsTalking = new List <VO_AnimatedSprite[]>(); this.Face = source.Face; this.CharacterId = source.Id; this.Id = source.Id; this.DialogColor = source.DialogColor; if (source.Face != Guid.Empty) { FaceAnim = new VO_AnimatedSprite(source.Face, Guid.Empty, Enums.AnimationType.CharacterFace, 0, 0, Constants.ViewerEnums.ImageResourceType.Permanent); } this.Speed = source.Speed; this.StandingAnim = source.StandingAnim; this.TalkingAnim = source.TalkingAnim; this.Title = source.Title; this.WalkingAnim = source.WalkingAnim; _NbrDirections = GameCore.Instance.Game.Project.MovementDirections; foreach (VO_Animation anim in source.Animations) { VO_AnimatedSprite[] animationsStanding = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; VO_AnimatedSprite[] animationsWalking = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; VO_AnimatedSprite[] animationsTalking = new VO_AnimatedSprite[GameCore.Instance.Game.Project.MovementDirections]; for (int i = 0; i < GameCore.Instance.Game.Project.MovementDirections; i++) { animationsStanding[i] = new VO_AnimatedSprite(anim.Id, source.Id, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Permanent, i); animationsWalking[i] = new VO_AnimatedSprite(anim.Id, source.Id, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Permanent, i); animationsTalking[i] = new VO_AnimatedSprite(anim.Id, source.Id, Enums.AnimationType.CharacterAnimation, 0, 0, Constants.ViewerEnums.ImageResourceType.Permanent, i); } _AnimationsStanding.Add(animationsStanding); _AnimationsWalking.Add(animationsWalking); _AnimationsTalking.Add(animationsTalking); } _Scale = new Vector2(1, 1); SetPosition(coords.Location.X, coords.Location.Y); CurrentExecutingPage = -1; CurrentDirection = startingPos; SetCurrentAnimation(Enums.CharacterAnimationType.Standing, this.StandingAnim); }
/// <summary> /// Changer la direction /// </summary> /// <param name="i"></param> public void ChangeDirection(Enums.Movement i) { CurrentDirection = i; }