private LocalBlackboard _localBlackboard; //req #region Setup public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out MovementRoot temp)) { _localBlackboard._moveRoot = temp; _localBlackboard._moveRoot.Setup(_localBlackboard); } if (TryGetComponent(out CombatRoot temp2)) { _localBlackboard._combatRoot = temp2; _localBlackboard._combatRoot.Setup(_localBlackboard); } if (TryGetComponent(out VisionRoot temp3)) { _localBlackboard._visionRoot = temp3; _localBlackboard._visionRoot.Setup(_localBlackboard); } if (TryGetComponent(out StatusManager temp4)) { _localBlackboard._statusManager = temp4; _localBlackboard._statusManager.Setup(_localBlackboard); } if (TryGetComponent(out AbilityRoot temp5)) { _localBlackboard._abilityRoot = temp5; _localBlackboard._abilityRoot.Setup(_localBlackboard); } }
private void PCControls() { if (!EventSystem.current.IsPointerOverGameObject()) { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, rayCastMask)) { GameObject hitObj = hit.transform.gameObject; touchedPos = hit.point; touchedUnit = hitObj.GetComponentInParent <LocalBlackboard>(); if (GlobalBlackboard.Instance.unitSelected) { UnitSelectedBranch(); } else { NothingSelectedBranch(); } } } } }
private void MobileControls() { if (!EventSystem.current.IsPointerOverGameObject()) { if (Input.touchCount > 0 && Input.GetTouch(0).phase == _touchPhase) //touch something { Touch currentTouch = Input.GetTouch(0); if (currentTouch.phase == _touchPhase) { Ray ray = Camera.main.ScreenPointToRay(currentTouch.position); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000, rayCastMask)) //touch actually reads, only do this if touch isn't a drag { GameObject hitObj = hit.transform.gameObject; touchedPos = hit.point; touchedUnit = hitObj.GetComponentInParent <LocalBlackboard>(); //if you've touched a unit, assign it //choose your path if (GlobalBlackboard.Instance.unitSelected) { UnitSelectedBranch(); } else { NothingSelectedBranch(); } } } } } }
//searches for enemy with the lowest health and makes that the target private void PrioritizeTarget() { lowestEnergy = Mathf.Infinity; targetInfo = null; for (int i = 0; i < numberOfUnitsSeen; i++) { if (objectsHit[i].transform.parent != transform) //don't find yourself { if (objectsHit[i].transform.parent.TryGetComponent <LocalBlackboard>(out tempTargetInfo)) { if (tempTargetInfo.heroUnit != _localBlackboard.heroUnit && !tempTargetInfo.dead) //if not on same team as this unit and that unit isn't dead { if (tempTargetInfo.energyLevel < lowestEnergy) //check to find the enemy with the lowest health, target that one { lowestEnergy = tempTargetInfo.energyLevel; targetInfo = tempTargetInfo; } } } } } if (targetInfo != null && !_localBlackboard.playerMoveInProgress) { _localBlackboard._commandMessenger.AddTarget(targetInfo, true); } }
public LocalBlackboard _localBlackboard; //req #region Setup //Initialize Components/Check if they exist private void Start() { //Adds one to the current count of units on screen GlobalBlackboard.Instance.unitsInFieldCount++; //Initialize Tick Time tickTime = Random.Range(tickTimeRange.x, tickTimeRange.y); if (TryGetComponent(out LocalBlackboard temp)) { _localBlackboard = temp; _localBlackboard._unitRoot = this; } else { Debug.LogError(gameObject.name + " is missing a LocalBlackboard Component. Please add it or the AI won't do anything."); } if (TryGetComponent(out CommandMessenger temp2)) { _localBlackboard._commandMessenger = temp2; _localBlackboard._commandMessenger.Setup(_localBlackboard); } else { Debug.LogError(gameObject.name + " is missing a CommandMessenger Component. Please add it or the AI won't do anything."); } }
public void Setup(LocalBlackboard localBlackboard) { if (TryGetComponent(out RandomPointGenerator temp)) { _randMovePoint = temp; _randMovePoint.Setup(localBlackboard); } }
public void AddTarget(LocalBlackboard newTarget, bool enemy) { if (_localBlackboard._visionRoot != null) { _localBlackboard._visionRoot.AddTarget(newTarget); } _localBlackboard._unitRoot.AddTarget(enemy); }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (rangeBox == null || rangeBox == default) { rangeBox = GlobalBlackboard.Instance.movementRangeBox; } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out ParentSpawnToTarget temp)) { _parentToTarget = temp; } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out TypeInfuser temp)) { _typeInfuser = temp; hasType = true; } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out AttackManager temp)) { _localBlackboard._attackManager = temp; _localBlackboard._attackManager.Setup(_localBlackboard); } }
//how's this handle healing? Doesn't seem like it currently does public void TakeDamage(float damageTaken, LocalBlackboard attacker) { _localBlackboard.energyLevel -= damageTaken; if (!_localBlackboard.hasTarget && !_localBlackboard.playerMoveInProgress) { _localBlackboard._commandMessenger.AddTarget(attacker, true); } CheckEnergy(); }
public void HealUnit(StatusManager unitHit, LocalBlackboard _localBlackboard) { if (healOthers) { unitHit.FullRecovery(); //heal units instead of damaging them } if (healSelf) { _localBlackboard._statusManager.FullRecovery(); } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out MultiplyAbility temp)) { temp.Setup(_localBlackboard); } if (TryGetComponent(out Collection temp2)) { temp2.Setup(_localBlackboard); } }
public void Setup(LocalBlackboard localBlackboard, AttackRoot attackRoot) { _localBlackboard = localBlackboard; myCollider = _localBlackboard.healthCollider; _attackRoot = attackRoot; if (hitBox.TryGetComponent(out TriggerSensor temp)) { _triggerSensor = temp; _triggerSensor.Setup(this); } else { Debug.LogError(gameObject.name + " is missing a trigger sensor on it's hitbox. Add one or suffer the consequences O_O! ...x_x"); } if (TryGetComponent(out DamageOverTime temp2)) { _damageOverTime = temp2; _damageOverTime.Setup(_attackRoot); } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; _localBlackboard.navAI = GetComponent <NavMeshAgent>(); if (TryGetComponent(out NavAIPrioritySetter temp)) { _navAIPriority = temp; _navAIPriority.SetUpAvoidancePriority(_localBlackboard.navAI); } if (TryGetComponent(out RandomFloatyMovement temp2)) { _randMove = temp2; _randMove.Setup(_localBlackboard); } if (TryGetComponent(out MoveWithTarget temp3)) { _moveTarget = temp3; _moveTarget.Setup(_localBlackboard); } BehaviorStateChanged(); }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out AttackPlayer temp)) { _attackPlayer = temp; _attackPlayer.Setup(localBlackboard); } foreach (GameObject atk in attackPrefabs) { attackRoots.Add(atk.GetComponent <AttackRoot>()); } foreach (AttackRoot atkRt in attackRoots) { atkRt.Setup(_localBlackboard); } _localBlackboard.attackCount = attackRoots.Count; SelectAttack(); }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; StartCoroutine(RepeatAbility()); }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; objectsHit = new Collider[GlobalBlackboard.Instance.maxUnitsInField]; }
public void AddTarget(LocalBlackboard newTarget) //possibly move this to status manager { _localBlackboard.hasTarget = true; _localBlackboard.currentTarget = newTarget; }
public void DealDamage(StatusManager unitHit, LocalBlackboard _localBlackboard, float damageMultiplier = 1) { damageToDeal = damageAmount * damageMultiplier; unitHit.TakeDamage(damageToDeal, _localBlackboard); }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; if (TryGetComponent(out TypeInflictor temp)) { _typeInflictor = temp; } if (TryGetComponent(out Spawn temp2)) { _spawn = temp2; _spawn.Setup(_localBlackboard); } if (TryGetComponent(out PushInflictor temp3)) { _pushInflictor = temp3; } if (TryGetComponent(out Collection temp4)) { _collection = temp4; _collection.Setup(_localBlackboard); } if (TryGetComponent(out StunInflictor temp5)) { _stunInflictor = temp5; } if (TryGetComponent(out AttackColliderController temp6)) { _attackCollider = temp6; _attackCollider.Setup(_localBlackboard, this); } if (TryGetComponent(out DestroyAfterTime temp7)) { _destroyAfterTime = temp7; _destroyAfterTime.Setup(_spawn); } if (TryGetComponent(out DoDamage temp8)) { _doDamage = temp8; } if (TryGetComponent(out Heal temp9)) { _heal = temp9; } if (TryGetComponent(out Recharge temp10)) { _recharge = temp10; _recharge.Setup(this); } if (TryGetComponent(out IndieAttackPlayer temp11)) { _indieAttackPlayer = temp11; _indieAttackPlayer.Setup(this); } if (TryGetComponent(out AttackFXPlayer temp12)) { _attackFXPlayer = temp12; } if (TryGetComponent(out DestroyOnHit temp13)) { _destroyOnHit = temp13; } if (TryGetComponent(out RecievePhysicsPush temp14)) { temp14.Setup(_localBlackboard.currentTarget.transform); } }
public void Setup(LocalBlackboard localBlackboard) { _localBlackboard = localBlackboard; }