private void RemoveTitan(Titan titan) { controller.OnRemoveTitan(titan); Units.Remove(titan); titan.Faction.RemoveUnit(titan); }
private void AddTitan(Faction faction, Vector3 position) { var titan = new Titan(faction, this, position); Units.Add(titan); controller.OnCreateTitan(titan); }
public void AddUnit(Titan titan) { Units.Add(titan); if (controller != null) { controller.OnAddTitan(titan); } }
public void RemoveUnit(Titan titan) { Units.Remove(titan); if (controller != null) { controller.OnRemoveTitan(titan); } }
public Laser(Titan parentTitan, Battle battleController, Accuracy titanAccuracy) { titan = parentTitan; battle = battleController; accuracy = titanAccuracy; timer = new ReloadTimer(2f, 0.3f); // TestFormulas(); }
public RocketInteraction(Titan parentTitan, Titan targetTitan, Damage damage, float speed = defaultSpeed) : base(parentTitan) { TargetTitan = targetTitan; Damage = damage; FlyTime = Vector3.Distance(parentTitan.Position, targetTitan.Position) / speed; timer = FlyTime; isIntercepted = false; }
public void Fire(Titan enemyTitan) { var isHit = accuracy.GetHitChance(enemyTitan.Cloaking); var isCritical = accuracy.GetCriticalChance(enemyTitan.Cloaking); var finalDamage = (isHit ? damage : 0) + (isCritical ? damage : 0); battle.AddInteraction(new LaserInteraction(titan, enemyTitan, new Damage(DamageType.Heat, finalDamage, isCritical && isHit))); timer.Reload(); }
public void Fire(Titan enemyTitan) { for (var i = 0; i < countInSalvo; i++) { var rocketDamage = new Damage(DamageType.Heat, damage); var rocket = new RocketInteraction(titan, enemyTitan, rocketDamage); battle.AddInteraction(new DelayedInteraction(titan, i * delay, rocket)); } timer.Reload(); }
private Titan FindTarget(Titan currentTarget) { if (currentTarget != null && currentTarget.IsAlive) { if (Vector3.Distance(currentTarget.Position, titan.Position) < fireRadius) { return(currentTarget); } } return(titan.FindEnemyInRange(fireRadius)); }
public void Update(float deltaTime) { if (!IsActive) { return; } timer.Update(deltaTime); if (!timer.IsReady) { return; } target = FindTarget(target); if (target == null) { return; } Fire(target); }
public Titan FindNearestEnemy(Vector3 position, float radius) { Titan nearestEnemy = null; float nearestDistance = 0; foreach (var enemyFaction in EnemyFactions) { foreach (var enemyTitan in enemyFaction.Units) { if (enemyTitan == null || !enemyTitan.IsAlive) { continue; } var distance = Vector3.Distance(enemyTitan.Position, position); if (distance < radius && (distance < nearestDistance || nearestEnemy == null)) { nearestDistance = distance; nearestEnemy = enemyTitan; } } } return(nearestEnemy); }
public ModuleSlot(Titan hostTitan) { titan = hostTitan; }
public void OnDetach(Titan titan) { }
public void OnAttach(Titan titan) { }
public LaserInteraction(Titan parentTitan, Titan targetTitan, Damage damage) : base(parentTitan) { TargetTitan = targetTitan; Damage = damage; }
public RocketLauncher(Titan parentTitan, Battle battleController) { titan = parentTitan; battle = battleController; }
public AbstractInteraction(Titan parentTitan) { ParentTitan = parentTitan; }