/// <summary> /// Selects all objects tagged as "Enemy" from the _attackpoint to the _range /// </summary> /// <param name="_attackPoint">checks the range of enemies from this point</param> /// <param name="_range">distance from the enemy position to the attack point</param> private void Attack(Vector3 _attackPoint, float _range) { // this is a counter that determines what attack is executed _currentAttack++; // selects all the enemies List <GameObject> _damageGroup = GameObject.FindGameObjectsWithTag("Enemy").ToList(); // holder variables Rigidbody _pickedBody; AttributesController _attributesController = GetComponent <AttributesController>(); // pick all the enemies foreach (GameObject _object in _damageGroup) { // if an enemy is within range if (Vector3.Distance(_object.transform.position, _attackPoint) <= _range) { // damage unit _attributesController.Damage(_object, _attributesController.damage); // gets the rigidbody of the object _pickedBody = _object.GetComponent <Rigidbody>(); // knockback the object Knockback(_pickedBody, knockbackDistance); } } // if the attack state exceeds the maximum attack count reset if (_currentAttack >= maxAttackCount) { _currentAttack = (int)_attackState.initialAttack; } }
void Start() { attributes = GetComponent <AttributesController>(); sectorSensors = GetComponents <SectorSensor>(); distanceSensors = GetComponents <DistanceSensor>(); movementController = GetComponent <MovementController>(); rb = GetComponent <Rigidbody>(); }
public void Damage(GameObject _unit, int _damage) { AttributesController _attributeController = _unit.GetComponent <AttributesController>(); if (_attributeController != null) { _attributeController.currentHealth = _attributeController.currentHealth - _damage; } }
public IHttpActionResult GetAttributes() { CodebookResponse _responseEnvelope = new CodebookResponse(Request.Properties["requestId"].ToString(), true); String apiUser = RequestContext.Principal.Identity.Name; AutomationManager.AttributeObjectToAttributeApiObject(AutomationManager.attributes); AttributesManager = new AttributesManager(AutomationManager.IAttributeRepository.Object); var result = new AttributesController(AttributesManager, this.Request, this.RequestContext).GetAttributes() as OkNegotiatedContentResult<CodebookResponse>; return Ok(result.Content); }
public virtual void Revive() { if (AttributesController.health <= 0) { AnimationController.SetAnimationParameter(EnemyAnimatorParameter.Revive); contactCollider.enabled = true; } AttributesController.ResetAllAttributes(); }
public virtual void Revive() { if (AttributesController.health <= 0) { AnimationController.SetAnimationParameter(PlayerAnimatorParameter.Revive); //AnimationController.SetRevive(); contactCollider.enabled = true; } AttributesController.ResetAllAttributes(); GameManager.instance.screenUIController.playerUIController.OnEnable(); }
// Use this for initialization void Start() { Utility.DebugLog = true; experiment = new SimpleExperiment(); XmlDocument xmlConfig = new XmlDocument(); TextAsset textAsset = (TextAsset)Resources.Load("experiment.config"); xmlConfig.LoadXml(textAsset.text); experiment.SetOptimizer(this); // Calculate number of inputs numInputs = 0; AttributesController unitAttrs = Unit.GetComponent <AttributesController>(); SectorSensor[] sectorSensors = Unit.GetComponents <SectorSensor>(); DistanceSensor[] distanceSensors = Unit.GetComponents <DistanceSensor>(); MovementController movement = Unit.GetComponent <MovementController>(); if (unitAttrs != null) { numInputs += unitAttrs.needsFood ? 1 : 0; numInputs += unitAttrs.needsWater ? 1 : 0; } if (movement != null) { numInputs += movement.senseSpeed ? 1 : 0; numInputs += movement.senseSwimming ? 1 : 0; } if (sectorSensors.Length > 0) { foreach (SectorSensor sectorSensor in sectorSensors) { //numInputs += sectorSensor.senseAngles ? sectorSensor.numSectors * 2 : sectorSensor.numSectors; numInputs += sectorSensor.NumSenses; } } if (distanceSensors.Length > 0) { foreach (DistanceSensor distanceSensor in distanceSensors) { numInputs += distanceSensor.numSensors; } } experiment.Initialize("Car Experiment", xmlConfig.DocumentElement, numInputs, NumOutputs); champFileSavePath = Application.persistentDataPath + string.Format("/{0}.champ.xml", SaveFileName); popFileSavePath = Application.persistentDataPath + string.Format("/{0}.pop.xml", SaveFileName); print(champFileSavePath); }
protected virtual void OnEnable() { //Check Until GameManager instance is not Null StartCoroutine(WaitUntilConditionHappenCoroutine(ConditionFunc: () => { bool condition = GameManager.instance?.gamePlayMode == GamePlayMode.AR; return(condition); }, action: () => { transform.localScale = Vector3.one * GameManager.instance.characterLocalScaleForAR; AttributesController.ResetAllAttributes(); })); }
void Start() { //Script reference ac = controller.GetComponent <AttributesController>(); #region Starting Values For Variables And Attributes //Starting Values for timers fatigueTimer = startFatigue; exhaustionTimer = maxExhaustion; //Start with the correct values of the attributes for (int i = 0; i < ac.attributes.Count; i++) { if (ac.attributes[i].name == "hunger") { hungerDrain = ac.attributes[i].charge; maxHunger = ac.attributes[i].value; vHunger = maxHunger; } if (ac.attributes[i].name == "thirst") { thirstDrain = ac.attributes[i].charge; maxThirst = ac.attributes[i].value; vThirst = maxThirst; } if (ac.attributes[i].name == "stamina") { staminaCharge = ac.attributes[i].charge; maxStamina = ac.attributes[i].value; vStamina = maxStamina; } } #endregion }
void Start() { controller = GameObject.FindGameObjectWithTag("Player").GetComponent <AttributesController>(); }
public void SetUp() { _mediator = Substitute.For <IMediator>(); _sut = new AttributesController(_mediator); }
void Start() { controller = GameObject.FindGameObjectWithTag("Player").GetComponent<AttributesController>(); }