public override void Init() { movementController = GetComponent <AIMovementController>(); animController = GetComponent <AnimationController>(); inventoryController = GetComponent <AIInventoryController>(); hitboxController = GetComponentInChildren <HitboxController>(); limbsController = GetComponentInChildren <LimbsController>(); troopController = GetComponent <AITroopController>(); healthController = GetComponent <HealthControllerAI>(); stateController = GetComponent <AIStateController>(); knockDownNotificationCollider.enabled = false; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.GetComponentInParent <HealthControllerAI>() != null) { HealthControllerAI healthController = other.gameObject.GetComponentInParent <HealthControllerAI>(); if (weaponRuntime.weaponItemData.isLethalWhenThrown == true) //Apply Kill when true { healthController.TakeDamage(1000, HitboxType.NULL); } else { healthController.knockdownController.ApplyKnockdown(); } } }
public override void Init() { viewMeshFilter = GetComponent <MeshFilter>(); aiController = GetComponentInParent <AIController>(); playerTarget = FindObjectOfType <HealthControllerPlayer>(); inventoryController = aiController.GetComponent <AIInventoryController>(); alertController = aiController.GetComponent <AIAlertController>(); aiHealthController = aiController.GetComponent <HealthControllerAI>(); stateController = aiController.GetComponent <AIStateController>(); knockdownController = aiController.GetComponent <AIKnockDownController>(); viewMesh = new Mesh(); viewMesh.name = "View Mesh"; viewMeshFilter.mesh = viewMesh; if (drawFieldOfViewMesh.value) { DrawFieldOfView(); } }
private void Explode() { Destroy(grenadeMesh); GameObject explosionGeo = Instantiate(grenadeItemData.explosionEffect); explosionGeo.transform.position = transform.position; Collider[] hitColliders = Physics.OverlapSphere(transform.position, grenadeItemData.explosionRadius, grenadeItemData.hitablesLayerMask.value); foreach (Collider item in hitColliders) { if (item.GetComponentInParent <HealthController>() != null) { HealthController healthcon = item.GetComponentInParent <HealthController>(); healthcon.TakeDamage(grenadeItemData.damage, HitboxType.NULL); if (healthcon.GetType() == typeof(HealthControllerAI)) { HealthControllerAI healthconAI = healthcon as HealthControllerAI; } } } StartCoroutine("FinalDestroy"); }