/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Eraser_Weapon() { //----------- Class_Controller.eraserMouseButtonDown = true; Class_Controller.playerDistanceWeapon = 300; GameObject bullet = WeaponsPool.GiveWeapons(11); if (Class_Interface.powerEnabled == false) { bullet.transform.localScale = Vector3.one * 10; } else { bullet.transform.localScale = Vector3.one * 12; } bullet.transform.SetPositionAndRotation(aim.position, aim.rotation); bullet.SetActive(true); if (Class_Interface.powerEnabled == false) { bullet.GetComponent <Rigidbody>().AddForce(aim.forward * 400); } else { bullet.GetComponent <Rigidbody>().AddForce(aim.forward * 500); } //----------- Class_Interface.eraserCounter -= 1; //----------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Lightning_Weapon() { //----------- Class_Controller.lightningMouseButtonDown = true; if (weaponsLightSparks.activeSelf == false) { weaponsLightSparks.SetActive(true); Invoke("Lightning_Weapon_Add", 0.65f); } //----------- GameObject bulletFx = WeaponsPool.GiveWeapons(5); if (Physics.CapsuleCast(aim.position, aim.position, 5, aim.forward, out weaponsRaycastHit, 200, 1 << 10 | 1 << 28 | 1 << 29 | 1 << 19 | 1 << 20 | 1 << 21 | 1 << 31)) { hitPointVector3 = weaponsRaycastHit.point; Class_Controller.playerDistanceWeapon = weaponsRaycastHit.distance; GameObject bullet = WeaponsPool.GiveWeapons(1); bullet.transform.SetPositionAndRotation(hitPointVector3, Quaternion.LookRotation(weaponsRaycastHit.normal)); bullet.SetActive(true); bulletFx.transform.position = pointOfShotStart.position; bulletFx.transform.LookAt(hitPointVector3); bulletFx.SetActive(true); bulletFx.GetComponent <Rigidbody>().AddForce(bulletFx.transform.forward * (500 + Class_Controller.currentSpeed * 9)); } else { Class_Controller.playerDistanceWeapon = 100; bulletFx.transform.position = pointOfShotStart.position; bulletFx.SetActive(true); bulletFx.GetComponent <Rigidbody>().AddForce(aim.forward * (500 + Class_Controller.currentSpeed * 9)); } //----------- if (lightningCounterAdd++ >= 2) { lightningCounterAdd = 0; Class_Interface.lightningCounter -= 1; } //----------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Default_Weapon() { //----------- Class_Controller.defaultMouseButtonDown = true; if (weaponsDefaultSparks.activeSelf == false) { weaponsDefaultSparks.SetActive(true); Invoke("Default_Weapon_Add", 0.5f); } //----------- GameObject bulletFx = WeaponsPool.GiveWeapons(3); if (Physics.CapsuleCast(aim.position, aim.position, 2.5f, aim.forward, out weaponsRaycastHit, 350, 1 << 10 | 1 << 28 | 1 << 29 | 1 << 19 | 1 << 20 | 1 << 21 | 1 << 31)) { hitPointVector3 = weaponsRaycastHit.point; Class_Controller.playerDistanceWeapon = weaponsRaycastHit.distance; GameObject bullet = WeaponsPool.GiveWeapons(0); bullet.transform.SetPositionAndRotation(hitPointVector3, Quaternion.LookRotation(weaponsRaycastHit.normal)); bullet.SetActive(true); bulletFx.transform.position = pointOfShotStart.position; bulletFx.transform.LookAt(hitPointVector3); bulletFx.SetActive(true); bulletFx.GetComponent <Rigidbody>().AddForce(bulletFx.transform.forward * (500 + (Class_Controller.currentSpeed * 9) + weaponsRaycastHit.distance)); } else { Class_Controller.playerDistanceWeapon = 100; bulletFx.transform.SetPositionAndRotation(pointOfShotStart.position, pointOfShotStart.rotation); bulletFx.SetActive(true); bulletFx.GetComponent <Rigidbody>().AddForce(aim.forward * (500 + Class_Controller.currentSpeed * 9)); } //----------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// void Shooting(float distanceC) { //-------------- if (distanceC < atackDistancePow0 && distanceC > atackDistance1) { speed = 7 * speedBehavior; if (aiAgr == true || attack == true) { aiAgr = attack = false; } } else if (distanceC < atackDistance1 && distanceC > atackDistance2) { speed = 20 * speedBehavior; if (aiAgr == true || attack == true) { aiAgr = attack = false; } } else if (distanceC < atackDistance2 && distanceC > atackDistance3) { speed = 5 * speedBehavior; if (aiAgr == true) { aiAgr = false; } if (counter5++ > counter19) { counter5 = 0; counter19 = Random.Range(15, 25); attack = true; } else if (attack == true) { attack = false; } } else if (distanceC < atackDistance3 && distanceC > atackDistance4 * randomAtackDistance) { speed = 3 * speedBehavior; if (Class_Interface.tamingEnabled == false) { aiAgr = true; } if (counter5++ > counter19) { counter5 = 0; counter19 = Random.Range(6, 16); attack = true; } else if (attack == true) { attack = false; } } else if (distanceC < atackDistance4 * randomAtackDistance) { if (dodge == false) { speed = -12 * speedBehavior; } else { speed = 6 * speedBehavior; } if (Class_Interface.tamingEnabled == false) { aiAgr = true; } if (counter5++ > counter19) { counter5 = 0; counter19 = Random.Range(3, 7); attack = true; } else if (attack == true) { attack = false; } } //-------------- if (attack == true && contusion == false && Class_Interface.tamingEnabled == false && dodge == false) { if (Mathf.Sqrt(Class_Controller.SqrMagnitudeToPlayer(thisTransform)) < thisAudioSource.maxDistance) { thisAudioSource.pitch = Random.Range(0.7f, 1.15f); thisAudioSource.panStereo = Random.Range(-0.1f, 0.1f); thisAudioSource.PlayOneShot(soundsFx[Random.Range(0, 2)], Random.Range(0.1f, 0.25f)); } if (weaponSparks != null && weaponSparks.activeSelf == false && lodUpdate0 == false && lodUpdate1 == false) { weaponSparks.SetActive(true); } GameObject bullet = WeaponsPool.GiveWeapons(9); bullet.transform.parent = null; bullet.transform.position = thisTransform.position + (thisTransform.forward * 1.5f); bullet.SetActive(true); bullet.GetComponent <Rigidbody>().AddForce(thisTransform.forward * bulletSpeed); } //-------------- }
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// IEnumerator Laser_Weapon() { //----------- if (laserTrigger0 == false) { Class_Controller.laserMouseButtonDown = true; } weaponsLaserSparks.SetActive(true); if (Physics.CapsuleCast(aim.position, aim.position, 2.5f, aim.forward, out weaponsRaycastHit, 500, 1 << 10 | 1 << 28 | 1 << 29 | 1 << 19 | 1 << 20 | 1 << 21 | 1 << 31)) { laserColliderObject = weaponsRaycastHit.collider.gameObject; Class_Controller.playerDistanceWeapon = weaponsRaycastHit.distance; laserTrigger1 = true; } else { Class_Controller.playerDistanceWeapon = 100; laserTrigger1 = false; } laserTrigger0 = true; int stopCounter = 0; //----------- while (laserTrigger0 == true) { yield return(delay0); GameObject bulletFx = WeaponsPool.GiveWeapons(4); bulletFx.transform.position = pointOfShotStart.position; bulletFx.SetActive(true); if (laserTrigger1 == true) { GameObject bullet = WeaponsPool.GiveWeapons(2); bullet.transform.SetPositionAndRotation(hitPointVector3, Quaternion.LookRotation(weaponsRaycastHit.normal)); bullet.SetActive(true); bulletFx.transform.LookAt(hitPointVector3); bulletFx.GetComponent <Rigidbody>().AddForce(bulletFx.transform.forward * (1000 + Class_Controller.currentSpeed * 9)); } else { bulletFx.GetComponent <Rigidbody>().AddForce(aim.forward * (1000 + Class_Controller.currentSpeed * 9)); } if (stopCounter++ > 3) { stopCounter = 0; laserLineRenderer.enabled = laserTrigger0 = false; weaponsLaserSparks.SetActive(false); } } //----------- if (laserCounterAdd++ >= 10) { laserCounterAdd = 0; Class_Interface.laserCounter -= 1; } //----------- }