public bool doBehavior(bool condition) { if (condition && !active) { if (entity == null) { entity = this.gameObject.GetComponent <AI_Entity>(); } if (entity.pushOneShotParticles != null) { entity.pushOneShotParticles.Emit(entity.pushOneShotAmount); } if (!ManagesPostProcessing.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesPostProcessing.getInstance().hackingEntities.Add(this.gameObject); } if (ManagesPlayer.getInstance().playerValues.canUseAbilities) { if (entity.playRemoveAbilitiesSound) { entity.playSound(); } } ManagesPlayer.getInstance().canUseAbilities(false); ManagesGame.getInstance().utilityFunctions.particleEmission( ManagesPlayer.getInstance().noAbilityParticleSystem, true); active = true; } else if (condition && active) { if (entity.pushOneShotParticles != null) { entity.pushOneShotParticles.Emit(entity.pushOneShotAmount); } } else if (!condition && active) { ManagesPlayer.getInstance().canUseAbilities(true); if (ManagesPostProcessing.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesPostProcessing.getInstance().hackingEntities.Remove(this.gameObject); } ManagesGame.getInstance().utilityFunctions.particleEmission( ManagesPlayer.getInstance().noAbilityParticleSystem, false); active = false; } return(condition); }
public bool doBehavior(bool condition) { if (myBody == null) { myBody = this.gameObject.GetComponent <Rigidbody>(); } if (entity == null) { entity = this.gameObject.GetComponent <AI_Entity>(); } if (condition) { if (entity.useHackingPostProcessings && !ManagesPostProcessing.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesPostProcessing.getInstance().hackingEntities.Add(this.gameObject); } if (!startedBehavior && entity.playActivationSound) { entity.playSound(); } if (entity.playCombatMusic && !ManagesSound.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesSound.getInstance().hackingEntities.Add(this.gameObject); } if (entity.activationHint != null) { entity.activationHint.SetActive(true); } forceVector = contact.transform.position - this.transform.position; if (entity.flying != true) { forceVector.y = 0; } myBody.AddForce(forceVector.normalized * movementSpeed, ForceMode.Impulse); startedBehavior = true; return(condition); } if (entity.useHackingPostProcessings && ManagesPostProcessing.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesPostProcessing.getInstance().hackingEntities.Remove(this.gameObject); } if (!entity.keepHintActive && entity.activationHint != null) { entity.activationHint.SetActive(false); } if (entity.playCombatMusic && ManagesSound.getInstance().hackingEntities.Contains(this.gameObject)) { ManagesSound.getInstance().hackingEntities.Remove(this.gameObject); } startedBehavior = false; return(condition); }