protected virtual void TakeEffectAt(IAnnihilable target, Vector3 location) { if (ExplodeRadius > 0) { var colliders = Physics.OverlapSphere(location, ExplodeRadius); foreach (var cldr in colliders) { var entity = cldr.GetComponent <IAnnihilable>(); if (entity != null) { var toCurUnitVector = (entity.GetTransform().position - location); RaycastHit hitInfo; var hasBlock = Physics.Raycast(location, toCurUnitVector, out hitInfo, toCurUnitVector.magnitude, LayerManager.Mask.Ground); if (!hasBlock || hitInfo.collider == entity.GetTransform().GetComponent <Collider>()) { entity.TakeDamage(Launcher, DamagePower); //unit.PushBack(ExplodeForce, location, ExplodeRadius); } } } } else { if (target != null) { target.TakeDamage(Launcher, DamagePower); } } Debug.Log("TryRpcPlayPointEffect(" + location); RpcPlayPointEffect(location); }
protected virtual void TakeEffectAt(IAnnihilable target, Vector3 location) { if (ExplodeRadius > 0) { var colliders = Physics.OverlapSphere(location, ExplodeRadius); foreach (var cldr in colliders) { var entity = cldr.GetComponent<IAnnihilable>(); if (entity != null) { var toCurUnitVector = (entity.GetTransform().position - location); RaycastHit hitInfo; var hasBlock = Physics.Raycast(location, toCurUnitVector, out hitInfo, toCurUnitVector.magnitude, LayerManager.Mask.Ground); if (!hasBlock || hitInfo.collider == entity.GetTransform().GetComponent<Collider>()) { entity.TakeDamage(Launcher, DamagePower); //unit.PushBack(ExplodeForce, location, ExplodeRadius); } } } } else { if (target != null) { target.TakeDamage(Launcher, DamagePower); } } Debug.Log("TryRpcPlayPointEffect(" + location); RpcPlayPointEffect(location); }