public void SubscribeTargeter(ITargeter targeter) { if (targeter != null) { subscribedTargeters.Add(targeter); } }
public void RemoveSubscribedTargeter(ITargeter targeter) { if (targeter != null) { subscribedTargeters.Remove(targeter); } }
public override void Init() { Targeter = GetComponentInParent <ITargeter>(); Provider = GetComponentInParent <ITargetProvider>(); Ranger = GetComponentInParent <IRanger>(); UpdateStats(); }
public override void OnBulletImpact(Vector2 startPos, IDamagable damagable, ITargeter targeter) { if (damagable != null) { damagable.Damage(damage, targeter); } }
public TargetingManager( [Inject] ITargeter targeter, [Inject] ICursor cursor) { _targeter = targeter; _cursor = cursor; _updating = true; }
public override void Init() { _targetProvider = GetComponentInParent <ITargetProvider>(); _targeter = GetComponentInParent <ITargeter>(); _beamStart = transform.Find("BeamStart"); _beam = transform.Find("Beam").GetComponent <LineRenderer>(); _particleForceField = GetComponentInChildren <ParticleSystemForceField>(); }
protected void AddAspect(ITargeter targeter, List <EffectInstance> effects) { if (effects.Count == 0 || targeter == null) { return; } aspects.Add(new SpellAspect() { Targeter = targeter, Effects = effects }); }
private void DeRegisterTargeter(ITargeter targeter) { targeter.CurrentTarget = null; if (!(targeter is Turret && ((Turret)targeter).TurretType == TurretTypes.Planet)) { targeter.PotentialTargets.Clear(); } if (_targetingObjects.ContainsKey(targeter.Id)) { _targetingObjects.Remove(targeter.Id); } }
public void TargeterIsUpdated() { //Arrange ITargeter targeter = Substitute.For <ITargeter>(); Container.Bind <ITargeter>().FromInstance(targeter); ICursor cursor = Substitute.For <ICursor>(); Container.Bind <ICursor>().FromInstance(cursor); TargetingManager tMan = Container.Resolve <TargetingManager>(); //Act tMan.Tick(); //Assert targeter.Received(1).AcquireTarget(); }
private void RegisterTargeter(ITargeter targeter) { if (targeter is DefensiveMine) { return; } if (!_targetingObjects.ContainsKey(targeter.Id)) { _targetingObjects.Add(targeter.Id, targeter); if (!_suspendTargetSetting) { SetPotentialTargets(targeter); } } }
public void StartTargeting(int casterTeamId, Vector3 initPos, UnitAbility ability, Action <TargetingResultData> targetingResultCallback) { this.targetingResultCallback = targetingResultCallback; currentTargetingType = ability.TargetingType; currentTargetGroup = ability.TargetGroup; targeterInfoGO.SetActive(true); switch (ability.TargetingType) { case TargetingType.Single: currentTargeter = pointTargeter; additionalTargeter = null; break; case TargetingType.Self: currentTargeter = pointTargeter; additionalTargeter = null; break; case TargetingType.Line: currentTargeter = lineTargeter; additionalTargeter = basicPointTargeter; break; case TargetingType.Circle: currentTargeter = circleTargeter; additionalTargeter = basicPointTargeter; break; case TargetingType.All: default: Debug.Log($"[TargeterMaster] TargeterType unhandled {ability.TargetingType}"); break; } currentTargeter?.Setup(casterTeamId, initPos, ability.AbilitySize, ability.TargetGroup); additionalTargeter?.Setup(casterTeamId, initPos, 1f, null); if (ability.TargetingType != TargetingType.Self) { inputController.TargetPointer.Any.Enable(); } inputController.TargetPointer.Execute.Enable(); inputController.TargetPointer.Execute.performed += Execute_performed; }
/// <summary> /// Iterates through _targetableObjects and sets targeter.PotentialTargets appropriately /// </summary> /// <param name="targeter"></param> private void SetPotentialTargets(ITargeter targeter) { // If landing becomes slow for large numbers of turrets, // Reimplement this with single PotentialTurretTargets collection. targeter.PotentialTargets.Clear(); foreach (var pt in _targetableObjects) { if (pt.Value is CommandCenter) { continue; } else if (!pt.Value.OnSameTeam(targeter)) { targeter.PotentialTargets.Add(pt.Value.Id, pt.Value); } } }
public override void OnBulletImpact(Vector2 startPos, IDamagable damagable, ITargeter targeter) { if (damagable != null) { Collider2D[] collidedObjects = Physics2D.OverlapCircleAll(startPos, blastRadius, blastLayer); for (int i = 0; i < collidedObjects.Length; i++) { if (collidedObjects[i]) { IDamagable collidedDamagable = collidedObjects[i].GetComponent <IDamagable>(); if (collidedDamagable != null) { collidedDamagable.Damage(damage, targeter); } } } } }
public void Damage(int damage, ITargeter targeter) { if (!IsDead()) { hp -= damage; hp = Math.Max(0, hp); if (IsDead()) { GameManager.instance.IncreaseKillCount(); if (targeter != null) { targeter.OnTargetKilled(); } WarnAndClearSubscribers(); gameObject.SetActive(false); OnEnemyDeath?.Invoke(this); } } }
protected override void InitComponent() { Stats.GetStat(Stat.Type.Turret_Speed).SetNameAndDesc("Firerate", "The amount of times this weapon can fire per second."); Stats.GetStat(Stat.Type.Turret_Strength).SetNameAndDesc("Damage", "The amount of damage this weapon does."); Stats.AddStat(new Stat(Stat.Type.Weapon_Precision, "Prisicion", "The prisicion of this weapon, the higher the better.", 0)); Stats.AddStat(new Stat(Stat.Type.Weapon_ProjectileAmount, "Projectiles", "The amount of projectiles fired by this weapon.", 1)); Events.AddEvent(Modifiables.Event.Type.OnHit); Events.AddEvent(Modifiables.Event.Type.OnFirstHit); Events.AddEvent(Modifiables.Event.Type.OnPierce); Events.AddEvent(Modifiables.Event.Type.OnLastHit); Events.AddEvent(Modifiables.Event.Type.OnAOEHit); Events.AddEvent(Modifiables.Event.Type.OnDOTHit); Events.AddEvent(Modifiables.Event.Type.OnBeginFire); Events.AddEvent(Modifiables.Event.Type.OnFire); Events.AddEvent(Modifiables.Event.Type.OnProjectileFired); Events.AddEvent(Modifiables.Event.Type.OnProjectileFinished); _baseModTags.Add(Mod.Tag.TurretWeapon); _weapon = GetComponentInChildren <Weapon>(); _targeter = transform.parent.GetComponent <ITargeter>(); }
private void Awake() { _rayProvider = GetComponent <IRayProvider>(); _targeter = GetComponent <ITargeter>(); }
public abstract void OnBulletImpact(Vector2 impactPos, IDamagable damagable, ITargeter targeter);
public AuraAbility(IRequisite inflictedRequisite, ITargeter targeter) { _inflictedRequisite = inflictedRequisite; _targeter = targeter; Id = new RequisiteId(inflictedRequisite.Id + "Aura"); }
public void Initialize(ITargeter user) { _user = user; }
private void GetFallSpringMovesRemaining(Board board, AllianceScenario allianceScenario, ITargeter unitTargetCalculator, BoardMove workingBoardMove, HashSet <BoardMove> completedBoardMoves) { foreach (var kvp in board.OccupiedMapNodes.Where(kvp2 => !workingBoardMove.Sources.Contains(kvp2.Key))) { List <MapNode> path; UnitMove currentMove; if (unitTargetCalculator.TryGetMoveTargetValidateWithBoardMove(board, kvp.Key, allianceScenario, workingBoardMove, out path, out currentMove)) { workingBoardMove.Add(currentMove); } else { // uh oh, contradiction return; } } completedBoardMoves.Add(workingBoardMove.Clone()); return; }
public ProbabilisticFuturesAlgorithm() { _targeter = new SupplyCenterTargeter(); }
/// <summary> /// Get reference to the <see cref="_targeter"/>. /// </summary> private void Awake() { _targeter = GetComponentInParent <ITargeter>(); }
public AutoAttackAbility(HitPoints damage, ITargeter targeter) { _damage = damage; _targeter = targeter; }