public bool doBehavior(bool condition) { if (condition) { contactBody = contact.GetComponent <Rigidbody>(); if (entity == null) { entity = this.gameObject.GetComponent <AI_Entity>(); } if (entity.pushOneShotParticles != null) { entity.pushOneShotParticles.Emit(entity.pushOneShotAmount); } if (entity.playPushSound) { entity.playSound(); } contactBody.velocity = Vector3.zero; if (contact.GetComponent <IncreaseFallingSpeed>() != null) { contact.GetComponent <IncreaseFallingSpeed>().resetStrength(); } contactBody.AddForce( (contact.transform.position - this.transform.position) * movementSpeed, ForceMode.Impulse); } return(condition); }
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 (condition && !pulling) { contactBody = contact.GetComponent <Rigidbody>(); if (entity == null) { entity = this.gameObject.GetComponent <AI_Entity>(); } if (entity.pushOneShotParticles != null) { entity.pushOneShotParticles.Emit(entity.pushOneShotAmount); } contactBody.velocity = Vector3.zero; if (contact.GetComponent <IncreaseFallingSpeed>() != null) { contact.GetComponent <IncreaseFallingSpeed>().resetStrength(); } if (entity.playPullSound) { entity.playSound(); } StartCoroutine("pull"); } else if (pulling) { return(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); }