diff options
author | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2022-03-10 14:07:40 +0800 |
commit | 22891bf59032ba88262824255a706d652031384b (patch) | |
tree | 7595439ba9966c9402d37e37cee5e8cf098757d5 /Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts | |
parent | 8b04ea73e540067f83870b61d89db4868fea5e8a (diff) |
* move folder
Diffstat (limited to 'Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts')
8 files changed, 0 insertions, 570 deletions
diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs deleted file mode 100644 index 7ea397bf..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-public class CameraShake : MonoBehaviour {
-
- //public bool cameraShakeBool = true;
- public Animator CamerShakeAnimator;
-
- // Use this for initialization
- void Start () {
-
- }
-
- // Update is called once per frame
- void Update () {
-
- }
-
- public void ShakeCamera()
- {
- CamerShakeAnimator.SetTrigger("CameraShakeTrigger");
- }
-}
diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs.meta b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs.meta deleted file mode 100644 index 8824141a..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/CameraShake.cs.meta +++ /dev/null @@ -1,13 +0,0 @@ -fileFormatVersion: 2 -guid: 8fd6dcdcf07bb644abde2fade0426568 -timeCreated: 1512820034 -licenseType: Store -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs deleted file mode 100644 index ee62553b..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs +++ /dev/null @@ -1,142 +0,0 @@ -using UnityEngine;
-using System.Collections;
-
-/* THIS CODE IS JUST FOR PREVIEW AND TESTING */
-// Feel free to use any code and picking on it, I cannot guaratnee it will fit into your project
-public class ExplodingProjectile : MonoBehaviour
-{
- public GameObject impactPrefab;
- public GameObject explosionPrefab;
- public float thrust;
-
- public Rigidbody thisRigidbody;
-
- public GameObject particleKillGroup;
- private Collider thisCollider;
-
- public bool LookRotation = true;
- public bool Missile = false;
- public Transform missileTarget;
- public float projectileSpeed;
- public float projectileSpeedMultiplier;
-
- public bool ignorePrevRotation = false;
-
- public bool explodeOnTimer = false;
- public float explosionTimer;
- float timer;
-
- private Vector3 previousPosition;
-
- // Use this for initialization
- void Start()
- {
- thisRigidbody = GetComponent<Rigidbody>();
- if (Missile)
- {
- missileTarget = GameObject.FindWithTag("Target").transform;
- }
- thisCollider = GetComponent<Collider>();
- previousPosition = transform.position;
- }
-
- // Update is called once per frame
- void Update()
- {
- /* if(Input.GetButtonUp("Fire2"))
- {
- Explode();
- }*/
- timer += Time.deltaTime;
- if (timer >= explosionTimer && explodeOnTimer == true)
- {
- Explode();
- }
-
- }
-
- void FixedUpdate()
- {
- if (Missile)
- {
- projectileSpeed += projectileSpeed * projectileSpeedMultiplier;
- // transform.position = Vector3.MoveTowards(transform.position, missileTarget.transform.position, 0);
-
- transform.LookAt(missileTarget);
-
- thisRigidbody.AddForce(transform.forward * projectileSpeed);
- }
-
- if (LookRotation && timer >= 0.05f)
- {
- transform.rotation = Quaternion.LookRotation(thisRigidbody.velocity);
- }
-
- CheckCollision(previousPosition);
-
- previousPosition = transform.position;
- }
-
- void CheckCollision(Vector3 prevPos)
- {
- RaycastHit hit;
- Vector3 direction = transform.position - prevPos;
- Ray ray = new Ray(prevPos, direction);
- float dist = Vector3.Distance(transform.position, prevPos);
- if (Physics.Raycast(ray, out hit, dist))
- {
- transform.position = hit.point;
- Quaternion rot = Quaternion.FromToRotation(Vector3.forward, hit.normal);
- Vector3 pos = hit.point;
- Instantiate(impactPrefab, pos, rot);
- if (!explodeOnTimer && Missile == false)
- {
- Destroy(gameObject);
- }
- else if (Missile == true)
- {
- thisCollider.enabled = false;
- particleKillGroup.SetActive(false);
- thisRigidbody.velocity = Vector3.zero;
- Destroy(gameObject, 5);
- }
-
- }
- }
-
- void OnCollisionEnter(Collision collision)
- {
- if (collision.gameObject.tag != "FX")
- {
- ContactPoint contact = collision.contacts[0];
- Quaternion rot = Quaternion.FromToRotation(Vector3.forward, contact.normal);
- if (ignorePrevRotation)
- {
- rot = Quaternion.Euler(0, 0, 0);
- }
- Vector3 pos = contact.point;
- Instantiate(impactPrefab, pos, rot);
- if (!explodeOnTimer && Missile == false)
- {
- Destroy(gameObject);
- }
- else if (Missile == true)
- {
-
- thisCollider.enabled = false;
- particleKillGroup.SetActive(false);
- thisRigidbody.velocity = Vector3.zero;
-
- Destroy(gameObject, 5);
-
- }
- }
- }
-
- void Explode()
- {
- Instantiate(explosionPrefab, gameObject.transform.position, Quaternion.Euler(0, 0, 0));
- Destroy(gameObject);
- }
-
-}
\ No newline at end of file diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs.meta b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs.meta deleted file mode 100644 index c912e350..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/ExplodingProjectile.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 538d28f745155f34fba977c5c1026e39 -timeCreated: 1483283774 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs deleted file mode 100644 index 69c939c6..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs +++ /dev/null @@ -1,102 +0,0 @@ -using System.Collections;
-using System.Collections.Generic;
-using UnityEngine;
-
-namespace StylizedProjectile
-{
-
-
-public class Projectile : MonoBehaviour
-{
- private float disappearAfterTime = 3;
- private float disappearTimer = 0;
-
- private bool isActive = false;
-
- // private MeshRenderer meshRenderer;
-
- private Vector3 direction;
- private Vector3 startPosition;
-
- private float movementSpeed = 1;
-
- private Vector3 targetPosition;
-
- private float distanceToTarget;
- private float movementValue;
-
- // Use this for initialization
- void Start ()
- {
- // We cache this for performance reasons, GetComponent is slow to do realtime
- // meshRenderer = GetComponent<MeshRenderer>();
- // meshRenderer = GetComponent<MeshRenderer>();
- }
-
- // Update is called once per frame
- void Update () {
- if (isActive) // Only update stuff if we're alive
- {
- disappearTimer += Time.deltaTime; // Increase disappear timer
- if (disappearTimer > disappearAfterTime) // If we're alive too long, get rekt
- {
- disappearTimer = 0; // Reset timer
- isActive = false; // Is not active anymore
- // meshRenderer.enabled = false; // Disable meshrender so it's invisible
- }
-
-
- // 1/distanceToTarget is the calculation to move 1 unit per second, movementspeed defines how many units per second you want to move
- movementValue += (1/distanceToTarget*movementSpeed) * Time.deltaTime;
- if (movementValue > 1)
- {
- movementValue = 1;
- Explode();
- }
- Move();
-
- }
- }
-
- void Move()
- {
- // lerp goes from 0 to 1, 0 is startPosition, 1 is the targets position;
- transform.position = Vector3.Lerp(startPosition, targetPosition, movementValue);
- }
-
- void MoveWithoutTargetHit()
- {
- transform.position += direction.normalized * movementSpeed;
- }
-
- public void Fire(Vector3 target, Vector3 spawnPosition, Vector3 Direction, float speed)
- {
- if (isActive) // If we're active, just return so we don't execute any code
- return;
-
- isActive = true; // Set active
- disappearTimer = 0; // Reset timer just in case it's not reset
- transform.position = spawnPosition; // set spawn position
- // meshRenderer.enabled = true; // Enable meshrender so it's visible
- movementSpeed = speed; // Units per second
- direction = Direction.normalized; // Normalize the direction
- targetPosition = target; // Set target transform - Can be null for continous movement without target
- distanceToTarget = Vector3.Distance(targetPosition, transform.position);
- startPosition = spawnPosition;
- movementValue = 0;
- }
-
- // It gets here after it hits something
- void Explode()
- {
- disappearTimer = 0; // Reset timer
- isActive = false; // Is not active anymore
- // meshRenderer.enabled = false; // Disable meshrender so it's invisible
- }
-
- public bool GetIsActive()
- {
- return isActive;
- }
-}
-}
\ No newline at end of file diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs.meta b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs.meta deleted file mode 100644 index e7b30e7a..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/Projectile.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 989960b1a1aad4b449f0051bdeb3d79f -timeCreated: 1485807647 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs deleted file mode 100644 index 86fc9fea..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs +++ /dev/null @@ -1,253 +0,0 @@ -using UnityEngine;
-using System.Collections;
-using UnityEngine.UI;
-
-public class projectileActor : MonoBehaviour {
-
- public Transform spawnLocator;
- public Transform spawnLocatorMuzzleFlare;
- public Transform shellLocator;
- public Animator recoilAnimator;
-
- public Transform[] shotgunLocator;
-
- [System.Serializable]
- public class projectile
- {
- public string name;
- public Rigidbody bombPrefab;
- public GameObject muzzleflare;
- public float min, max;
- public bool rapidFire;
- public float rapidFireCooldown;
-
- public bool shotgunBehavior;
- public int shotgunPellets;
- public GameObject shellPrefab;
- public bool hasShells;
- }
- public projectile[] bombList;
-
-
- string FauxName;
- public Text UiText;
-
- public bool UImaster = true;
- public bool CameraShake = true;
- public float rapidFireDelay;
- public CameraShake CameraShakeCaller;
-
- float firingTimer;
- public bool firing;
- public int bombType = 0;
-
- // public ParticleSystem muzzleflare;
-
- public bool swarmMissileLauncher = false;
- int projectileSimFire = 1;
-
- public bool Torque = false;
- public float Tor_min, Tor_max;
-
- public bool MinorRotate;
- public bool MajorRotate = false;
- int seq = 0;
-
-
- // Use this for initialization
- void Start ()
- {
- if (UImaster)
- {
- UiText.text = bombList[bombType].name.ToString();
- }
- if (swarmMissileLauncher)
- {
- projectileSimFire = 5;
- }
- }
-
- // Update is called once per frame
- void Update ()
- {
- //Movement
- if(Input.GetButton("Horizontal"))
- {
- if (Input.GetAxis("Horizontal") < 0)
- {
- gameObject.transform.Rotate(Vector3.up, -25 * Time.deltaTime);
- }
- else
- {
- gameObject.transform.Rotate(Vector3.up, 25 * Time.deltaTime);
- }
- }
-
- //BULLETS
- if (Input.GetKeyDown(KeyCode.D))
- {
- Switch(-1);
- }
- if (Input.GetButtonDown("Fire2") || Input.GetKeyDown(KeyCode.A))
- {
- Switch(1);
- }
-
- if(Input.GetButtonDown("Fire1"))
- {
- firing = true;
- Fire();
- }
- if (Input.GetButtonUp("Fire1"))
- {
- firing = false;
- firingTimer = 0;
- }
-
- if (bombList[bombType].rapidFire && firing)
- {
- if(firingTimer > bombList[bombType].rapidFireCooldown+rapidFireDelay)
- {
- Fire();
- firingTimer = 0;
- }
- }
-
- if(firing)
- {
- firingTimer += Time.deltaTime;
- }
- }
-
- public void Switch(int value)
- {
- bombType += value;
- if (bombType < 0)
- {
- bombType = bombList.Length;
- bombType--;
- }
- else if (bombType >= bombList.Length)
- {
- bombType = 0;
- }
- if (UImaster)
- {
- UiText.text = bombList[bombType].name.ToString();
- }
- }
-
- public void Fire()
- {
- if(CameraShake)
- {
- CameraShakeCaller.ShakeCamera();
- }
- Instantiate(bombList[bombType].muzzleflare, spawnLocatorMuzzleFlare.position, spawnLocatorMuzzleFlare.rotation);
- // bombList[bombType].muzzleflare.Play();
-
- if (bombList[bombType].hasShells)
- {
- Instantiate(bombList[bombType].shellPrefab, shellLocator.position, shellLocator.rotation);
- }
- recoilAnimator.SetTrigger("recoil_trigger");
-
- Rigidbody rocketInstance;
- rocketInstance = Instantiate(bombList[bombType].bombPrefab, spawnLocator.position,spawnLocator.rotation) as Rigidbody;
- // Quaternion.Euler(0,90,0)
- rocketInstance.AddForce(spawnLocator.forward * Random.Range(bombList[bombType].min, bombList[bombType].max));
-
- if (bombList[bombType].shotgunBehavior)
- {
- for(int i = 0; i < bombList[bombType].shotgunPellets ;i++ )
- {
- Rigidbody rocketInstanceShotgun;
- rocketInstanceShotgun = Instantiate(bombList[bombType].bombPrefab, shotgunLocator[i].position, shotgunLocator[i].rotation) as Rigidbody;
- // Quaternion.Euler(0,90,0)
- rocketInstanceShotgun.AddForce(shotgunLocator[i].forward * Random.Range(bombList[bombType].min, bombList[bombType].max));
- }
- }
-
- if (Torque)
- {
- rocketInstance.AddTorque(spawnLocator.up * Random.Range(Tor_min, Tor_max));
- }
- if (MinorRotate)
- {
- RandomizeRotation();
- }
- if (MajorRotate)
- {
- Major_RandomizeRotation();
- }
- }
-
-
- void RandomizeRotation()
- {
- if (seq == 0)
- {
- seq++;
- transform.Rotate(0, 1, 0);
- }
- else if (seq == 1)
- {
- seq++;
- transform.Rotate(1, 1, 0);
- }
- else if (seq == 2)
- {
- seq++;
- transform.Rotate(1, -3, 0);
- }
- else if (seq == 3)
- {
- seq++;
- transform.Rotate(-2, 1, 0);
- }
- else if (seq == 4)
- {
- seq++;
- transform.Rotate(1, 1, 1);
- }
- else if (seq == 5)
- {
- seq = 0;
- transform.Rotate(-1, -1, -1);
- }
- }
-
- void Major_RandomizeRotation()
- {
- if (seq == 0)
- {
- seq++;
- transform.Rotate(0, 25, 0);
- }
- else if (seq == 1)
- {
- seq++;
- transform.Rotate(0, -50, 0);
- }
- else if (seq == 2)
- {
- seq++;
- transform.Rotate(0, 25, 0);
- }
- else if (seq == 3)
- {
- seq++;
- transform.Rotate(25, 0, 0);
- }
- else if (seq == 4)
- {
- seq++;
- transform.Rotate(-50, 0, 0);
- }
- else if (seq == 5)
- {
- seq = 0;
- transform.Rotate(25, 0, 0);
- }
- }
-}
diff --git a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs.meta b/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs.meta deleted file mode 100644 index 682e1742..00000000 --- a/Assets/Art/Vfx/StylizedProjectilePack1/WebDemo/scripts/projectileActor.cs.meta +++ /dev/null @@ -1,12 +0,0 @@ -fileFormatVersion: 2 -guid: 24ae8ab904635734bab03b361009b30d -timeCreated: 1483283782 -licenseType: Store -MonoImporter: - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: |