public void Move(float MouseX) { if (!NotScoping) { MouseX = MouseX / 5; } rotAverageX = 0f; rotationX += MouseX; rotArrayX.Add(rotationX); if (rotArrayX.Count >= frameCounter) { rotArrayX.RemoveAt(0); } for (int i = 0; i < rotArrayX.Count; i++) { rotAverageX += rotArrayX[i]; } rotAverageX /= rotArrayX.Count; rotAverageX = AeTools.ClampAngle(rotAverageX, minimumX, maximumX); Quaternion xQuaternion = Quaternion.AngleAxis(rotAverageX, Vector3.up); transform.localRotation = originalRotation * xQuaternion; }
public override void RegisterKill(int Killer, int Killed, int weapon, int BodyPart) { if (Killer < 0) { Killer = Killed; } PlayerStats KillerStats = AeCore.m_pCoreGame.m_pNetworkHandler.LPlayerStats[Killer]; PlayerStats KilledStats = AeCore.m_pCoreGame.m_pNetworkHandler.LPlayerStats[Killed]; Weapon weap = AeTools.GetWeaponById(weapon); bool headshot = BodyPart == 1 ? true : false; int Money = PointsPerKill(headshot); AeScoreBoard scoreboard = AeCore.m_pCoreGame.m_pNetworkHandler.m_pScoreBoard; if (Killer != Killed) { KillerStats.m_iNbKills++; KillerStats.m_iMonneyRecolted += Money; if (Killer == AeCore.m_pCoreGame.MyStats.m_iPlayerID) { if (AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud) { AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.MadeAKill(headshot, Money, KilledStats.m_sPseudo, KillerStats.m_iMonneyRecolted - Money); } } if (scoreboard) { scoreboard.ReOrganizeText(Killer); } } KilledStats.m_iNbDeaths++; KilledStats.m_bDied = true; if (scoreboard) { scoreboard.ReOrganizeText(Killed); scoreboard.ReMakeAlive(Killed); } AeCore.m_pCoreGame.m_pNetworkHandler.m_pChat.AddKillBar(KillerStats, KilledStats, weap, headshot); if (Network.isServer) { AeCore.m_pCoreGame.networkView.RPC("RegisterKillRPC", RPCMode.Others, Killer, Killed, weapon, BodyPart); if (Killer != Killed) { AeDataRequest.m_pAeDataRequest.RegisterKill(KillerStats.m_sPseudo, true, PointsPerKill(headshot)); } AeDataRequest.m_pAeDataRequest.RegisterKill(KilledStats.m_sPseudo, false, 0); RegisterObjective(Killed); } }
void DoExplosion(GameObject epicenter) { var layerMask = ~(1 << 8); Collider [] RangedToExplosion = Physics.OverlapSphere(epicenter.transform.position, 3.0f); for (int i = 0; i < RangedToExplosion.Length; i++) { if (AeTools.isEnnemy(RangedToExplosion[i].tag)) { RaycastHit newHit; AeStats stat = RangedToExplosion[i].transform.root.GetComponent <AeStats>(); if (stat != null && AeTools.canDamage(this, stat, stat.networkView.isMine)) { if (Physics.Linecast(epicenter.transform.position, RangedToExplosion[i].transform.position, out newHit, layerMask)) { if (AeTools.isEnnemy(newHit.transform.tag)) { HitDamageInfo info = new HitDamageInfo(); stat.AlreadyTouchedByMagic = true; info.stat = stat; info.damageLocation = newHit.transform.tag; info.hit = newHit; info.isEnnemy = true; info.weaponID = m_iItemID; info.weaponDamage = Damage; info.player = stat.networkView; info.physicsFailed = false; AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(info); } } else { HitDamageInfo info = new HitDamageInfo(); stat.AlreadyTouchedByMagic = true; info.stat = stat; info.damageLocation = RangedToExplosion[i].transform.tag; info.isEnnemy = true; info.weaponID = m_iItemID; info.weaponDamage = Damage; info.player = stat.networkView; info.physicsFailed = false; AeCore.m_pCoreGame.m_pNetworkHandler.ServerInformations.GetCurrentMode().SendAttack(info); } } } } }
void SetWeapon(int WeaponID) { manager.m_pWeaponHandler.WeaponInventory.Add(AeTools.CopyWeaponById(WeaponID)); int listID = manager.m_pWeaponHandler.WeaponInventory.Count - 1; if (listID >= 0) { GameObject WepHolder = manager.m_pBones.WeaponLocalHolder.transform.FindChild((listID + 1).ToString()).gameObject; if (!manager.m_pWeaponHandler.WeaponInventory[listID].Initialize(networkView.isMine, manager.m_pBones.WeaponMultiHolder, WepHolder)) { Debug.Log("Failed while adding weapon"); } } }
public void CheckHeadInput() { var layerMask = ~(1 << 8); RaycastHit hit; Vector3 forward = TextHead.transform.TransformDirection(Vector3.forward); if (Physics.Raycast(AeCore.m_pCoreGame.MyStats.PlayerComponents.NormalCam.transform.position, forward, out hit, Mathf.Infinity, layerMask)) { if (AeTools.isEnnemy(hit.collider.tag)) { hit.collider.transform.root.GetComponentInChildren <AeHeadName>().TimerHead(); } } }
public ChatKillerLine(string kill, string killd, Weapon WeaponUsed, bool head) { Killer = kill; Killed = killd; if (WeaponUsed != null) { WeaponUsedKill = WeaponUsed.m_tIconTexture; } else { WeaponUsedKill = AeTools.GetWeaponById(1).m_tIconTexture; } headshot = head; }
void OnTriggerEnter(Collider collid) { if (transform.root.networkView.isMine) { if (AeTools.isEnnemy(collid.tag)) { AeStats h = collid.transform.root.GetComponent <AeStats>(); if (AeTools.canDamage(gauntlet, h, collid.transform.root.networkView.isMine)) { buildInfo(collid.gameObject, h); } } } }
public void Move(float MouseY) { if (!NotScoping) { MouseY = MouseY / 5; } if (rotationY > maximumY) { rotationY = maximumY; } else if (rotationY < minimumY) { rotationY = minimumY; } if (rotationY <= maximumY && rotationY >= minimumY) { rotationY += MouseY; } rotArrayY.Add(rotationY); if (rotArrayY.Count >= frameCounter) { rotArrayY.RemoveAt(0); } for (int j = 0; j < rotArrayY.Count; j++) { rotAverageY += rotArrayY[j]; } rotAverageY /= rotArrayY.Count; rotAverageY = AeTools.ClampAngle(rotAverageY, minimumY, maximumY); Quaternion yQuaternion = Quaternion.AngleAxis(rotAverageY, Vector3.left); transform.localRotation = originalRotation * yQuaternion; }
public static HitDamageInfo ShootingRaycast(Transform spawn, Vector3 direction, float range, float force, int damage, int weaponID) { HitDamageInfo info = new HitDamageInfo(); RaycastHit hit; Vector3 tempDir = spawn.TransformDirection(direction); var layerMask = ~(1 << 8); if (Physics.Raycast(spawn.position, tempDir, out hit, range, layerMask)) { if (hit.rigidbody) { hit.rigidbody.AddForceAtPosition(force * tempDir, hit.point); } if (AeTools.isEnnemy(hit.collider.tag)) { AeStats healthInfo = hit.collider.transform.root.GetComponent <AeStats>(); info.isEnnemy = true; info.damageLocation = hit.collider.tag; info.player = hit.collider.transform.root.networkView; info.stat = healthInfo; info.weaponDamage = damage; info.weaponID = weaponID; } else { info.damageLocation = hit.collider.tag; } } else { info.physicsFailed = true; } info.hit = hit; return(info); }
public override IEnumerator DoAction1CallBack() { ammoLeft--; HitDamageInfo HitInfo = AeRaycasts.ShootingRaycast(m_sTransforms.WeaponSpawnPoint, Vector3.forward, m_sStats.Range, m_sStats.Force, (int)m_sStats.WeaponDamage, WeaponID); DoRecoil(); GameObject TrailBull = MonoBehaviour.Instantiate(Trailbullet, MuzzleFlash.position, MuzzleFlash.rotation) as GameObject; m_sTransforms.Sounds.SoundAction1.Play(); MonoBehaviour.Destroy(TrailBull, 3.0f); if (HitInfo.physicsFailed) { Vector3 forward = m_sTransforms.WeaponSpawnPoint.TransformDirection(Vector3.forward); TrailBull.transform.LookAt((m_sTransforms.WeaponSpawnPoint.position + (forward * m_sStats.Range))); } else { TrailBull.transform.LookAt(HitInfo.hit.point); } if (HitInfo.isEnnemy || HitInfo.damageLocation == "PlayerRag" || HitInfo.damageLocation == "Player") { if (HitInfo.isEnnemy) { if (AeTools.damageLocationToInt(HitInfo.damageLocation) != -1) { AeTools.CreateParticle(m_sTransforms.Particles.Blood, HitInfo, true); } else { AeTools.CreateParticle(m_sTransforms.Particles.Metal, HitInfo, false); } } else { AeTools.CreateParticle(m_sTransforms.Particles.Blood, HitInfo, true); } } else if (HitInfo.damageLocation == "Untagged") { AeTools.CreateParticle(m_sTransforms.Particles.Concrete, HitInfo, true); } else if (HitInfo.damageLocation == "Wood") { AeTools.CreateParticle(m_sTransforms.Particles.Wood, HitInfo, true); } else if (HitInfo.damageLocation == "Metal") { AeTools.CreateParticle(m_sTransforms.Particles.Metal, HitInfo, true); } MuzzleFlash.localRotation = Quaternion.AngleAxis(Random.Range(0, 359), Vector3.forward); LightIndex++; if (LightIndex > m_sTransforms.Lights.Count - 1) { LightIndex = 0; } hasShot = true; m_sTransforms.Lights[LightIndex].gameObject.SetActive(true); MuzzleFlash.gameObject.SetActive(true); yield return(new WaitForSeconds(0.05f)); m_sTransforms.Lights[LightIndex].gameObject.SetActive(false); MuzzleFlash.gameObject.SetActive(false); yield return(new WaitForSeconds(m_sStats.FireRate - 0.05f)); hasShot = false; }
public override void SendAttack(HitDamageInfo info) { if (info.stat.m_iTeamID != AeCore.m_pCoreGame.MyStats.m_iTeamID) { Debug.Log("Attack from " + AeCore.m_pCoreGame.MyStats.m_iTeamID + " to " + info.stat.m_iTeamID); if (info.stat.Health > 0 && !info.stat.SpawnProtected) { info.player.RPC("TakeDamage", RPCMode.All, AeCore.m_pCoreGame.MyStats.m_iPlayerID, info.weaponDamage, info.weaponID, AeTools.damageLocationToInt(info.damageLocation)); AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.StartCoroutine(AeCore.m_pCoreGame.MyStats.PlayerComponents.m_pHud.Hitmark (AeTools.damageLocationToInt(info.damageLocation) == 1 ? true : false)); } } }
public override IEnumerator ActionCallBack() { HitDamageInfo info = AeRaycasts.ShootingRaycast(SpawnPoint, Vector3.forward, Range, Force, Damage, m_iItemID); if (info.physicsFailed) { Vector3 point = SpawnPoint.position + SpawnPoint.TransformDirection(Vector3.forward) * Range; info.hit.point = point; info.hit.normal = point; } float distance = Mathf.Round(Vector3.Distance(SpawnPointGraphic.transform.position, info.hit.point) * 2.0f); int vertexs = (int)(distance / sizeByVertex); vertexs += 1; float timeWait = ((distance / sizeByVertex) * timeBetweenVertex); canFire = false; if (componentsManager.m_pNetworkCaller.networkView.isMine) { Beams[0].parent.collider.enabled = true; } componentsManager.m_pWeaponHandler.StartCoroutine(GenerateNormalVertex(vertexs, info.hit.point)); for (int i = 1; i < Beams.Count; i++) { componentsManager.m_pWeaponHandler.StartCoroutine(GenerateSinusoidalVertex(i, vertexs, info.hit.point)); } float t = 0.0f; while (t < timeWait) { for (int j = 0; j < Beams.Count; j++) { Beams[j].Rotate(); } t += Time.deltaTime; yield return(null); } DoExplosion(AeTools.CreateParticle(ParticleOnHit, info, true, info.physicsFailed == false ? 0.4f : 0.0f)); float t2 = 0.0f; while (t2 < ShowTime) { for (int j = 0; j < Beams.Count; j++) { Beams[j].Rotate(); } t2 += Time.deltaTime; yield return(null); } Beams[0].parent.collider.enabled = false; resetBeams(); yield return(new WaitForSeconds(Cooldown)); canFire = true; }