コード例 #1
0
ファイル: Player.cs プロジェクト: comradpara/OpenRA
        public Player( World world, Session.Client client )
        {
            World = world;
            Shroud = new ShroudRenderer(this, world.Map);

            PlayerActor = world.CreateActor("Player", new int2(int.MaxValue, int.MaxValue), this);

            if (client != null)
            {
                Index = client.Index;
                Palette = PlayerColors[client.PaletteIndex % PlayerColors.Count()].a;
                Color = PlayerColors[client.PaletteIndex % PlayerColors.Count()].c;
                PlayerName = client.Name;
                InternalName = "Multi{0}".F(client.Index);
            }
            else
            {
                Index = -1;
                PlayerName = InternalName = "Neutral";
                Palette = "neutral";
                Color = Color.Gray;	// HACK HACK
            }

            Country = world.GetCountries()
                .FirstOrDefault(c => client != null && client.Country == c.Name)
                ?? world.GetCountries().Random(world.SharedRandom);
        }
コード例 #2
0
ファイル: Player.cs プロジェクト: subspace/OpenRA
        public Player( World world, PlayerReference pr, int index )
        {
            World = world;
            Shroud = new ShroudRenderer(this, world.Map);

            Index = index;
            Palette = "player"+index;
            Color = pr.Color;
            Color2 = pr.Color2;
            ClientIndex = 0;		/* it's a map player, "owned" by host */

            PlayerName = InternalName = pr.Name;
            NonCombatant = pr.NonCombatant;
            Country = world.GetCountries()
                .FirstOrDefault(c => pr.Race == c.Race)
                ?? world.GetCountries().Random(world.SharedRandom);

            PlayerRef = pr;

            RegisterPlayerColor(world, Palette);
            PlayerActor = world.CreateActor("Player", new TypeDictionary{ new OwnerInit( this ) });
        }
コード例 #3
0
ファイル: Player.cs プロジェクト: subspace/OpenRA
        public Player( World world, Session.Client client, PlayerReference pr, int index )
        {
            World = world;
            Shroud = new ShroudRenderer(this, world.Map);

            Index = index;
            Palette = "player"+index;
            Color = client.Color1;
            Color2 = client.Color2;
            PlayerName = client.Name;
            InternalName = pr.Name;
            Country = world.GetCountries()
                .FirstOrDefault(c => client != null && client.Country == c.Race)
                ?? world.GetCountries().Random(world.SharedRandom);

            ClientIndex = client.Index;
            PlayerRef = pr;

            RegisterPlayerColor(world, Palette);
            PlayerActor = world.CreateActor("Player", new TypeDictionary{ new OwnerInit( this ) });
        }