Example #1
0
        public BaseCombatant(Personnage basePersonnage)
            : base()
        {
            State = DEFAULT_STATE;

            CellPosition = new Vector2I();

            Direction = GameData.DEFAULT_DIRECTION;

            Animations = new Dictionary<CombatantState, Dictionary<Direction, Animation>>();
            foreach (CombatantState combatantState in System.Enum.GetValues(typeof(CombatantState)))
                Animations.Add(combatantState, new Dictionary<Direction, Animation>());

            AddAnimation(CombatantState.Normal, Direction.N, new Animation((Animation)basePersonnage.GetSkin("Inactive", Direction.N)));
            AddAnimation(CombatantState.Normal, Direction.E, new Animation((Animation)basePersonnage.GetSkin("Inactive", Direction.E)));
            AddAnimation(CombatantState.Normal, Direction.S, new Animation((Animation)basePersonnage.GetSkin("Inactive", Direction.S)));
            AddAnimation(CombatantState.Normal, Direction.O, new Animation((Animation)basePersonnage.GetSkin("Inactive", Direction.O)));

            AddAnimation(CombatantState.Moving, Direction.N, new Animation((Animation)basePersonnage.GetSkin("Moving", Direction.N)));
            AddAnimation(CombatantState.Moving, Direction.E, new Animation((Animation)basePersonnage.GetSkin("Moving", Direction.E)));
            AddAnimation(CombatantState.Moving, Direction.S, new Animation((Animation)basePersonnage.GetSkin("Moving", Direction.S)));
            AddAnimation(CombatantState.Moving, Direction.O, new Animation((Animation)basePersonnage.GetSkin("Moving", Direction.O)));

            foreach (CombatantState state in Animations.Keys)
                foreach (Animation animation in Animations[state].Values)
                    animation.Play();

            MoveInfo = new CMoveInfo(this);

            Status = new CombatantStatus();
            Status.OnChange += new StatusChangeEventHandler(Status_OnChange);
            SpellPanoply = new SpellPanoply();
        }