public Character( StatExpressionsInfo statExpressions, CharacterPlanetPawn pawn, IInputSource inputSource, CharacterStatus status, CharacterStateController stateController, CharacterStateController weaponStateController, int teamId, CharacterInfo info ) { this.statExpressions = statExpressions; this.status = status; this.health = new IntReactiveProperty( this.status.maxHealth.Value ); this.pawn = pawn; this.inputSource = inputSource; this.stateController = stateController; this.weaponStateController = weaponStateController; this.teamId = teamId; this.info = info; this.inventory = new BasicInventory( this ); pawn.SetCharacter( this ); this.stateController.Initialize( this ); this.weaponStateController.Initialize( this ); var inputSourceDisposable = inputSource as IDisposable; if ( inputSourceDisposable != null ) { _compositeDisposable.Add( inputSourceDisposable ); } Observable.EveryUpdate().Subscribe( OnUpdate ).AddTo( _compositeDisposable ); status.moveSpeed.Subscribe( UpdatePawnSpeed ).AddTo( _compositeDisposable ); health.Subscribe( OnHealthChange );//.AddTo( _compositeDisposable ); instances.Add( this ); }
static void LoadFontSettings() { if (Selection.activeObject.GetType() == typeof(Font)) { Font font = Selection.activeObject as Font; string path = EditorUtility.OpenFilePanel("Read", "", "txt"); string[] lines = File.ReadAllLines(path); var info = new CharacterInfo[lines.Length]; for (int i = 0; i < lines.Length; i++) { string[] v = lines[i].Split(','); info[i].index = int.Parse(v[0]); info[i].uv.x = float.Parse(v[1]); info[i].uv.y = float.Parse(v[2]); info[i].uv.width = float.Parse(v[3]); info[i].uv.height = float.Parse(v[4]); info[i].vert.x = float.Parse(v[5]); info[i].vert.y = float.Parse(v[6]); info[i].vert.width = float.Parse(v[7]); info[i].vert.height = float.Parse(v[8]); info[i].width = info[i].vert.width; } font.characterInfo = info; EditorUtility.SetDirty(font); } }
public Person(CharacterInfo info) { m_info = info; m_name = info.name; m_health = info.health; m_currentHealth = m_health; }
// Ajout d'un Character dans toutes les liste public void AddCharacter(CharacterInfo Info) { int AcctId = Info.Character.AcctId; if (!_Accounts.ContainsKey(AcctId)) return; Log.Info("AddCharacter", "Ajout du personnage : " + Info.Character.Name); lock (_AcctChars) { Dictionary<byte, CharacterInfo> Dic = null; if (_AcctChars.ContainsKey(AcctId)) Dic = _AcctChars[AcctId]; else { Dic = new Dictionary<byte, CharacterInfo>(); _AcctChars.Add(AcctId, Dic); } Dic.Add(Info.Character.SlotId, Info); } if (!_IdChars.ContainsKey((UInt32)Info.Character.Id)) _IdChars.Add((UInt32)Info.Character.Id, Info); string Name = Info.Character.Name.ToUpper(); lock (_NameChars) if (!_NameChars.ContainsKey(Name)) _NameChars.Add(Name, Info); }
public void AddPlayer(Connection client, CharacterInfo ci) { if (!_players.ContainsKey(ci.ID)) { ci.WorldID = _worldIDs++; // Send NPC info to player foreach (NPC npc in _npcs.Values) { client.SendPacket(new NPCInfoPacket(npc)); } // Send Monster info to player foreach (Monster m in _monsters.Values) { client.SendPacket(new NPCInfoPacket(m)); } // Send player character info to all other players if (_players.Count > 0) { AddOtherPlayerPacket theNewGuy = new AddOtherPlayerPacket(ci); foreach (Connection pc in _players.Values) { // Tell the other player about the new guy pc.SendPacket(theNewGuy); // Tell the new guy about this player client.SendPacket(new AddOtherPlayerPacket(pc.Character)); } } } _players[ci.ID] = client; }
public bool PlayerMeetsRequirement(CharacterInfo player) { switch (_type) { case Type.Level: if( player.Level < _param ) return false; break; case Type.Race: if( _param != 0 && !player.Millena ) return false; break; case Type.Gender: if( _param != 0 && !player.Male ) return false; break; case Type.Job: if( player.Job != (byte)(_param) ) return false; break; case Type.Fame: if( player.Fame < _param ) return false; break; case Type.Item: if( !player.HasItem(_param) ) return false; break; } return true; }
public void InitializeSlot(CharacterInfo info) { m_info = info; ToggleSlot(true); ToolTip tip = GetComponent<ToolTip>(); if(tip != null) { tip.text = info.tip; tip.isEnabled = true; } Sprite[] textures = Resources.LoadAll<Sprite>("images/portraits"); string sprite = m_info.portrait; foreach(Sprite s in textures) { if(s.name == sprite) { portrait.sprite = s; break; } } textures = Resources.LoadAll<Sprite>("images/portraits"); sprite = m_info.charClass; foreach(Sprite s in textures) { if(s.name == sprite) { type.sprite = s; break; } } }
private static void BlitCharacter(int pixelSize, int maxWidth, FullDictionary<char, CharacterInfo> dict, ref int currentX, ref int currentY, Graphics g, FontFace typeface, char c) { if (c == ' ' || c == '\t') { int width = (c == ' ') ? pixelSize / 2 : pixelSize * 4; if (currentX + xInterval + width >= maxWidth) { currentX = 0; currentY += yInterval + pixelSize; if (currentY + yInterval + pixelSize >= maxWidth) { throw new Exception("Texture Size not big enough for required characters."); } } Bitmap glyphBitmap = new Bitmap(width + xInterval, pixelSize + yInterval); //float yoffset = pixelSize * 3 / 4 - glyph.HorizontalMetrics.Bearing.Y; g.DrawImage(glyphBitmap, currentX + xInterval, currentY + yInterval); CharacterInfo info = new CharacterInfo(currentX, currentY, width + xInterval, pixelSize + yInterval); dict.Add(c, info); glyphBitmap.Dispose(); currentX += width; } else { Surface surface; Glyph glyph; if (RenderGlyph(typeface, c, pixelSize, out surface, out glyph)) { if (currentX + xInterval + surface.Width >= maxWidth) { currentX = 0; currentY += yInterval + pixelSize; if (currentY + yInterval + pixelSize >= maxWidth) { throw new Exception("Texture Size not big enough for required characters."); } } Bitmap glyphBitmap = GetGlyphBitmap(surface); const int a = 5; const int b = 8; //float yoffset = pixelSize * a / b - glyph.HorizontalMetrics.Bearing.Y; float skyHeight = yInterval + pixelSize * a / b - glyph.HorizontalMetrics.Bearing.Y; if (skyHeight < 0) { skyHeight = 0; } if (skyHeight < 0) { skyHeight = 0; } else if (skyHeight + glyphBitmap.Height > yInterval + pixelSize) { skyHeight -= glyphBitmap.Height - (yInterval + pixelSize); } g.DrawImage(glyphBitmap, currentX + xInterval, currentY + skyHeight, glyphBitmap.Width, glyphBitmap.Height); #if DEBUG g.DrawRectangle(greenPen, currentX, currentY, glyphBitmap.Width + xInterval, yInterval + pixelSize - 1); g.DrawRectangle(redPen, currentX + xInterval, currentY + skyHeight, glyphBitmap.Width, glyphBitmap.Height); g.DrawLine(bluePen, currentX, currentY + yInterval + pixelSize * a / b, currentX + glyphBitmap.Width, currentY + yInterval + pixelSize * a / b); #endif CharacterInfo info = new CharacterInfo(currentX, currentY, glyphBitmap.Width + xInterval, yInterval + pixelSize - 1); dict.Add(c, info); glyphBitmap.Dispose(); currentX += xInterval + surface.Width; } surface.Dispose(); } }
public Character(Map map, Team team, CharacterInfo info, Vector3 position) { this.map = map; this.team = team; this.info = info; health = info.maxHealth; ressources = info.resMax; this.position = position; }
public Structure(Map map, BinaryReader reader) { position = reader.ReadVector3(); collisionPolygon = new Polygon(reader); characterFile = reader.ReadString(); teamID = reader.ReadInt32(); info = new CharacterInfo(characterFile); health = info.maxHealth; this.map = map; }
public Structure(Map map, Vector3 position, Vector3[] vertices, string characterfile, int teamID) { this.position = position; this.collisionPolygon = new Polygon(vertices); this.characterFile = characterfile; info = new CharacterInfo(characterfile); health = info.maxHealth; this.teamID = teamID; this.map = map; }
public MobaGame(string mapFile) { map = new Map(mapFile); teams = new Team[]{ new Team("Dick",0,255,255, new Vector3(10,0,990), map.Bushes.Length), new Team("Butt",255,0,0,new Vector3(990,0,10),map.Bushes.Length) }; map.SetTeams(teams); MinionBaseInfo = new CharacterInfo("Minion.ci"); MinionBonusPerMinute = new CharacterInfo("MinionBonus.ci"); }
/// <summary> /// Initializes a new Subtitle. /// </summary> /// <param name="speakerInfo">Speaker info.</param> /// <param name="listenerInfo">Listener info.</param> /// <param name="formattedText">Formatted text.</param> /// <param name="sequence">Sequence.</param> /// <param name="responseMenuSequence">Response menu sequence.</param> /// <param name="dialogueEntry">Dialogue entry.</param> public Subtitle(CharacterInfo speakerInfo, CharacterInfo listenerInfo, FormattedText formattedText, string sequence, string responseMenuSequence, DialogueEntry dialogueEntry) { this.speakerInfo = speakerInfo; this.listenerInfo = listenerInfo; this.formattedText = formattedText; this.sequence = sequence; this.responseMenuSequence = responseMenuSequence; this.dialogueEntry = dialogueEntry; this.entrytag = null; CheckVariableInputPrompt(); }
public void CharacterClicked(CharacterInfo info) { newRecruit = info; Debug.Log ("A character was clicked"); if(chars.party.Count > 3) { ToggleReplacers(true); inreplace = true; } else { level.RecruitCharacter(newRecruit); level.CloseInn(); } }
public void SaveCharactersInfo(CharacterInfo[] charInfos) { charactersInfo = charInfos; var filePath = Application.persistentDataPath + "charinfo.bin"; BinaryFormatter formatter = new BinaryFormatter(); var fs = File.Create(filePath); formatter.Serialize(fs, charactersInfo); fs.Close(); }
public bool PlayerMeetsRequirements(CharacterInfo player) { if (_requirements != null) { foreach (QuestRequirement qr in _requirements) { if (!qr.PlayerMeetsRequirement(player)) return false; } } return true; }
private void Awake() { myInfo = GetComponent<CharacterInfo>(); gameManager = GameObject.FindGameObjectWithTag("GameManager"); turnManager = gameManager.GetComponent<TurnManager>(); statusEffectManager = GetComponent<StatusEffectManager>(); gameInfo = gameManager.GetComponent<GameInfo>(); myAI = GetComponent<HeroAI>(); attackDelayTimer = gameObject.AddComponent<Timer>(); attackDelayTimer.Trigger += ExecuteHeroAction; attackShakeTimer = gameObject.AddComponent<Timer>(); attackShakeTimer.Trigger += ShakeMe; originalPosition = transform.position; }
protected virtual void OnGameBegin(CharacterInfo player1, CharacterInfo player2, StageOptions stage) { this.player1.character = player1; this.player1.targetLife = player1.lifePoints; this.player1.totalLife = player1.lifePoints; this.player1.wonRounds = 0; this.player2.character = player2; this.player2.targetLife = player2.lifePoints; this.player2.totalLife = player2.lifePoints; this.player2.wonRounds = 0; UFE.PlayMusic(stage.music); this.isRunning = true; }
private void Awake() { gameManager = GameObject.FindGameObjectWithTag("GameManager"); gameInfo = gameManager.GetComponent<GameInfo>(); myInfo = GetComponent<CharacterInfo>(); spriteManager = GetComponent<SpriteManager>(); currentHitpoints = maxHitpoints; hitShakeTimer = gameObject.AddComponent<Timer>(); hitShakeTimer.Trigger += ShakeMe; originalPosition = transform.position; if (maximumDamageReduction < 0) maximumDamageReduction = 0; if (maximumDamageReduction > 1) maximumDamageReduction = 1; }
public CharacterList(byte[] aBuffer) : base(aBuffer) { if (aBuffer.Length < 4) throw new Exception("Too short packet."); for(int i = 0; i < aBuffer[4]; i++) { CharacterInfo TempChar = new CharacterInfo(); char[] chName = new char[10]; Array.Copy(aBuffer, 5 + CharacterInfoLength * i + 1, chName, 0, 10); TempChar.Name = (new string(chName)).Trim('\0'); TempChar.Level = aBuffer[5 + CharacterInfoLength * i + 12] + aBuffer[5 + CharacterInfoLength * i + 13] * 256; this.CharList.Add(TempChar); } }
public CharacterManager(string fileName) { m_chars = new List<CharacterInfo>(); m_party = new List<Person>(); TextAsset json = (TextAsset)Resources.Load(fileName, typeof(TextAsset)); if(!json) { Debug.LogError("Couldn't find: " + fileName); } string content = json.text; Debug.Log ("Created character manager"); JSONNode characters = JSON.Parse(content); int charCount = characters["charCount"].AsInt; Debug.Log ("There are " + charCount + " characters"); for(int i = 0; i < charCount; i++) { CharacterInfo charInfo = new CharacterInfo(characters["chars"][i]); m_chars.Add(charInfo); } }
public SaveHeader(CharacterInfo playerCharacter, int playerMoney, string playerLocation) { Version = CURRENT_VERSION; TimeStamp = DateTime.UtcNow; if (playerCharacter != null) { CharacterName = playerCharacter.Name; CharacterPortrait = playerCharacter.PortraitIndex; Money = playerMoney; Location = playerLocation; } else { CharacterName = "Unnamed"; CharacterPortrait = -1; Money = 0; Location = null; } }
void CreateFont() { XmlDocument _doc = new XmlDocument(); byte[] _array = Encoding.ASCII.GetBytes(xmlText.text); MemoryStream _stream = new MemoryStream(_array); _doc.Load(_stream); XmlNode _font = _doc.SelectSingleNode("font"); XmlElement _common = (XmlElement)_font.SelectSingleNode("common"); float _scaleW = float.Parse(_common.GetAttribute("scaleW")); float _scaleH = float.Parse(_common.GetAttribute("scaleH")); XmlNode _chars = _font.SelectSingleNode("chars"); XmlNodeList _charsList = _chars.ChildNodes; CharacterInfo[] _infos = new CharacterInfo[_charsList.Count]; for (int i = 0; i < _charsList.Count; i++) { XmlElement _element = (XmlElement)_charsList[i]; CharacterInfo _characterInfo = new CharacterInfo(); _characterInfo.index = int.Parse(_element.GetAttribute("id")); float _x = float.Parse(_element.GetAttribute("x")); float _y = float.Parse(_element.GetAttribute("y")); int _width = int.Parse(_element.GetAttribute("width")); int _height = int.Parse(_element.GetAttribute("height")); int _xadvance = int.Parse(_element.GetAttribute("xadvance")); _characterInfo.uv = new Rect(_x / _scaleW, 1 - (_y + _height) / _scaleH, _width / _scaleW, _height / _scaleH); _characterInfo.vert = new Rect(0, 0, _width, -_height); _characterInfo.width = _xadvance; Debug.Log(_characterInfo.uv); _infos[i] = _characterInfo; } font.characterInfo = _infos; }
void OnGUI() { targetFont = EditorGUILayout.ObjectField("Target Font", targetFont, typeof(Font), false) as Font; fntData = EditorGUILayout.ObjectField("Fnt Data", fntData, typeof(TextAsset), false) as TextAsset; fontMaterial = EditorGUILayout.ObjectField("Font Material", fontMaterial, typeof(Material), false) as Material; fontTexture = EditorGUILayout.ObjectField("Font Texture", fontTexture, typeof(Texture2D), false) as Texture2D; if (GUILayout.Button("Create BMFont")) { BMFontReader.Load(bmFont, fntData.name, fntData.bytes); // 借用NGUI封装的读取类 CharacterInfo[] characterInfo = new CharacterInfo[bmFont.glyphs.Count]; for (int i = 0; i < bmFont.glyphs.Count; i++) { BMGlyph bmInfo = bmFont.glyphs[i]; CharacterInfo info = new CharacterInfo(); info.index = bmInfo.index; info.uv.x = (float)bmInfo.x / (float)bmFont.texWidth; info.uv.y = 1 - (float)bmInfo.y / (float)bmFont.texHeight; info.uv.width = (float)bmInfo.width / (float)bmFont.texWidth; info.uv.height = -1f * (float)bmInfo.height / (float)bmFont.texHeight; info.vert.x = 0; info.vert.y = -(float)bmInfo.height; info.vert.width = (float)bmInfo.width; info.vert.height = (float)bmInfo.height; info.width = (float)bmInfo.advance; characterInfo[i] = info; } targetFont.characterInfo = characterInfo; if (fontMaterial) { fontMaterial.mainTexture = fontTexture; } targetFont.material = fontMaterial; fontMaterial.shader = Shader.Find("UI/Default"); Debug.Log("create font <" + targetFont.name + "> success"); Close(); } }
public CharacterInfo Load_CharacterData(int Sac1, int Sac2, int Sac3, int Sac4, int Sac5) { CharacterInfo temp = new CharacterInfo(); foreach (XmlNode node in characterTable) { if(int.Parse(node.SelectSingleNode("Sac1").InnerText) == Sac1) { if (int.Parse(node.SelectSingleNode("Sac2").InnerText) == Sac2) { if (int.Parse(node.SelectSingleNode("Sac3").InnerText) == Sac3) { if (int.Parse(node.SelectSingleNode("Sac4").InnerText) == Sac4) { if (int.Parse(node.SelectSingleNode("Sac5").InnerText) == Sac5) { temp.ID = int.Parse(node.SelectSingleNode("ID").InnerText); temp.Name = node.SelectSingleNode("Name").InnerText; temp.HP = int.Parse(node.SelectSingleNode("HP").InnerText); temp.AP = int.Parse(node.SelectSingleNode("AP").InnerText); temp.Sac1 = int.Parse(node.SelectSingleNode("Sac1").InnerText); temp.Sac2 = int.Parse(node.SelectSingleNode("Sac2").InnerText); temp.Sac3 = int.Parse(node.SelectSingleNode("Sac3").InnerText); temp.Sac4 = int.Parse(node.SelectSingleNode("Sac4").InnerText); temp.Sac5 = int.Parse(node.SelectSingleNode("Sac5").InnerText); return temp; } } } } } } return null; }
void Start() { BMFontReader.Load(mbFont, m_data.name, m_data.bytes); // 借用NGUI封装的读取类 CharacterInfo[] characterInfo = new CharacterInfo[mbFont.glyphs.Count]; for (int i = 0; i < mbFont.glyphs.Count; i++) { BMGlyph bmInfo = mbFont.glyphs[i]; CharacterInfo info = new CharacterInfo(); info.index = bmInfo.index; info.uv.x = (float)bmInfo.x / (float)mbFont.texWidth; info.uv.y = 1-(float)bmInfo.y / (float)mbFont.texHeight; info.uv.width = (float)bmInfo.width / (float)mbFont.texWidth; info.uv.height = -1f * (float)bmInfo.height / (float)mbFont.texHeight; info.vert.x = (float)bmInfo.offsetX*scale; //info.vert.y = (float)bmInfo.offsetY+(float)bmInfo.height-mbFont.charSize; info.vert.y = -((float)bmInfo.offsetY+(float)bmInfo.height)*scale; info.vert.width = (float)bmInfo.width*scale; info.vert.height = (float)bmInfo.height*scale; info.width = (float)bmInfo.advance*scale; characterInfo[i] = info; } m_myFont.characterInfo = characterInfo; }
public ShipInfo(Ship fromShip, CharacterInfo captain, int transientId) : this() { TransientID = transientId; var rb = fromShip.GetComponent<Rigidbody>(); name = fromShip.name; position = new SerializedVector3(rb.position); rotation = new SerializedQuaternion(rb.rotation); linearVelocity = new SerializedVector3(rb.velocity); angularVelocity = new SerializedVector3(rb.angularVelocity); targetable = fromShip.GetComponent<Targetable>(); shipType = fromShip.ShipType.name; abilityCooldowns = fromShip.Abilities.Select(a => a.Cooldown).ToList(); equippedModules = fromShip.ModuleLoadout .Select(m => m != null? new ModuleInfo(m) : null) .ToList(); var hp = fromShip.GetComponent<Hitpoints>(); if (hp) { armor = hp.GetArmor(); shield = hp.GetShield(); } else { armor = -1; shield = -1; } Captain = captain; }
private static void Work(TextAsset import, string exportPath, Texture2D texture) { if (!import) throw new UnityException (import.name + "is not a valid font-xml file"); Font font = new Font (); XmlDocument xml = new XmlDocument (); xml.LoadXml (import.text); XmlNode info = xml.GetElementsByTagName ("info") [0]; XmlNode common = xml.GetElementsByTagName ("common") [0]; XmlNodeList chars = xml.GetElementsByTagName ("chars") [0].ChildNodes; float texW = texture.width; float texH = texture.height; CharacterInfo[] charInfos = new CharacterInfo[chars.Count]; Rect r; for (int i=0; i<chars.Count; i++) { XmlNode charNode = chars [i]; if (charNode.Attributes != null) { CharacterInfo charInfo = new CharacterInfo (); charInfo.index = (int)ToFloat (charNode, "id"); charInfo.width = (int)ToFloat (charNode, "xadvance"); charInfo.flipped = false; r = new Rect (); r.x = ((float)ToFloat (charNode, "x")) / texW; r.y = ((float)ToFloat (charNode, "y")) / texH; r.width = ((float)ToFloat (charNode, "width")) / texW; r.height = ((float)ToFloat (charNode, "height")) / texH; r.y = 1f - r.y - r.height; charInfo.uv = r; r = new Rect (); r.x = (float)ToFloat (charNode, "xoffset"); r.y = (float)ToFloat (charNode, "yoffset"); r.width = (float)ToFloat (charNode, "width"); r.height = (float)ToFloat (charNode, "height"); r.y = -r.y; r.height = -r.height; charInfo.vert = r; charInfos [i] = charInfo; } } // Create material Shader shader = Shader.Find ("UI/Default"); Material material = new Material (shader); material.mainTexture = texture; AssetDatabase.CreateAsset (material, exportPath + ".mat"); // Create font font.material = material; font.name = info.Attributes.GetNamedItem ("face").InnerText; font.characterInfo = charInfos; AssetDatabase.CreateAsset (font, exportPath + ".fontsettings"); }
protected virtual void OnLifePointsChange(float newFloat, CharacterInfo player) { // You can use this to have your own custom events when a player's life points changes // TODO: we should use the player number instead of the character info because both players could use the same character }
protected virtual void OnNewAlert(string msg, CharacterInfo player) { // You can use this to have your own custom events when a new text alert is fired from the engine // TODO: we should use the player number instead of the character info because both players could use the same character }
protected virtual void OnHit(HitBox strokeHitBox, MoveInfo move, CharacterInfo player) { // You can use this to have your own custom events when a character gets hit // TODO: we should use the player number instead of the character info because both players could use the same character }
protected virtual void OnMove(MoveInfo move, CharacterInfo player) { // Fires when a player successfully executes a move }
public void DoXMLPase(ref string content) { XmlDocument xml = new XmlDocument(); xml.LoadXml(content); XmlNode info = xml.GetElementsByTagName("info")[0]; XmlNode common = xml.GetElementsByTagName("common")[0]; XmlNodeList pages = xml.GetElementsByTagName("pages")[0].ChildNodes; XmlNodeList chars = xml.GetElementsByTagName("chars")[0].ChildNodes; fontName = info.Attributes.GetNamedItem("face").InnerText; fontSize = ToInt(info, "size"); lineHeight = ToInt(common, "lineHeight"); lineBaseHeight = ToInt(common, "base"); textureWidth = ToInt(common, "scaleW"); textureHeight = ToInt(common, "scaleH"); int pageNum = ToInt(common, "pages"); textureNames = new string[pageNum]; for (int i = 0; i < pageNum; i++) { XmlNode page = pages[i]; int pageId = ToInt(page, "id"); textureNames[pageId] = page.Attributes.GetNamedItem("file").InnerText; } charInfos = new CharacterInfo[chars.Count]; for (int i = 0; i < chars.Count; i++) { XmlNode charNode = chars[i]; charInfos[i] = CreateCharInfo( ToInt(charNode, "id"), ToInt(charNode, "x"), ToInt(charNode, "y"), ToInt(charNode, "width"), ToInt(charNode, "height"), ToInt(charNode, "xoffset"), ToInt(charNode, "yoffset"), ToInt(charNode, "xadvance"), ToInt(charNode, "page")); } // kernings XmlNode kerningsNode = xml.GetElementsByTagName("kernings")[0]; if (kerningsNode != null && kerningsNode.HasChildNodes) { XmlNodeList kerns = kerningsNode.ChildNodes; kernings = new Kerning[kerns.Count]; for (int i = 0; i < kerns.Count; i++) { XmlNode kerningNode = kerns[i]; kernings[i] = new Kerning(); kernings[i].first = ToInt(kerningNode, "first"); kernings[i].second = ToInt(kerningNode, "second"); kernings[i].amount = ToInt(kerningNode, "amount"); } } }
public void RemoveCharacter(CharacterInfo ci) { TaskProcessor.AddTask(new Task(Task.TaskType.RemoveCharacter, null, ci)); }
private void getGlyphData( CharacterInfo[] result, string text, int size, FontStyle style ) { for( int i = 0; i < text.Length; i++ ) { if( !baseFont.GetCharacterInfo( text[ i ], out result[ i ], size, style ) ) { result[ i ] = new CharacterInfo() { flipped = false, index = -1, size = size, style = style, width = size * 0.25f }; } } }
protected virtual void OnRoundEnd(CharacterInfo winner, CharacterInfo loser) { // TODO: we should use the player number instead of the character info because both players could use the same character //++this.player1WonRounds; //++this.playe21WonRounds; }
public override void StoreCharacterMatch(CharacterInfo character) { }
protected virtual void OnGameEnd(CharacterInfo winner, CharacterInfo loser) { this.isRunning = false; if (UFE.gameMode == GameMode.VersusMode) { UFE.updatedLifePoints = UFE.config.player1Character.currentLifePoints; string level_fgt = PlayerPrefs.GetString("LEVEL"); if (winner == this.player1.character) { // HANUMAN PlayerPrefs.SetInt("FIGHTTAGBOOL", 200); int Fightabc = PlayerPrefs.GetInt("FIGHTTAG"); if (Fightabc == 3 && level_fgt.Equals("LEVELII")) { PlayerPrefs.SetInt("LankiniFight", 3); } else if (Fightabc == 4 && level_fgt.Equals("LEVELII")) { PlayerPrefs.SetInt("LankiniFight", 2); } else if (Fightabc == 1 && level_fgt.Equals("LEVELIII")) { PlayerPrefs.SetInt("LankiniFight", 4); } else { PlayerPrefs.SetInt("LankiniFight", 0); } Fightabc = Fightabc + 1; if (Fightabc == 5) { PlayerPrefs.SetString("LEVEL", "LEVELII"); PlayerPrefs.SetInt("FIGHTTAG", 0); } else { TileManager.FIGHTTAG = Fightabc; PlayerPrefs.SetInt("FIGHTTAG", TileManager.FIGHTTAG); } } else { // SKELETON PlayerPrefs.SetInt("FIGHTTAGBOOL", 100); int Fightabc2 = PlayerPrefs.GetInt("FIGHTTAG"); if (Fightabc2 == 4 && level_fgt.Equals("LEVELII")) { PlayerPrefs.SetInt("LankiniFight", 1); } else { PlayerPrefs.SetInt("LankiniFight", 0); } TileManager.FIGHTTAG = Fightabc2; PlayerPrefs.SetInt("FIGHTTAG", TileManager.FIGHTTAG); } float Lankacount = PlayerPrefs.GetFloat("AIMIII"); if (PlayerPrefs.GetString("LEVEL").Equals("LEVELI")) { Lankacount = (Lankacount / 4f); } else if (PlayerPrefs.GetString("LEVEL").Equals("LEVELII") || PlayerPrefs.GetString("LEVEL").Equals("LEVELIII")) { Lankacount = (Lankacount / 2f); } PlayerPrefs.SetFloat("enemyDistance", Lankacount); PlayerPrefs.SetFloat("HEALTH", UFE.updatedLifePoints); UFE.StartVersusModeAfterBattleScreen(); } else if (UFE.gameMode == GameMode.StoryMode) { if (winner == this.player1.character) { UFE.WonStoryModeBattle(); } else { UFE.StartStoryModeContinueScreen(); } } else { UFE.StartMainMenuScreen(); } }
static void Main(string[] args) { CharacterInfo info = new CharacterInfo(true); info.Store("Default.ci"); /* Character c1 = new Character(new Team(), new CharacterInfo("Minion.ci"), new Vector3(100,0,100)); Character c2 = new Character(new Team(), new CharacterInfo("Champion.ci"), new Vector3(120, 0, 120)); while(true) { c1.Update(1f); c2.Update(1f); c2.Attack(c1); Console.WriteLine("Character 2 health: {0}", c1.Health); Console.ReadLine(); } */ Map map = BuildDefaultMap(); map.Store("Testmap.mm"); Map map2 = new Map("Testmap.mm"); }
public void createAndSpawnEntity(Vector3 point, CharacterInfo c) { this.mStateMgr.MainState.CharacMgr.AddCharacter(c); }