/*IEnumerator CheckDistanceGround() * { * yield return new WaitForSeconds(0.1f); * while (!this.canLauchAxe) * { * bool check = true; * yield return new WaitForEndOfFrame(); * RaycastHit hit; * Ray ray = new Ray(this.transform.position, Vector3.down); * * if (Physics.Raycast(ray, out hit, 500f, this.groundLayerMask) && check) * { * if (hit.transform != null) * { * float dist = Vector3.Distance(this.transform.position, hit.point); * if (dist > this.distYGround) * { * float newDist = this.transform.position.y - (dist - this.distYGround); * this.transform.position = new Vector3(this.transform.position.x, newDist, this.transform.position.z); * } * else if (dist < this.distYGround) * { * float newDist = this.transform.position.y + (this.distYGround - dist); * this.transform.position = new Vector3(this.transform.position.x, newDist, this.transform.position.z); * } * } * * check = false; * * } * } * yield break; * }*/ public void isCanLaunchAxe(bool canLaunch, Quaternion orientation) { this.axeOrientation = orientation; this.canLauchAxe = canLaunch; if (!this.canLauchAxe) { this.myTrail.enabled = true; this.rigid.isKinematic = false; this.transform.parent = null; this.transform.eulerAngles = new Vector3(0, 0, 0); this.transform.position = this.myHandParent.transform.position; StartCoroutine(this.CheckObject()); //StartCoroutine(this.CheckDistanceGround()); } else if (this.canLauchAxe) { this.myTrail.enabled = false; this.myTrail.Clear(); this.rigid.isKinematic = true; this.transform.parent = myHandParent.transform; this.transform.localPosition = Vector3.zero; this.lastGuardian = null; StartCoroutine(CouldownLaunchAxe()); //this.transform.localRotation = axeInitRotate; } }
public void Init(int team, GuardianTraining guardian, Quaternion rotation, bool launchPlayer, int dir) { this.myTeam = team; this.myGuardian = guardian; this.currentDir = dir; this.pillierRotate = rotation; this.isLaunchPlayer = launchPlayer; this.rigid.isKinematic = false; }
void Awake() { if (this.characterController == null) { this.characterController = this.GetComponent <CompleteCharacterControllerTraining>(); } if (this.guardian == null) { this.guardian = this.GetComponent <GuardianTraining>(); } }
public void Init(Color myOwnerColor, int dir, GuardianTraining g, Vector3 point, Vector3 normal) { this.currentDir = dir; myOwnerColor.a = 0.333f; this.myguardian = g; this.currentDuration = Time.time + (this.animationScaleDuration / this.animationSpeed); this.plateformPosition = point; if (normal != Vector3.zero) { this.transform.rotation = Quaternion.FromToRotation(this.transform.up, normal); } }
private void CheckPlayer() { Collider[] col = Physics.OverlapBox(this.laserGO.transform.position, this.laserGO.transform.localScale / 2, this.laserGO.transform.rotation, this.checkLayer); if (col.Length > 0 && col != null) { for (int i = 0; i < col.Length; i++) { GuardianTraining g = col[i].GetComponent <GuardianTraining>(); if (g != null) { if (!g.IsInvinsible && !g.IsDie) { g.TakeDamage(this.damage); Debug.Log("Gardian toucher"); } return; } } } return; }
IEnumerator CheckObject() { while (!this.canLauchAxe) { yield return(new WaitForEndOfFrame()); bool check = true; bool objetFind = false; Collider[] col = Physics.OverlapCapsule(this.pointOneAxeLaunch.position, this.pointTwoAxeLaunch.position, axeRadiusLaunchCheck, ~ignoreLayerMask); Vector3 dir = myGuardian.transform.position - this.transform.position; if (col != null && check && !objetFind) { for (int i = 0; i < col.Length; i++) { GuardianTraining g = col[i].GetComponent <GuardianTraining>(); PillierTraining p = col[i].GetComponent <PillierTraining>(); if (g != null) { if (g != myGuardian && g != lastGuardian)//&& !g.IsStuned) { if (!g.IsStuned && !g.IsDie && !g.IsInvinsible) { lastGuardian = g; if (!this.BackToBucheron) { dir = -dir; } //dir.y = 0; g.SetStun(dir.normalized, forcePush); objetFind = true; /////Son collisionPlayer.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position)); collisionPlayer.start(); /////Son GameObject go = Instantiate(contactParticulePrefab, this.transform.position, Quaternion.LookRotation(-dir, Vector3.up)); Destroy(go, 1f); check = false; } } } else if (p != null && this.canDestroyPillier) { p.DestroyPillier(); /////Son collisionDecor.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position)); collisionDecor.start(); /////Son objetFind = true; check = false; } else { /////Son collisionDecor.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(transform.position)); collisionDecor.start(); /////Son objetFind = true; check = false; } } } if (objetFind) { //ActiveBackToBucheron(); this.axeLaunchTimer = 1f; } } yield break; }
/*GuardianTraining currentEnemyGuardian = null; * * public IEnumerator LaunchMeleeAttack() * { * this.IsFusRoDah = true; * StartCoroutine(this.StopMeleeAttack()); * yield return new WaitForEndOfFrame(); * while (this.IsFusRoDah) * { * yield return new WaitForSeconds(12.0f/60.0f); * MeleeAttack(); * } * * this.IsFusRoDah = false; * yield break; * } * * private void MeleeAttack() * { * Collider[] col = Physics.OverlapSphere(this.meleeHitPosition.position, this.detectionHitRadius, this.meleeHitCheckLayerMask); * * if (col != null) * { * for (int i = 0; i < col.Length; i++) * { * Pillier pillier = col[i].GetComponent<Pillier>(); * * if (!this.IsStuned) * { * if (pillier != null) * { * Debug.Log("Pillier hit"); * pillier.DestroyPillier(); * i = col.Length; * return; * } * } * * if (this.IsStuned) * { * this.IsFusRoDah = false; * } * } * } * } * * IEnumerator StopMeleeAttack() * { * yield return new WaitForSeconds(this.durationMeleeAttack); * this.IsFusRoDah = false; * this.IsCooldown = true; * currentEnemyGuardian = null; * SetCooldown(); * yield break; * } */ #endregion #region FusRoDa public void FusRoDa() { this.IsFusRoDah = true; switch (mode) { case FusRoDaMode.Cone: Vector3 position = this.transform.position + (this.CameraRef.rotation * Vector3.forward * (this.distanceCheck / 2)); Vector3 direction = this.cameraRef.rotation * Vector3.forward; ParticleSystem frdParticleSystem = Instantiate(this.fusRoDaFeedback, this.transform.position, this.cameraRef.rotation); ParticleSystem.ShapeModule shape = frdParticleSystem.shape; shape.length = this.distanceCheck; shape.angle = this.angleMaxToCheckCone; Collider[] guardianColliders = Physics.OverlapSphere(position, fusDetectionRadius, this.fusRoDahLayerMask); if (guardianColliders.Length > 0) { foreach (var guard in guardianColliders) { float distance = Vector3.Distance(this.transform.position, guard.transform.position); float angle = Vector3.Angle(this.transform.forward, guard.transform.position - this.transform.position); if (angle <= this.angleMaxToCheckCone && distance <= this.distanceCheck) { if (!Physics.Raycast(this.transform.position, guard.transform.position - this.transform.position, distance, ~this.fusIgnoreLayerMask)) { float force = this.forcePush; force = force * (1 - ((Vector3.Distance(this.transform.position, guard.transform.position)) / this.distanceCheck) / this.diviseurDistance); GuardianTraining guardian = guard.GetComponent <GuardianTraining>(); if (guardian != null && guardian != this) { guardian.SetStun(direction.normalized, force); } } } } StartCoroutine(CoolDownFus()); Destroy(frdParticleSystem.gameObject, 0.8f); } break; case FusRoDaMode.Laser: this.pointStartLaser.rotation = cameraRef.rotation; this.pointEndLaser.localPosition = new Vector3(this.pointEndLaser.localPosition.x, this.pointEndLaser.localPosition.y, this.distanceCheck); ParticleSystem frParticleSystem = Instantiate(this.fusRoDaFeedback, this.startPointFus.position, this.cameraRef.rotation); ParticleSystem.ShapeModule shpe = frParticleSystem.shape; shpe.length = this.distanceCheck; shpe.angle = 0f; shpe.radius = this.fusDetectionRadius; Collider[] laserCol = Physics.OverlapCapsule(this.pointStartLaser.position, this.pointEndLaser.position, this.fusDetectionRadius, this.fusRoDahLayerMask); Vector3 dir = this.cameraRef.rotation * Vector3.forward; if (laserCol.Length > 0) { foreach (var guard in laserCol) { float distance = Vector3.Distance(this.startPointFus.position, guard.transform.position); //float angle = Vector3.Angle(this.transform.forward, guard.transform.position - this.transform.position); if (distance <= this.distanceCheck) { if (!Physics.Raycast(this.startPointFus.position, guard.transform.position - this.transform.position, distance, ~this.fusIgnoreLayerMask)) { float force = this.forcePush; force = force * (1 - ((Vector3.Distance(this.startPointFus.position, guard.transform.position)) / this.distanceCheck) / this.diviseurDistance); GuardianTraining guardian = guard.GetComponent <GuardianTraining>(); if (guardian != null && guardian != this) { guardian.SetStun(dir.normalized, force); } } } } StartCoroutine(CoolDownFus()); Destroy(frParticleSystem.gameObject, 0.8f); } break; } }