Exemplo n.º 1
0
        void RebuildPartyMembers()
        {
            var existing = Children.Where(x => x is SmallPlayer || x is LargePlayer).ToList();

            foreach (var player in existing)
            {
                player.Remove();
            }

            var state = Resolve <IGameState>();

            if (state.Party != null)
            {
                int i = 0;
                foreach (var player in state.Party.StatusBarOrder)
                {
                    var iCopy = i; // Make a copy to ensure each closure captures its own number.
                    player.GetPosition = () => _partyMovement.GetPositionHistory(iCopy).Item1;
                    (Vector3, int) PositionFunc() => _partyMovement.GetPositionHistory(iCopy);

                    AttachChild(_logicalMap.UseSmallSprites
                        ? (IComponent) new SmallPlayer(player.Id, player.Id.ToSmallPartyGraphics(), PositionFunc)
                        : new LargePlayer(player.Id, player.Id.ToBigPartyGraphics(), PositionFunc));
                    i++;
                }
            }
        }
Exemplo n.º 2
0
        void RebuildPartyMembers()
        {
            var existing = Children.Where(x => x is SmallPlayer || x is LargePlayer).ToList();

            foreach (var player in existing)
            {
                player.Remove();
            }

            var state = Resolve <IGameState>();

            if (state.Party != null)
            {
                foreach (var player in state.Party.StatusBarOrder)
                {
                    player.GetPosition = () => _partyMovement.GetPositionHistory(player.Id).Item1;
                    AttachChild(_logicalMap.UseSmallSprites
                        ? (IComponent) new SmallPlayer(player.Id, (SmallPartyGraphicsId)player.Id, () => _partyMovement.GetPositionHistory(player.Id)) // TODO: Use a function to translate logical to sprite id
                        : new LargePlayer(player.Id, (LargePartyGraphicsId)player.Id, () => _partyMovement.GetPositionHistory(player.Id)));            // TODO: Use a function to translate logical to sprite id
                }
            }
        }