阶段性完成

This commit is contained in:
SoulliesOfficial
2025-12-08 05:27:53 -05:00
parent ef7b479712
commit f7af60351b
8770 changed files with 15637030 additions and 208354 deletions

View File

@@ -0,0 +1,128 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace SciFiArsenal
{
public class SciFiArsenalBeamStatic : MonoBehaviour
{
[Header("Prefabs")]
public GameObject beamLineRendererPrefab; //Put a prefab with a line renderer onto here.
public GameObject beamStartPrefab; //This is a prefab that is put at the start of the beam.
public GameObject beamEndPrefab; //Prefab put at end of beam.
private GameObject beamStart;
private GameObject beamEnd;
private GameObject beam;
private LineRenderer line;
[Header("Beam Options")]
public bool beamCollides = true; //Beam stops at colliders
public float beamLength = 100; //Ingame beam length
public float beamEndOffset = 0f; //How far from the raycast hit point the end effect is positioned
public float textureScrollSpeed = 0f; //How fast the texture scrolls along the beam, can be negative or positive.
public float textureLengthScale = 1f; //Set this to the horizontal length of your texture relative to the vertical. Example: if texture is 200 pixels in height and 600 in length, set this to 3
[Header("Width Pulse Options")]
public float widthMultiplier = 1.5f;
private float customWidth;
private float originalWidth;
private float lerpValue = 0.0f;
public float pulseSpeed = 1.0f;
private bool pulseExpanding = true;
void Start()
{
SpawnBeam();
originalWidth = line.startWidth;
customWidth = originalWidth * widthMultiplier;
}
void FixedUpdate()
{
if (beam)
{
line.SetPosition(0, transform.position);
Vector3 end = transform.position + (transform.forward * beamLength);
RaycastHit hit;
if (beamCollides && Physics.Raycast(transform.position, transform.forward, out hit))
{
end = hit.point - (transform.forward * beamEndOffset);
end = Vector3.Distance(transform.position, end) > beamLength
? transform.position + (transform.forward * beamLength)
: end;
}
else
{
end = transform.position + (transform.forward * beamLength);
}
line.SetPosition(1, end);
beamStart.transform.position = transform.position;
beamStart.transform.LookAt(end);
beamEnd.transform.position = end;
beamEnd.transform.LookAt(beamStart.transform.position);
float distance = Vector3.Distance(transform.position, end);
line.material.mainTextureScale = new Vector2(distance / textureLengthScale, 1); //This sets the scale of the texture so it doesn't look stretched
line.material.mainTextureOffset -= new Vector2(Time.deltaTime * textureScrollSpeed, 0); //This scrolls the texture along the beam if not set to 0
}
// Pulse the width of the beam
if (pulseExpanding)
{
lerpValue += Time.deltaTime * pulseSpeed;
}
else
{
lerpValue -= Time.deltaTime * pulseSpeed;
}
if (lerpValue >= 1.0f)
{
pulseExpanding = false;
lerpValue = 1.0f;
}
else if (lerpValue <= 0.0f)
{
pulseExpanding = true;
lerpValue = 0.0f;
}
float currentWidth = Mathf.Lerp(originalWidth, customWidth, Mathf.Sin(lerpValue * Mathf.PI));
line.startWidth = currentWidth;
line.endWidth = currentWidth;
}
public void SpawnBeam()
{
if (beamLineRendererPrefab)
{
beam = Instantiate(beamLineRendererPrefab);
beam.transform.position = transform.position;
beam.transform.parent = transform;
beam.transform.rotation = transform.rotation;
line = beam.GetComponent<LineRenderer>();
line.useWorldSpace = true;
#if UNITY_5_5_OR_NEWER
line.positionCount = 2;
#else
line.SetVertexCount(2);
#endif
beamStart = beamStartPrefab ? Instantiate(beamStartPrefab, beam.transform) : null;
beamEnd = beamEndPrefab ? Instantiate(beamEndPrefab, beam.transform) : null;
}
else
{
Debug.LogError("A prefab with a line renderer must be assigned to the `beamLineRendererPrefab` field in the SciFiArsenalBeamStatic script on " + gameObject.name);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 58f77d5ff8f9f9f4e80d11470fc13043
timeCreated: 1536332909
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 60519
packageName: Sci-Fi Arsenal
packageVersion: 1.72
assetPath: Assets/Archanor/Sci-Fi Arsenal/Sci-Fi Effects/Scripts/SciFiBeamStatic.cs
uploadId: 757617

View File

@@ -0,0 +1,38 @@
using UnityEngine;
using System.Collections;
namespace SciFiArsenal
{
public class SciFiLightFade : MonoBehaviour
{
[Header("Seconds to dim the light")]
public float life = 0.2f;
public bool killAfterLife = true;
private Light li;
private float initIntensity;
// Use this for initialization
void Start()
{
if (gameObject.GetComponent<Light>())
{
li = gameObject.GetComponent<Light>();
initIntensity = li.intensity;
}
else
print("No light object found on " + gameObject.name);
}
// Update is called once per frame
void Update()
{
if (gameObject.GetComponent<Light>())
{
li.intensity -= initIntensity * (Time.deltaTime / life);
if (killAfterLife && li.intensity <= 0)
Destroy(gameObject);
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 517ff65624287114c82e19b6074a6b17
timeCreated: 1493668034
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 60519
packageName: Sci-Fi Arsenal
packageVersion: 1.72
assetPath: Assets/Archanor/Sci-Fi Arsenal/Sci-Fi Effects/Scripts/SciFiLightFade.cs
uploadId: 757617

View File

@@ -0,0 +1,75 @@
using UnityEngine;
using System.Collections;
namespace SciFiArsenal
{
public class SciFiLightFlicker : MonoBehaviour
{
// Properties
public string waveFunction = "sin"; // possible values: sin, tri(angle), sqr(square), saw(tooth), inv(verted sawtooth), noise (random)
public float startValue = 0.0f; // start
public float amplitude = 1.0f; // amplitude of the wave
public float phase = 0.0f; // start point inside on wave cycle
public float frequency = 0.5f; // cycle frequency per second
// Keep a copy of the original color
private Color originalColor;
// Store the original color
void Start ()
{
originalColor = GetComponent<Light>().color;
}
void Update ()
{
Light light = GetComponent<Light>();
Color newColor = originalColor * EvalWave();
// Clamp the color values to ensure they are within the valid range
newColor.r = Mathf.Clamp(newColor.r, 0f, 1f);
newColor.g = Mathf.Clamp(newColor.g, 0f, 1f);
newColor.b = Mathf.Clamp(newColor.b, 0f, 1f);
light.color = newColor;
}
float EvalWave ()
{
float x = (Time.time + phase)*frequency;
float y;
x = x - Mathf.Floor(x); // normalized value (0..1)
if (waveFunction=="sin") {
y = Mathf.Sin(x*2*Mathf.PI);
}
else if (waveFunction=="tri") {
if (x < 0.5f)
y = 4.0f * x - 1.0f;
else
y = -4.0f * x + 3.0f;
}
else if (waveFunction=="sqr") {
if (x < 0.5f)
y = 1.0f;
else
y = -1.0f;
}
else if (waveFunction=="saw") {
y = x;
}
else if (waveFunction=="inv") {
y = 1.0f - x;
}
else if (waveFunction=="noise") {
y = 1 - (Random.value*2);
}
else {
y = 1.0f;
}
return (y*amplitude)+startValue;
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 1190e786ef1d70d4fa192530ba6a63f5
timeCreated: 1513042353
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 60519
packageName: Sci-Fi Arsenal
packageVersion: 1.72
assetPath: Assets/Archanor/Sci-Fi Arsenal/Sci-Fi Effects/Scripts/SciFiLightFlicker.cs
uploadId: 757617

View File

@@ -0,0 +1,17 @@
using UnityEngine;
using System.Collections;
namespace SciFiArsenal
{
public class SciFiPitchRandomizer : MonoBehaviour
{
public float randomPercent = 10;
void Start ()
{
transform.GetComponent<AudioSource>().pitch *= 1 + Random.Range(-randomPercent / 100, randomPercent / 100);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 63370acbe4b11f24280fe48a7c5e7dcf
timeCreated: 1553732621
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 60519
packageName: Sci-Fi Arsenal
packageVersion: 1.72
assetPath: Assets/Archanor/Sci-Fi Arsenal/Sci-Fi Effects/Scripts/SciFiPitchRandomizer.cs
uploadId: 757617

View File

@@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
namespace SciFiArsenal
{
public class SciFiRotation : MonoBehaviour
{
[Header("Rotate axises by degrees per second")]
public Vector3 rotateVector = Vector3.zero;
public enum spaceEnum { Local, World };
public spaceEnum rotateSpace;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
if (rotateSpace == spaceEnum.Local)
transform.Rotate(rotateVector * Time.deltaTime);
if (rotateSpace == spaceEnum.World)
transform.Rotate(rotateVector * Time.deltaTime, Space.World);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: c3799655c1642b64eb01aff158ee938b
timeCreated: 1493668063
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 60519
packageName: Sci-Fi Arsenal
packageVersion: 1.72
assetPath: Assets/Archanor/Sci-Fi Arsenal/Sci-Fi Effects/Scripts/SciFiRotation.cs
uploadId: 757617