/// <summary> /// Spawns a turret for each specified target location /// </summary> /// <param name="targetLocations">Array of gameobject used as a target reference for where the turret goes to</param> public void SpawnTurrets(GameObject[] targetLocations) { if (targetLocations != null) { //Essentially resets arrays and sets new lengths _spawnedTurrets = new TurretControl[targetLocations.Length]; //Spawns a turret and chain for each given location for (int x = 0; x < targetLocations.Length; x++) { TurretControl control = Instantiate(turretPrefab, transform.position, transform.rotation).GetComponent <TurretControl>(); _spawnedTurrets[x] = control; control.targetLocationObj = targetLocations[x]; control.isMoving = true; //Spawns a random attack onto the turret Instantiate(turretAttacks[Random.Range(0, turretAttacks.Length)], control.transform); ChainHandler chain = Instantiate(_chainPrefab, transform.position, transform.rotation).GetComponent <ChainHandler>(); chain.targetObj = control.gameObject; chain.bossObj = gameObject; _spawnedChains.Add(chain); } } StartCoroutine(SetupTurret()); }
public ChainHandler <int, List <string> > CreateChain() { return(ChainHandler <int, List <string> > .CreateNew() .AddStep(standardKernel.Get <SampleStep1>()) .AddStep(standardKernel.Get <SampleStep2>()) .AddStep(standardKernel.Get <SampleStep2>()) .AddStep(standardKernel.Get <SampleStep3>())); }
/// <summary> /// Method called when a chain is destroyed. When all chains are destroyed /// a routine is activated for the damage phase /// </summary> /// <param name="chain"></param> public void OnChainDestroy(ChainHandler chain) { _spawnedChains.Remove(chain); //Let's boss take damage once all chains are destroyed if (_spawnedChains.Count == 0) { if (damageRoutine == null) { damageRoutine = DamageRoutine(); } else { StopCoroutine(damageRoutine); } StartCoroutine(damageRoutine); } }
/// <summary> /// Initializes a new instance of the <see cref="ChainHandler{T}"/> class. /// </summary> /// <param name="successor">The successor handler.</param> protected ChainHandler(ChainHandler <T> successor = null) => Successor = successor;
public OdometerHandler(ChainHandler nextHandler) : base(nextHandler) { }
public SpeedTicketQtree(ChainHandler nextHandler) : base(nextHandler) { _vehicleManager = new VehicleManager(new DAOFactory()); }
public void SetNextChain(ChainHandler <T> nextChain) { NextChain = nextChain; }