public void GenerateParticles(CChar agent, bool lTeam) { var pairs = agent.Proxy.GetModel().GetTile().GetAoETilesWithDistance(10); foreach (var pair in pairs) { this.GenerateThreatPoints(agent, pair.X, pair.Y, lTeam); this.GenerateVulnPoints(agent, pair.X, pair.Y, lTeam); } }
public Dictionary <EVuln, CharParticlePair> BuildVulns(CChar agent) { var vulns = new Dictionary <EVuln, CharParticlePair>(); foreach (EVuln vuln in Enum.GetValues(typeof(EVuln))) { this.SetVulnPoints(vuln, agent, vulns); } return(vulns); }
public void AssignDeathSplatter(CChar c) { var data = new EvSplatterData(); data.DmgPercent = 0.50; data.Target = c.GameHandle; var e = new EvSplatter(data); e.TryProcess(); }
private void SetThreatPoints(EThreat type, CChar agent) { var paramValues = ThreatTable.Instance.Table[type]; double threat = 0; foreach (var kvp in paramValues) { threat += agent.Proxy.GetStat(kvp.Key) * kvp.Value; } this._threats.Add(type, new CharParticlePair(agent.Proxy.GetGuid().ToString(), threat)); }
protected GameObject LayFatalityDeco(Sprite sprite, CChar c, string layer) { var deco = new GameObject(); deco.transform.position = c.GameHandle.transform.position; var renderer = deco.AddComponent <SpriteRenderer>(); renderer.sprite = sprite; renderer.sortingLayerName = layer; return(deco); }
private void SetVulnPoints(EVuln type, CChar agent, Dictionary <EVuln, CharParticlePair> vulns) { switch (type) { case (EVuln.Melee): { this.SetMeleeVulnPoints(agent, vulns); } break; case (EVuln.Ranged): { this.SetRangedVulnPoints(agent, vulns); } break; case (EVuln.Status): { this.SetStatusVulnPoints(agent, vulns); } break; } }
private void ProcessBloodHelper(CChar target, double percent, bool fatality = false) { var data = new EvSplatterData(); data.DmgPercent = percent; data.Fatality = fatality; data.Target = target.GameHandle; var e = new EvSplatter(data); e.TryProcess(); }
public void DisplayText(string text, CChar tgt, Color color) { var data = new HitDisplayData(); data.Color = color; data.Hit = null; data.Target = tgt.GameHandle; data.Text = text; data.YOffset = CombatGUIParams.FLOAT_OFFSET; data.Display(); }
private void SetStatusVulnPoints(CChar agent, Dictionary <EVuln, CharParticlePair> vulns) { double vuln = 0; var table = VulnTable.Instance.Table[EVuln.Status]; foreach (var kvp in table) { vuln += this.GetVulnPoints(kvp.Key, agent, table); } vulns.Add(EVuln.Status, new CharParticlePair(agent.Proxy.GetGuid().ToString(), vuln)); }
private double GetVulnPoints(ESecondaryStat stat, CChar agent, Dictionary <ESecondaryStat, double> table) { double vuln = 0; switch (stat) { case (ESecondaryStat.HP): { vuln = this.GetHPVulnPoints(agent, table); } break; default: { vuln = table[stat] * agent.Proxy.GetStat(stat); } break; } return(vuln); }
protected void ProcessBlood(CChar target) { foreach (var neighbor in target.Tile.GetAdjacent()) { foreach (var outerNeighbor in neighbor.GetAdjacent()) { this.ProcessBloodHelper(target, 0.2); } this.ProcessBloodHelper(target, 0.5); } this.ProcessBloodHelper(target, 1.0, true); }
public void Init(MHit hit) { this._hit = hit; this._target = this._hit.Data.Source; this._hit = hit; var dramaticZoom = this._target.GameHandle.AddComponent <SHangCallbackZoomOut>(); var position = this._hit.Data.Source.GameHandle.transform.position; position.y -= 0.3f; dramaticZoom.AddCallback(this.ZoomDone); dramaticZoom.Init(position, 50f, 18f, 1f); }
public void ProcessDeadChar(CChar c) { this.AssignDeadWeapons(c); this.AssignDeadEyes(c); this.AssignDeadLayer(c); this.RandomTranslateRotateOnDeath(c); this.AssignDeathSplatter(c); foreach (var kvp in c.View.EffectParticlesDict) { GameObject.Destroy(kvp.Value); c.View.EffectParticlesDict.Remove(kvp.Key); } }
public Pair <CTile, double> GetMoveTile(CChar agent) { this.CalculateParticlePoints(agent); this._tiles.RemoveAll(x => x.Tile.Controller.Current != null); if (this._tiles.Count > 0) { return(new Pair <CTile, double>(this._tiles[0].Tile.Controller, this._tiles[0].Weight)); } else { return(new Pair <CTile, double>(null, 0)); } }
public Dictionary <EThreat, CharParticlePair> BuildThreats(CChar agent) { double wpnThreat = this.GetWeaponDamageThreat(agent); foreach (EThreat threat in Enum.GetValues(typeof(EThreat))) { this.SetThreatPoints(threat, agent); } this._threats[EThreat.Brawler].AddValue(wpnThreat); this._threats[EThreat.Melee].AddValue(wpnThreat); this._threats[EThreat.Ranged].AddValue(wpnThreat); return(this._threats); }
public void DisplayBarrier(CChar target, MHit hit) { var fx = new GameObject(); var renderer = fx.AddComponent <SpriteRenderer>(); renderer.sprite = CharSpriteLoader.Instance.GetBarrierSprite(); renderer.sortingLayerName = SortingLayers.PARTICLES; fx.transform.position = target.GameHandle.transform.position; fx.transform.SetParent(target.GameHandle.transform); var delete = fx.AddComponent <SDestroyByLifetime>(); delete.Init(fx, CombatGUIParams.SINGLE_FX_DUR); }
private void CalculateParticlePoints(CChar agent) { var tiles = agent.Tile.Model.GetEmptyAoETiles(4); foreach (var tile in tiles) { this.GenerateParticlePoints(agent.Proxy.GetAIRole(), tile, agent.Proxy.LParty); } var agentRole = new AgentRoleFactory().GetAgentRole(agent.Proxy.GetAIRole()); agentRole.ModifyParticleTilePoints(this._tiles, agent); this._tiles.Sort((x, y) => y.Weight.CompareTo(x.Weight)); }
private void HandleQuadrantHelper(MHit hit, CChar tgt, MTile tile) { if (tile.GetCurrentOccupant() != null) { if (tile.GetCurrentOccupant().GetType().Equals(typeof(CChar))) { this.HandleCharacterOccupant(tile); } else if (tile.GetCurrentOccupant().GetType().Equals(typeof(CDeco))) { this.HandleDecoOccupant(tile); } } }
private double GetHPVulnPoints(CChar agent, Dictionary <ESecondaryStat, double> table) { double vuln = 0; double percent = agent.Proxy.GetPoints(ESecondaryStat.HP) / agent.Proxy.GetStat(ESecondaryStat.HP); if (percent > 1) { percent = 1; } double delta = 1 - percent; vuln = delta / table[ESecondaryStat.HP]; return(vuln); }
protected GameObject AddBloodGeyser(CChar tgt) { var path = StringUtil.PathBuilder( CombatGUIParams.EFFECTS_PATH, CombatGUIParams.FIGHTING_FATALITY, CombatGUIParams.PARTICLES_EXTENSION); var position = tgt.GameHandle.transform.position; var boom = Resources.Load(path); var particles = GameObject.Instantiate(boom) as GameObject; particles.transform.position = position; particles.name = CombatGUIParams.FIGHTING_FATALITY + " Particles"; return(particles); }
public void ProcessCharDeath(CChar c) { this._combatData.Characters.Remove(c); foreach (var party in this._combatData.LParties) { party.GetChars().Remove(c); } foreach (var party in this._combatData.RParties) { party.GetChars().Remove(c); } this._combatData.InitiativeOrder.Remove(c); this._ai.RemoveAgentParticles(c, c.Proxy.LParty); }
public void SetBodyViewComponentsNull(CChar c) { foreach (var sub in c.SubComponents) { if (!sub.Key.ToLowerInvariant().Contains("Weapon") && !sub.Key.ToLowerInvariant().Contains("Armor")) { var renderer = sub.Value.GetComponent <SpriteRenderer>(); if (renderer != null) { renderer.sprite = null; } } } }
private void HandleQuadrantFour(MHit hit, CChar tgt) { var obstructionTiles = new List <MTile>(); obstructionTiles.Add(tgt.Tile.Model.GetS()); obstructionTiles.Add(tgt.Tile.Model.GetSE()); obstructionTiles.Add(tgt.Tile.Model.GetNE()); foreach (var tile in obstructionTiles) { if (tile != null) { this.HandleQuadrantHelper(hit, tgt, tile); } } }
private void ProcessParticles(CChar c) { if (this._data.ParticlePath != null && !this._data.ParticlePath.Equals("")) { var path = StringUtil.PathBuilder( CombatGUIParams.EFFECTS_PATH, this._data.ParticlePath, CombatGUIParams.PARTICLES_EXTENSION); var controller = new ParticleController(); var particles = controller.CreateParticle(path); var script = particles.AddComponent <SDestroyByLifetime>(); script.Init(particles, CombatGUIParams.PARTICLE_DUR); controller.AttachParticle(c.GameHandle, particles); } }
public void AssignDeadWeapons(CChar c) { if (c.Proxy.GetLWeapon() != null) { RotateTranslateUtil.Instance.RandomRotateAndTranslate( c.SubComponents[SortingLayers.CHAR_L_WEAPON], ViewParams.SPLATTER_VARIANCE); } if (c.Proxy.GetRWeapon() != null) { RotateTranslateUtil.Instance.RandomRotateAndTranslate( c.SubComponents[SortingLayers.CHAR_R_WEAPON], ViewParams.SPLATTER_VARIANCE); } }
private void TryAttachHead(CChar c, string sort, int spriteIndex, CTile tile) { if (c.Proxy.Type == ECharType.Humanoid) { var sprite = c.View.Sprites[spriteIndex]; var spriteHandler = new GameObject(); var render = spriteHandler.AddComponent <SpriteRenderer>(); spriteHandler.transform.position = c.GameHandle.transform.position; spriteHandler.transform.SetParent(c.GameHandle.transform); spriteHandler.name = "Character Head"; render.sprite = sprite; render.sortingLayerName = sort; c.SubComponents.Add(sort, spriteHandler); } }
private void SetRangedVulnPoints(CChar agent, Dictionary <EVuln, CharParticlePair> vulns) { double vuln = 0; var calc = new ArmorVulnCalculator(); var table = VulnTable.Instance.Table[EVuln.Ranged]; var armorVulns = calc.GetArmorVulns(agent); vuln += armorVulns[ESecondaryStat.Damage_Ignore]; vuln += armorVulns[ESecondaryStat.Damage_Reduction]; foreach (var kvp in table) { vuln += this.GetVulnPoints(kvp.Key, agent, table); } vulns.Add(EVuln.Ranged, new CharParticlePair(agent.Proxy.GetGuid().ToString(), vuln)); }
public void AssignDeadEyes(CChar c) { if (c.Proxy.Type == ECharType.Humanoid) { var sprite = CharSpriteLoader.Instance.GetHumanoidDeadEyes(c.Proxy.Race); var eyes = c.SubComponents[SortingLayers.CHAR_FACE]; var renderer = eyes.GetComponent <SpriteRenderer>(); renderer.sprite = sprite; } else if (c.Proxy.Type == ECharType.Critter) { var sprite = CharSpriteLoader.Instance.GetCritterDeadSprite(c); var renderer = c.GameHandle.GetComponent <SpriteRenderer>(); renderer.sprite = sprite; } }
public void AttachEffectParticlesToChar(CChar tgt, GameObject particles, EEffect effect) { if (tgt != null) { this.DisplayText(tgt, effect); if (particles != null) { var view = tgt.View; if (!view.EffectParticlesDict.ContainsKey(effect)) { view.EffectParticlesDict.Add(effect, particles); particles.transform.SetParent(tgt.GameHandle.transform); particles.transform.position = tgt.GameHandle.transform.position; } } } }
private void DisplayParryAndBlockHelper(CChar target, MHit hit, GameObject wpn) { var pos = wpn.transform.position; if (target.Proxy.LParty) { pos.x -= CombatGUIParams.PARRY_OFFSET; } else { pos.x += CombatGUIParams.PARRY_OFFSET; } var script = wpn.AddComponent <SBoomerang>(); script.Init(wpn, pos, CombatGUIParams.PARRY_SPEED); script.AddCallback(hit.CallbackHandler); }