public override CGObject ReadObject(BinaryReader reader, int objectId, MapPosition objectPosition) { CGGarrison garrison = new CGGarrison(); EPlayerColor color = (EPlayerColor)reader.ReadByte(); garrison.SetOwner(color); reader.Skip(3); CreatureSet creatureSet = ReadCreatureSet(reader, 7); if (MapHeader.Version > EMapFormat.ROE) { garrison.RemovableUnits = reader.ReadBoolean(); } else { garrison.RemovableUnits = true; } reader.Skip(8); return(garrison); }
internal void Update(PlayerInitInfo pNewInfo) { Number = pNewInfo.Number; Hero = pNewInfo.Hero; Name = pNewInfo.Name; Color = pNewInfo.Color; PlayerType = pNewInfo.PlayerType; PhotonPlayer = pNewInfo.PhotonPlayer; IsReady = pNewInfo.IsReady; }
public void SetFloatingCrew(Sprite sprite, EPlayerColor playerColor, Vector3 direction, float floatingSpeed, float rotateSpeed, float size) { this.playerColor = playerColor; this.direction = direction; this.floatingSpeed = floatingSpeed; this.rotateSpeed = rotateSpeed; spriteRenderer.sprite = sprite; spriteRenderer.material.SetColor("_PlayerColor", PlayerColor.GetColor(playerColor)); transform.localScale = new Vector3(size, size, size); spriteRenderer.sortingOrder = (int)Mathf.Lerp(1, 3767, size); }
//DEBUG INIT public PlayerInitInfo( int pNumber, EHero pHero, string pName, EPlayerColor pColor, EPlayerType pPlayerType, EKeyset pKeyset = EKeyset.None, PhotonPlayer pPhotonPlayer = null) { Number = pNumber; Hero = pHero; Name = pName; Color = pColor; PlayerType = pPlayerType; PhotonPlayer = pPhotonPlayer; Keyset = pKeyset; }
public static Color ToColor(this EPlayerColor pc) { switch (pc) { case EPlayerColor.Blue: return(new Color(0.68f, 0.87f, 0.9f)); case EPlayerColor.Red: return(new Color(0.93f, 0.345f, 0.46f)); case EPlayerColor.Gray: return(new Color(.7f, .7f, .7f)); case EPlayerColor.Yellow: return(new Color(.91f, .93f, .345f)); case EPlayerColor.Green: return(new Color(.345f, .93f, .63f)); } return(Color.white); }
public static string ToHex(this EPlayerColor pc) { switch (pc) { case EPlayerColor.Blue: return("#AEDDE8"); case EPlayerColor.Red: return("#E07B7B"); case EPlayerColor.Gray: return("#BFBFBF"); case EPlayerColor.Yellow: return("#EDED61"); case EPlayerColor.Green: return("#61ED74"); } return(""); }
public void SpwanFloatingCrew(EPlayerColor playerColor, float dist) { if (!crewStates[(int)playerColor]) { crewStates[(int)playerColor] = true; float angle = Random.Range(0f, 360f); Vector3 spawnPos = new Vector3(Mathf.Sin(angle), Mathf.Cos(angle), 0f) * distance; Vector3 direction = new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0f); float floatingSpeed = Random.Range(2.5f, 4f); float rotoateSpeed = Random.Range(-3f, 4f); var crew = Instantiate(prefab, spawnPos, Quaternion.identity).GetComponent <FloatingCrew>(); crew.SetFloatingCrew(sprites[Random.Range(0, sprites.Count)], playerColor, direction, rotoateSpeed, floatingSpeed, Random.Range(0.5f, 1f)); } }
public void Init(PlayerInitInfo pPlayerInfo) { heroConfig = brainiacs.HeroManager.GetHeroConfig(pPlayerInfo.Hero); if (heroConfig.Animator) { animator.runtimeAnimatorController = heroConfig.Animator; } else { Debug.LogError($"{heroConfig.Hero} doesnt have animator configured"); } playerColor = pPlayerInfo.Color; int paletteIndex = GetColorPaletteIndex(pPlayerInfo.Color); paletteSwap.SetPalette(paletteIndex); SetLightColor(playerColor); }
internal static Color GetColor(EPlayerColor pColor) { switch (pColor) { case EPlayerColor.Blue: return(Color.blue); case EPlayerColor.Red: return(Color.red); case EPlayerColor.Yellow: return(Color.yellow); case EPlayerColor.Green: return(Color.green); case EPlayerColor.Pink: return(Color.magenta); } Debug.LogError("Wrong color requested: " + pColor); return(Color.black); }
private void SetLightColor(EPlayerColor pColor) { Color color = Color.white; switch (pColor) { case EPlayerColor.None: color = Color.white; break; case EPlayerColor.Blue: color = lightColor_Blue; break; case EPlayerColor.Red: color = lightColor_Red; break; case EPlayerColor.Yellow: color = lightColor_Yellow; break; case EPlayerColor.Green: color = lightColor_Green; break; case EPlayerColor.Pink: color = lightColor_Pink; break; default: Debug.LogError("Color not found"); break; } light.color = color; }
public void SetOwner(EPlayerColor color) { this.CurrentOwner = color; }
private void AssignColor(EPlayerColor pColor) { Info.Color = pColor; color.color = UIColorDB.GetColor(Info.Color); }
private static int GetColorPaletteIndex(EPlayerColor pColor, int pOffset = 0) { return((int)pColor - 1 + pOffset); }
public static Color GetColor(EPlayerColor playerColor) { return(colors[(int)playerColor]); }
public override CGObject ReadObject(BinaryReader reader, int objectId, MapPosition objectPosition) { HeroInstance hero = new HeroInstance(); if (MapHeader.Version > EMapFormat.ROE) { uint identifier = reader.ReadUInt32(); //// map->questIdentifierToId[identifier] = objectId; } EPlayerColor owner = (EPlayerColor)reader.ReadByte(); hero.SubId = reader.ReadByte(); //If hero of this type has been predefined, use that as a base. //Instance data will overwrite the predefined values where appropriate. foreach (var preHero in this.Map.PredefinedHeroes) { if (preHero.SubId == hero.SubId) { //logGlobal->debug("Hero %d will be taken from the predefined heroes list.", nhi->subID); //delete nhi; hero = preHero; break; } } hero.SetOwner(owner); //// nhi->portrait = nhi->subID; foreach (DisposedHero disHero in this.Map.DisposedHeroes) { if (disHero.HeroId == hero.SubId) { hero.Data.Name = disHero.Name; hero.Data.PortaitIndex = disHero.Portrait; break; } } bool hasName = reader.ReadBoolean(); if (hasName) { hero.Data.Name = reader.ReadStringWithLength(); } if (MapHeader.Version > EMapFormat.AB) { bool hasExp = reader.ReadBoolean(); if (hasExp) { hero.Data.Experience = reader.ReadUInt32(); } else { hero.Data.Experience = 0xffffffff; } } else { hero.Data.Experience = reader.ReadUInt32(); //0 means "not set" in <=AB maps if (hero.Data.Experience == 0) { hero.Data.Experience = 0xffffffff; } } bool hasPortrait = reader.ReadBoolean(); if (hasPortrait) { hero.Data.PortaitIndex = reader.ReadByte(); } bool hasSecSkills = reader.ReadBoolean(); if (hasSecSkills) { // Replacing with current data hero.Data.SecondarySkills = new List <AbilitySkill>(); uint howMany = reader.ReadUInt32(); for (int yy = 0; yy < howMany; ++yy) { ESecondarySkill skill = (ESecondarySkill)reader.ReadByte(); ESecondarySkillLevel level = (ESecondarySkillLevel)reader.ReadByte(); AbilitySkill abilitySkill = new AbilitySkill(skill, level); hero.Data.SecondarySkills.Add(abilitySkill); } } bool hasGarison = reader.ReadBoolean(); if (hasGarison) { hero.Data.Army = ReadCreatureSet(reader, 7); hero.Data.Army.FormationType = (EArmyFormationType)reader.ReadByte(); } else { reader.ReadByte(); } LoadArtifactsOfHero(reader, this.Map, hero); hero.Patrol = new HeroPatrol(); hero.Patrol.PatrolRadius = reader.ReadByte(); if (hero.Patrol.PatrolRadius == 0xff) { hero.Patrol.IsPatrolling = false; } else { hero.Patrol.IsPatrolling = true; hero.Patrol.InitialPosition = objectPosition; } if (this.MapHeader.Version > EMapFormat.ROE) { bool hasCustomBiography = reader.ReadBoolean(); if (hasCustomBiography) { hero.Data.Biography = reader.ReadStringWithLength(); } hero.Data.Sex = reader.ReadByte(); // Remove trash if (hero.Data.Sex != 0xFF) { hero.Data.Sex &= 1; } } else { hero.Data.Sex = 0xFF; } // Spells if (this.MapHeader.Version > EMapFormat.AB) { bool hasCustomSpells = reader.ReadBoolean(); if (hasCustomSpells) { ReadSpells(reader, hero); } } else if (this.MapHeader.Version == EMapFormat.AB) { //we can read one spell byte buff = reader.ReadByte(); if (buff != 254) { hero.Data.Spells = new List <ESpellId>(); hero.Data.Spells.Add(ESpellId.PRESET); if (buff < 254) //255 means no spells { hero.Data.Spells.Add((ESpellId)buff); } } } if (this.MapHeader.Version > EMapFormat.AB) { bool hasCustomPrimSkills = reader.ReadBoolean(); if (hasCustomPrimSkills) { hero.Data.PrimarySkills = new List <int>(); for (int xx = 0; xx < GameConstants.PRIMARY_SKILLS; ++xx) { hero.Data.PrimarySkills.Add(reader.ReadByte()); } } } reader.Skip(16); return(hero); }