fix: added F3DForge Assets

This commit is contained in:
Jakob Feldmann 2024-05-08 18:37:59 +02:00
parent 4ea75d7758
commit d2c59a32eb
1809 changed files with 2256132 additions and 1 deletions

2
.gitignore vendored
View File

@ -78,4 +78,4 @@ crashlytics-build.properties
*.log
# Local only Asset Store Libraries & Assets
/[Aa]ssets/FORGE3D/*
#/[Aa]ssets/FORGE3D/*

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 60960fa6b56ee5442b5832403639e684
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 58dedb5e720f1df44b61117c89bfa91c
folderAsset: yes
timeCreated: 1477047111
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,96 @@
using UnityEngine;
using UnityEditor;
namespace FORGE3D
{
public class F3DHelpMenu
{
#region Variables
const int Priority = 1100;
const string MenuPath = "Window/FORGE3D/";
const string AssetStoreUrl = "https://assetstore.unity.com/publishers/2659";
const string WebUrl = "https://www.forge3d.com";
const string TwitterUrl = "https://twitter.com/Forge_3D";
const string FacebookUrl = "http://facebook.com/forge3d";
const string SupportUrl = "https://www.forge3d.com/contact/";
const string DiscordUrl = "https://discord.gg/c9JQuDC";
const string DocumentationUrl = "https://docs.forge3d.com/";
const string BlogUrl = "https://www.forge3d.com/blog/";
// const string ForumUrl = "http://forum.forge3d.com/";
// const string BugReportUrl = "http://forum.forge3d.com/c/bug-report";
// const string KnownIssuesUrl = "http://forum.forge3d.com/c/known-issues";
#endregion
#region Menu Items
[MenuItem(MenuPath + "Asset Store", false, Priority + 20)]
static void AssetStore()
{
Application.OpenURL(AssetStoreUrl);
}
[MenuItem(MenuPath + "Website", false, Priority * 2 + 21)]
static void Web()
{
Application.OpenURL(WebUrl);
}
[MenuItem(MenuPath + "Help/Documentation", false, Priority * 4 + 26)]
static void Documentation()
{
Application.OpenURL(DocumentationUrl);
}
[MenuItem(MenuPath + "Help/Support Form", false, Priority * 2 + 23)]
static void SupportForm()
{
Application.OpenURL(SupportUrl);
}
[MenuItem(MenuPath + "Community/Discord", false, Priority * 3 + 24)]
static void Discord()
{
Application.OpenURL(DiscordUrl);
}
[MenuItem(MenuPath + "Community/Twitter", false, Priority * 3 + 24)]
static void Twitter()
{
Application.OpenURL(TwitterUrl);
}
[MenuItem(MenuPath + "Community/Facebook", false, Priority * 3 + 25)]
static void Facebook()
{
Application.OpenURL(FacebookUrl);
}
// [MenuItem(MenuPath + "Help/Known Issues", false, Priority * 5 + 27)]
// static void KnownIssues()
// {
// Application.OpenURL(KnownIssuesUrl);
// }
//
// [MenuItem(MenuPath +"Help/Report a Bug", false, Priority * 5 + 28)]
// static void BugReport()
// {
// Application.OpenURL(BugReportUrl);
// }
//
// [MenuItem(MenuPath + "Help/Contact Support", false, Priority * 6 + 29)]
// static void Support()
// {
// Application.OpenURL(SupportUrl);
// }
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 862ee2bf8fce03847ae46a1453d11f61
timeCreated: 1474371934
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,15 @@
using System;
using UnityEngine;
public class F3DReadme : ScriptableObject {
public Texture2D icon;
public float iconMaxWidth = 128f;
public string title;
public Section[] sections;
public bool loadedLayout;
[Serializable]
public class Section {
public string heading, text, linkText, url;
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 0c2648be8736c4245b8bbaf7b8b42bc3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 037734b17170b1d4ea68aff6005eb279, type: 3}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,159 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Reflection;
[CustomEditor(typeof(F3DReadme))]
[InitializeOnLoad]
public class F3DReadmeEditor : Editor {
// static string kShowedReadmeSessionStateName = "F3DReadmeEditor.showedReadme";
static float kSpace = 16f;
// static F3DReadmeEditor()
// {
// EditorApplication.delayCall += SelectReadmeAutomatically;
// }
//
// static void SelectReadmeAutomatically()
// {
// if (!SessionState.GetBool(kShowedReadmeSessionStateName, false ))
// {
// var readme = SelectReadme();
// SessionState.SetBool(kShowedReadmeSessionStateName, true);
//
// if (readme && !readme.loadedLayout)
// {
// LoadLayout();
// readme.loadedLayout = true;
// }
// }
// }
static void LoadLayout()
{
var assembly = typeof(EditorApplication).Assembly;
var windowLayoutType = assembly.GetType("UnityEditor.WindowLayout", true);
var method = windowLayoutType.GetMethod("LoadWindowLayout", BindingFlags.Public | BindingFlags.Static);
method.Invoke(null, new object[]{Path.Combine(Application.dataPath, "»Readme/Layout.wlt"), false});
}
[MenuItem("Help/Project Readme")]
static F3DReadme SelectReadme()
{
var ids = AssetDatabase.FindAssets("Readme t:Readme");
if (ids.Length == 1)
{
var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0]));
Selection.objects = new UnityEngine.Object[]{readmeObject};
return (F3DReadme)readmeObject;
}
else
{
Debug.Log("Couldn't find a readme");
return null;
}
}
protected override void OnHeaderGUI()
{
var readme = (F3DReadme)target;
Init();
var iconWidth = Mathf.Min(EditorGUIUtility.currentViewWidth/3f - 20f, readme.iconMaxWidth);
GUILayout.BeginHorizontal("In BigTitle");
{
GUILayout.Label(readme.icon, GUILayout.Width(iconWidth), GUILayout.Height(iconWidth));
GUILayout.Label(readme.title, TitleStyle);
}
GUILayout.EndHorizontal();
}
public override void OnInspectorGUI()
{
var readme = (F3DReadme)target;
Init();
foreach (var section in readme.sections)
{
if (!string.IsNullOrEmpty(section.heading))
{
GUILayout.Label(section.heading, HeadingStyle);
}
if (!string.IsNullOrEmpty(section.text))
{
GUILayout.Label(section.text, BodyStyle);
}
if (!string.IsNullOrEmpty(section.linkText))
{
GUILayout.Space(kSpace / 2);
if (LinkLabel(new GUIContent(section.linkText)))
{
Application.OpenURL(section.url);
}
}
GUILayout.Space(kSpace);
}
}
bool m_Initialized;
GUIStyle LinkStyle { get { return m_LinkStyle; } }
[SerializeField] GUIStyle m_LinkStyle;
GUIStyle TitleStyle { get { return m_TitleStyle; } }
[SerializeField] GUIStyle m_TitleStyle;
GUIStyle HeadingStyle { get { return m_HeadingStyle; } }
[SerializeField] GUIStyle m_HeadingStyle;
GUIStyle BodyStyle { get { return m_BodyStyle; } }
[SerializeField] GUIStyle m_BodyStyle;
void Init()
{
if (m_Initialized)
return;
m_BodyStyle = new GUIStyle(EditorStyles.label);
m_BodyStyle.wordWrap = true;
m_BodyStyle.fontSize = 14;
m_TitleStyle = new GUIStyle(m_BodyStyle);
m_TitleStyle.fontSize = 26;
m_HeadingStyle = new GUIStyle(m_BodyStyle);
m_HeadingStyle.fontSize = 18;
m_HeadingStyle.fontStyle = FontStyle.Bold;
m_LinkStyle = new GUIStyle(m_BodyStyle);
// Match selection color which works nicely for both light and dark skins
m_LinkStyle.normal.textColor = new Color (0x00/255f, 0x78/255f, 0xDA/255f, 1f);
m_LinkStyle.stretchWidth = false;
m_Initialized = true;
}
bool LinkLabel (GUIContent label, params GUILayoutOption[] options)
{
var position = GUILayoutUtility.GetRect(label, LinkStyle, options);
Handles.BeginGUI ();
Handles.color = LinkStyle.normal.textColor;
Handles.DrawLine (new Vector3(position.xMin, position.yMax), new Vector3(position.xMax, position.yMax));
Handles.color = Color.white;
Handles.EndGUI ();
EditorGUIUtility.AddCursorRect (position, MouseCursor.Link);
return GUI.Button (position, label, LinkStyle);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: e37c81d33e7c1344b874b8feb2ee4c5c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,132 @@
fileFormatVersion: 2
guid: 037734b17170b1d4ea68aff6005eb279
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 1
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 2
mipBias: -100
wrapU: 0
wrapV: 0
wrapW: 0
nPOTScale: 1
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 0
spriteTessellationDetail: -1
textureType: 0
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: iPhone
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Android
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Windows Store Apps
maxTextureSize: 8192
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 8183c5b85af4c754e961d949bae57a41
folderAsset: yes
timeCreated: 1470145491
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: d5b67437edf672244823f36f0c99ff8d
folderAsset: yes
timeCreated: 1477047100
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1a56394eb2f8a2741bd22913de51d9be
timeCreated: 1470145491
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,555 @@
using UnityEngine;
using System.Collections.Generic;
namespace FORGE3D
{
public class F3DPool : MonoBehaviour
{
[HideInInspector]
public string poolName = "GeneratedPool"; // name of pool
[HideInInspector]
public Transform[] templates = new Transform[0]; // templates
[HideInInspector]
public Transform[] templatesParent = new Transform[0]; // parents of each type of template
[HideInInspector]
public int[] poolLength = new int[0]; // base items count
[HideInInspector]
public int[] poolLengthCurrent = new int[0]; // Effect pool items current count
[HideInInspector]
public int[] poolLengthMax = new int[0]; // max items count
[HideInInspector]
public string broadcastSpawnName = "OnSpawned"; // name of onSpawned function
[HideInInspector]
public string broadcastDespawnName = "OnDespawned"; // name of ondespawned function
[HideInInspector]
public bool delayedSpawnInInstall = true; // If we need to install all not in 1 update
[HideInInspector]
public int objectsPerUpdate = -1; // Current count of installing objects per frame
[HideInInspector]
public bool needBroadcasting = true; // if we need broadcasting |=> True
[HideInInspector]
public bool optimizeSpawn = true; // This is option for automated objectsPerUpdate calculation
[HideInInspector]
public int targetFPS = 50; // Target FPS for optimizeSpawn
[HideInInspector]
public bool pooling = true; // If need pooling?
[HideInInspector]
public bool needDebugging = false; // If need debugging
[HideInInspector]
public bool needSort = true; // if Need sort? It means, that after Despawn() it will be parented to it's template's parent
[HideInInspector]
public bool needParenting = true; // if need start parenting to parents
private float normalValue = 0f; // Calculation of optimizeSpawn(not for editing)
private Dictionary<Transform, List<Transform>> readyObjects = new Dictionary<Transform, List<Transform>>(); // Dict of ready for spawn items
private Dictionary<Transform, List<Transform>> occupiedObjects = new Dictionary<Transform, List<Transform>>(); // Dict of ready for despawn items
private bool installing = true; // if pool still installling = it will be true
//return count of temlates
public int GetTemplatesCount()
{
if (templates != null)
{
return templates.Length;
}
return -1;
}
//returns is template in this pool
bool CheckForExistingTemplate(Transform obj)
{
int i;
for (i = 0; i < templates.Length; i++)
{
if (obj == templates[i])
{
return true;
}
}
return false;
}
// Despawn - called for despawning some object, that was spawned
public bool Despawn(Transform obj)
{
bool res = false;
int i = 0, n = 0, j = 0;
for (j = 0; j < occupiedObjects.Count; j++)
{
List<Transform> transforms = occupiedObjects[templates[j]];
int transformsCount = transforms.Count;
for (i = 0; i < transformsCount; i++)
{
if (transforms[i] == obj)
{
res = true;
transforms.RemoveAt(i);
readyObjects[templates[j]].Add(obj);
obj.gameObject.SetActive(false);
if (needSort)
{
if (needParenting)
{
obj.parent = templatesParent[n];
}
}
if (needBroadcasting && broadcastDespawnName != "")
obj.BroadcastMessage(broadcastDespawnName, SendMessageOptions.DontRequireReceiver);
break;
}
}
n++;
}
return res;
}
// If you have parent(template) of spawned object - use this variant for better perfomance!
public bool Despawn(Transform obj, Transform template)
{
bool res = false;
int i, j;
for (i = 0; i < templates.Length; i++)
{
if (templates[i] == template)
{
int listSize = occupiedObjects[template].Count;
for (j = 0; j < listSize; j++)
{
if (occupiedObjects[template][j] == obj)
{
res = true;
occupiedObjects[template].RemoveAt(j);
obj.gameObject.SetActive(false);
if (needSort)
obj.parent = templatesParent[i];
readyObjects[template].Add(obj);
break;
}
}
if (res)
{
break;
}
}
}
return res;
}
//Return template position in array
public int GetTemplatePosition(Transform obj)
{
int pos = -1;
int i;
for (i = 0; i < templates.Length; i++)
{
if (obj == templates[i])
{
pos = i;
}
}
return pos;
}
/// <summary>
/// This function spawns audiosource somewhere with it's clip
/// </summary>
/// <param name="obj">Source template</param>
/// <param name="clip">Clip that have to be played</param>
/// <param name="pos">Place to spawn audio</param>
/// <param name="par">Parent of spawned audiosource</param>
/// <returns>Link to spawned audio source</returns>
public Transform SpawnAudio(Transform obj, AudioClip clip, Vector3 pos, Transform par)
{
Transform tempTransform;
int i;
int curPos = GetTemplatePosition(obj);
for (i = 0; i < readyObjects[templates[curPos]].Count; i++)
{
if (!readyObjects[templates[curPos]][i].gameObject.activeSelf)
{
tempTransform = readyObjects[templates[curPos]][i];
readyObjects[templates[curPos]].RemoveAt(i);
occupiedObjects[templates[curPos]].Add(tempTransform);
tempTransform.position = pos;
if (par == null)
{
tempTransform.SetParent(null);
}
else
{
tempTransform.SetParent(par);
}
tempTransform.gameObject.SetActive(true);
if (needBroadcasting && broadcastSpawnName != "")
tempTransform.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
AudioSource source = tempTransform.gameObject.GetComponent<AudioSource>();
if (source != null)
{
source.clip = clip;
}
return tempTransform;
}
}
if (poolLengthCurrent[curPos] < poolLengthMax[curPos])
{
poolLengthCurrent[curPos]++;
Transform newGO = Instantiate(templates[curPos], Vector3.zero, Quaternion.identity) as Transform;
newGO.transform.parent = this.gameObject.transform;
newGO.gameObject.SetActive(true);
newGO.position = pos;
if (par == null)
{
newGO.SetParent(null);
}
else
{
newGO.SetParent(par);
}
occupiedObjects[templates[curPos]].Add(newGO);
if (needBroadcasting && broadcastSpawnName != "")
newGO.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
AudioSource source = newGO.gameObject.GetComponent<AudioSource>();
if (source != null)
{
source.clip = clip;
}
return newGO;
}
return null;
}
//Return transfrom of spawned object
public Transform Spawn(Transform obj, Transform par, Vector3 pos = new Vector3(), Quaternion rot = new Quaternion())
{
if (!CheckForExistingTemplate(obj))
{
if (needDebugging)
Debug.LogWarning(obj.name + " isn't in " + this.gameObject.name + "'s pool");
return null;
}
Transform tempTransform;
int i;
int curPos = GetTemplatePosition(obj);
for (i = 0; i < readyObjects[obj].Count; i++)
{
if (!readyObjects[obj][i].gameObject.activeSelf)
{
tempTransform = readyObjects[obj][i];
readyObjects[obj].RemoveAt(i);
occupiedObjects[obj].Add(tempTransform);
tempTransform.position = pos;
tempTransform.rotation = rot;
if (par == null)
{
tempTransform.SetParent(null);
}
else
{
tempTransform.SetParent(par);
}
tempTransform.gameObject.SetActive(true);
if (needBroadcasting && broadcastSpawnName != "")
tempTransform.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return tempTransform;
}
}
if (poolLengthCurrent[curPos] < poolLengthMax[curPos])
{
poolLengthCurrent[curPos]++;
Transform newGO = Instantiate(templates[curPos], Vector3.zero, Quaternion.identity) as Transform;
newGO.transform.parent = this.gameObject.transform;
newGO.gameObject.SetActive(true);
newGO.position = pos;
newGO.rotation = rot;
if (par == null)
{
newGO.SetParent(null);
}
else
{
newGO.SetParent(par);
}
occupiedObjects[obj].Add(newGO);
if (needBroadcasting && broadcastSpawnName != "")
newGO.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return newGO;
}
return null;
}
//Return transfrom of spawned object
public Transform Spawn(Transform obj, Vector3 pos , Quaternion rot , Transform par)
{
if (!CheckForExistingTemplate(obj))
{
if (needDebugging)
Debug.LogWarning(obj.name + " isn't in " + this.gameObject.name + "'s pool");
return null;
}
Transform tempTransform;
int i;
int curPos = GetTemplatePosition(obj);
for (i = 0; i < readyObjects[obj].Count; i++)
{
if (!readyObjects[obj][i].gameObject.activeSelf)
{
tempTransform = readyObjects[obj][i];
readyObjects[obj].RemoveAt(i);
occupiedObjects[obj].Add(tempTransform);
tempTransform.position = pos;
tempTransform.rotation = rot;
if (par == null)
{
tempTransform.SetParent(null);
}
else
{
tempTransform.SetParent(par);
}
tempTransform.gameObject.SetActive(true);
if (needBroadcasting && broadcastSpawnName != "")
tempTransform.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return tempTransform;
}
}
if (poolLengthCurrent[curPos] < poolLengthMax[curPos])
{
poolLengthCurrent[curPos]++;
Transform newGO = Instantiate(templates[curPos], Vector3.zero, Quaternion.identity) as Transform;
newGO.transform.parent = this.gameObject.transform;
newGO.gameObject.SetActive(true);
newGO.position = pos;
newGO.rotation = rot;
if (par == null)
{
newGO.SetParent(null);
}
else
{
newGO.SetParent(par);
}
occupiedObjects[obj].Add(newGO);
if (needBroadcasting && broadcastSpawnName != "")
newGO.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return newGO;
}
return null;
}
//Return transfrom of spawned object
public Transform Spawn(Transform obj, Vector3 pos = new Vector3(), Quaternion rot = new Quaternion())
{
if (!CheckForExistingTemplate(obj))
{
if (needDebugging)
Debug.LogWarning(obj.name + " isn't in " + this.gameObject.name + "'s pool");
return null;
}
Transform tempTransform;
int i;
int curPos = GetTemplatePosition(obj);
for (i = 0; i < readyObjects[obj].Count; i++)
{
if (!readyObjects[obj][i].gameObject.activeSelf)
{
tempTransform = readyObjects[obj][i];
readyObjects[obj].RemoveAt(i);
occupiedObjects[obj].Add(tempTransform);
tempTransform.position = pos;
tempTransform.rotation = rot;
tempTransform.SetParent(null);
tempTransform.gameObject.SetActive(true);
if (needBroadcasting && broadcastSpawnName != "")
tempTransform.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return tempTransform;
}
}
if (poolLengthCurrent[curPos] < poolLengthMax[curPos])
{
poolLengthCurrent[curPos]++;
Transform newGO = Instantiate(templates[curPos], Vector3.zero, Quaternion.identity) as Transform;
newGO.transform.parent = this.gameObject.transform;
newGO.gameObject.SetActive(true);
newGO.position = pos;
newGO.rotation = rot;
newGO.SetParent(null);
occupiedObjects[obj].Add(newGO);
if (needBroadcasting && broadcastSpawnName != "")
newGO.BroadcastMessage(broadcastSpawnName, SendMessageOptions.DontRequireReceiver);
return newGO;
}
return null;
}
//Updating templates array
public void SetTemplates(Transform[] newArray)
{
templates = newArray;
}
//updating poolLength array
public void SetLength(int[] newPoolLenght)
{
poolLength = newPoolLenght;
}
//updating poolLengthMax
public void SetLengthMax(int[] newPoolLengthMax)
{
poolLengthMax = newPoolLengthMax;
}
//Automatic spawning function
void CalculateObjectsPerUpdate()
{
if (objectsPerUpdate != 0)
{
if (objectsPerUpdate == -1)
{
objectsPerUpdate = 1;
}
else
{
objectsPerUpdate = (int)(objectsPerUpdate * (normalValue / Time.deltaTime));
if (objectsPerUpdate == 0)
{
objectsPerUpdate = 1;
}
}
}
}
//Delayed spawn function. Instantiates objects not in one frame.
void DelayedSpawnInInstall()
{
if (optimizeSpawn)
{
CalculateObjectsPerUpdate();
}
int leftObjectsToInstall = objectsPerUpdate;
int i, j;
for (i = 0; i < templates.Length; i++)
{
for (j = 0; j < poolLength[i]; j++)
{
if (poolLengthCurrent[i] < poolLength[i])
{
InstantiateItem(templates[i], templatesParent[i], i);
leftObjectsToInstall--;
if (leftObjectsToInstall == 0)
{
break;
}
}
}
if (leftObjectsToInstall == 0)
{
break;
}
}
if (leftObjectsToInstall != 0)
{
installing = false;
}
}
//Instantiates all objects
void NonDelayedSpawnInInstall()
{
for (int i = 0; i < templates.Length; i++)
{
for (int j = 0; j < poolLength[i]; j++)
{
if (poolLengthCurrent[i] < poolLength[i])
{
InstantiateItem(templates[i], templatesParent[i], i);
}
}
}
}
void Update()
{
if (installing)
{
if (pooling == false)
{
installing = false;
}
else
{
//Delayed spawn in install
if (delayedSpawnInInstall)
{
DelayedSpawnInInstall();
}
else
{
NonDelayedSpawnInInstall();
installing = false;
}
}
}
}
// Instantiating item
Transform InstantiateItem(Transform temp, Transform par, int templatePosition)
{
Transform newGO = Instantiate(temp, Vector3.zero, Quaternion.identity) as Transform;
newGO.transform.SetParent(par);
newGO.gameObject.SetActive(false);
readyObjects[temp].Add(newGO);
poolLengthCurrent[templatePosition]++;
return newGO;
}
//Installing basic arrays for working with this pool
public void Install()
{
poolLengthCurrent = new int[poolLength.Length];
templatesParent = new Transform[templates.Length];
int i;
for (i = 0; i < templates.Length; i++)
{
if (templates[i] != null)
{
if (needParenting)
{
GameObject newParent = new GameObject(templates[i].name);
templatesParent[i] = newParent.transform;
newParent.transform.SetParent(this.transform);
List<Transform> tempList = new List<Transform>();
if (tempList != null)
{
readyObjects.Add(templates[i], tempList);
}
occupiedObjects.Add(templates[i], new List<Transform>());
}
else
{
List<Transform> tempList = new List<Transform>();
if (tempList != null)
{
readyObjects.Add(templates[i], tempList);
}
occupiedObjects.Add(templates[i], new List<Transform>());
}
}
}
if (targetFPS == 0)
{
targetFPS = 60;
}
normalValue = 1f / targetFPS;
installing = true;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: fdd65a70efb05f843b2d1135c43f859b
timeCreated: 1470145491
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,25 @@
using UnityEngine;
using System;
namespace FORGE3D
{
[Serializable]
public class F3DPoolContainer
{
public string poolName = "GeneratedPool";
public Transform[] templates = new Transform[0];
public int[] poolLength = new int[0];
public int[] poolLengthMax = new int[0];
public string broadcastSpawnName = "";
public string broadcastDespawnName = "";
public bool delayedSpawnInInstall = true;
public int objectsPerUpdate = 5;
public bool needBroadcasting = true;
public bool optimizeSpawn = true;
public int targetFPS = 50;
public bool pooling = true;
public bool needSort = true;
public bool needParenting = true;
public bool needDebug = false;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 41e84c3a33b30a149831f787c1c88954
timeCreated: 1470145491
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections.Generic;
using System;
namespace FORGE3D
{
[Serializable]
public class F3DPoolManager : MonoBehaviour
{
public static F3DPoolManager instance; // instance of current manager
public static Dictionary<string, F3DPool> Pools = new Dictionary<string, F3DPool>();
public string databaseName = ""; // Name of database. Need for editor
public int selectedItem = 0; // Editor's parameter
public bool[] haveToShowArr; // Editor's parameter
List<F3DPool> curPools = new List<F3DPool>(); // Our pools
void Awake()
{
InstallManager();
instance = this;
}
//Retirning pool by it's name
public F3DPool GetPool(string valueName)
{
int i;
if (valueName != "" && curPools != null && curPools.Count > 0)
{
for (i = 0; i < curPools.Count; i++)
{
if (curPools[i].poolName == valueName)
{
return curPools[i];
}
}
}
return null;
}
//Installing of manager
void InstallManager()
{
curPools.Clear();
List<F3DPoolContainer> pools = new List<F3DPoolContainer>();
Pools.Clear();
Pools = new Dictionary<string, F3DPool>();
F3DPoolManagerDB myManager = Resources.Load("F3DPoolManagerCache/" + databaseName) as F3DPoolManagerDB;
if (myManager != null)
{
if (myManager.pools != null)
{
foreach (F3DPoolContainer cont in myManager.pools)
{
pools.Add(cont);
}
}
}
//Transfering info from containers to our real pools and creating GO's for them
int j;
for (j = 0; j < pools.Count; j++)
{
GameObject newGO = new GameObject();
newGO.transform.parent = this.gameObject.transform;
newGO.name = pools[j].poolName;
F3DPool newPool = newGO.AddComponent<F3DPool>();
newPool.poolName = newGO.name;
newPool.SetTemplates(pools[j].templates);
newPool.SetLength(pools[j].poolLength);
newPool.SetLengthMax(pools[j].poolLengthMax);
newPool.needBroadcasting = pools[j].needBroadcasting;
newPool.broadcastSpawnName = pools[j].broadcastSpawnName;
newPool.broadcastDespawnName = pools[j].broadcastDespawnName;
newPool.needSort = pools[j].needSort;
newPool.delayedSpawnInInstall = pools[j].delayedSpawnInInstall;
newPool.objectsPerUpdate = pools[j].objectsPerUpdate;
newPool.optimizeSpawn = pools[j].optimizeSpawn;
newPool.targetFPS = pools[j].targetFPS;
newPool.needSort = pools[j].needSort;
newPool.needParenting = pools[j].needParenting;
newPool.needDebugging = pools[j].needDebug;
newPool.pooling = true;
newPool.Install();
curPools.Add(newPool);
Pools.Add(newPool.name, newPool);
}
}
public int GetPoolsCount()
{
if (curPools != null)
return curPools.Count;
return -1;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 12e51d46aadf24b4b813981141443db3
timeCreated: 1470145491
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,14 @@
using UnityEngine;
using System.Collections.Generic;
using System;
namespace FORGE3D
{
[Serializable]
public class F3DPoolManagerDB : ScriptableObject
{
public List<string> poolsName;
public List<F3DPoolContainer> pools;
public string namer = "default";
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2f1393d0f3c350e4981d23bc526f480d
timeCreated: 1470145491
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 3022f959abe9fde4ea98e3efb19ec4d3
folderAsset: yes
timeCreated: 1470145789
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 054ab73682d933a4da3e5ef33d046eef
folderAsset: yes
timeCreated: 1466679461
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f1393d0f3c350e4981d23bc526f480d, type: 3}
m_Name: DefaultDatabase
m_EditorClassIdentifier:
poolsName: []
pools:
- poolName: GeneratedPool
templates: []
poolLength:
poolLengthMax:
broadcastSpawnName:
broadcastDespawnName:
delayedSpawnInInstall: 1
objectsPerUpdate: 5
needBroadcasting: 1
optimizeSpawn: 1
targetFPS: 50
pooling: 1
needSort: 1
needParenting: 1
needDebug: 0
namer: DefaultDatabase

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8ec0e3c5e776917479e8f850ba0ba200
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f1393d0f3c350e4981d23bc526f480d, type: 3}
m_Name: GeneratedDataBase
m_EditorClassIdentifier:
poolsName: []
pools:
- poolName: GeneratedPool
templates: []
poolLength:
poolLengthMax:
broadcastSpawnName:
broadcastDespawnName:
delayedSpawnInInstall: 1
objectsPerUpdate: 5
needBroadcasting: 1
optimizeSpawn: 1
targetFPS: 50
pooling: 1
needSort: 1
needParenting: 1
needDebug: 0
namer: GeneratedDataBase

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b0cfbc044b05594eb3b0b1a4407ddd1
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,34 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f1393d0f3c350e4981d23bc526f480d, type: 3}
m_Name: MissleDatabase
m_EditorClassIdentifier:
poolsName: []
pools:
- poolName: GeneratedPool
templates:
- {fileID: 452452, guid: 6bd8c5e3240463f4aa109e322567fea0, type: 3}
- {fileID: 400002, guid: a1019cea5f836db4d811e29442cad418, type: 3}
poolLength: 1e0000001e000000
poolLengthMax: 1e0000001e000000
broadcastSpawnName: OnSpawned
broadcastDespawnName: OnDespawned
delayedSpawnInInstall: 0
objectsPerUpdate: 5
needBroadcasting: 1
optimizeSpawn: 1
targetFPS: 50
pooling: 1
needSort: 0
needParenting: 0
needDebug: 0
namer: MissleDatabase

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8b01a01b8134e6d44bf09a340592a3d0
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,60 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f1393d0f3c350e4981d23bc526f480d, type: 3}
m_Name: WeaponRange
m_EditorClassIdentifier:
poolsName: []
pools:
- poolName: GeneratedPool
templates:
- {fileID: 492552, guid: c7e9f38264df9af438839ee9c90e07c4, type: 3}
- {fileID: 400002, guid: bd9162be33a5ce54aa35d8e984e6d39d, type: 3}
- {fileID: 400010, guid: ce59e020d922ccb43866dee1ba26a673, type: 3}
- {fileID: 400004, guid: 45116fb1512dc704b99d70267628129a, type: 3}
- {fileID: 400004, guid: 64703ac190f718b4abd5d10cb23c96ce, type: 3}
- {fileID: 400002, guid: 497cce4f043498049994c48e6e47f0ae, type: 3}
- {fileID: 400000, guid: 66b50793fa1c780409218a1a1db5b1d8, type: 3}
- {fileID: 400000, guid: a5251bb5b54465f43aebe1ddc2724566, type: 3}
- {fileID: 400004, guid: ec543be1efaafca46aeac6f66e7a5ff0, type: 3}
- {fileID: 400002, guid: e4aff98840a58c94ea1cec28789d55d6, type: 3}
- {fileID: 400000, guid: e7b84dec6cdbfb646a33fd06b85cf64e, type: 3}
- {fileID: 400000, guid: ec0fb8bef2fb8a5459c55c3700521b70, type: 3}
- {fileID: 400010, guid: 2e92e894e0311c14c87f9544b2c88693, type: 3}
- {fileID: 400000, guid: 49ca46ce7082ccf4c91329cd9b7c4b61, type: 3}
- {fileID: 400010, guid: 762a17aff08aa1f40ac72b27c15fe2d1, type: 3}
- {fileID: 400004, guid: 43a8e47b31adb9a47b81c4653b412e5c, type: 3}
- {fileID: 400000, guid: 5f10243d9632db04bb987838fb3b36b7, type: 3}
- {fileID: 400000, guid: 12e7c1b739173c946b6fa3d40e9f62d1, type: 3}
- {fileID: 400004, guid: a980d2b7788c0ef489f3c79f44da79e1, type: 3}
- {fileID: 400004, guid: fd953838f1872d042a334b466e298967, type: 3}
- {fileID: 400012, guid: 440fe57f42038354092415c07a4d55a9, type: 3}
- {fileID: 400000, guid: b16d97c287e513344af2399ff138cd27, type: 3}
- {fileID: 400000, guid: bfa7781c328a236468eda51a8ae2be55, type: 3}
- {fileID: 400002, guid: ca6dec307275d294ba519247d04b6733, type: 3}
- {fileID: 400000, guid: e496166a742ada640b89650ebebbd052, type: 3}
- {fileID: 400000, guid: 9eeb3f92e3355994db8dc67cb3ea8ba0, type: 3}
- {fileID: 400002, guid: 0072b525437a5ed4891ebd255ec94fe6, type: 3}
- {fileID: 6391351660618465683, guid: f1d6be8fd7d5cc6448b99caa0671e56f, type: 3}
poolLength: 32000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000f40100003200000032000000
poolLengthMax: 32000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000320000003200000032000000f40100003200000032000000
broadcastSpawnName: OnSpawned
broadcastDespawnName: OnDespawned
delayedSpawnInInstall: 0
objectsPerUpdate: 5
needBroadcasting: 1
optimizeSpawn: 0
targetFPS: 50
pooling: 1
needSort: 0
needParenting: 0
needDebug: 0
namer: WeaponRange

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 199c65829baf1da43b9c89da41497004
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 05ff36a54b7382f4499005c6807b2a9b
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,223 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-6632916694925557420
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 29fa0085f50d5e54f8144f766051a691, type: 3}
m_Name: FilmGrain
m_EditorClassIdentifier:
active: 1
type:
m_OverrideState: 1
m_Value: 6
intensity:
m_OverrideState: 1
m_Value: 0.041
response:
m_OverrideState: 1
m_Value: 0.8
texture:
m_OverrideState: 1
m_Value: {fileID: 0}
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 12.63
aperture:
m_OverrideState: 1
m_Value: 5.3
focalLength:
m_OverrideState: 1
m_Value: 184
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 1
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Burnout
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -6632916694925557420}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.055
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.188
smoothness:
m_OverrideState: 1
m_Value: 0.2
rounded:
m_OverrideState: 1
m_Value: 0
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3fad440c273ec1f40a267a69872c8c36
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,197 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 19.1
aperture:
m_OverrideState: 1
m_Value: 17.3
focalLength:
m_OverrideState: 1
m_Value: 267
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 0.569
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 1
intensity:
m_OverrideState: 1
m_Value: 0.02
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 0
m_Value: 65471.84
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 0
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 0
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Debris Field
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.06
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0.97380245, g: 1, b: 0.740566, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.209
smoothness:
m_OverrideState: 1
m_Value: 0.257
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 0
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1d9ae5f0e4543a242868bcbfaf41acfd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 30.63
aperture:
m_OverrideState: 1
m_Value: 14.6
focalLength:
m_OverrideState: 1
m_Value: 184
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 0.8
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 7.8
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Effects
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.048
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0.93
contrast:
m_OverrideState: 1
m_Value: 6.8
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.181
smoothness:
m_OverrideState: 1
m_Value: 0.56
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5f56a40323d09574b8d14dc061c7e2f4
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 13.16
aperture:
m_OverrideState: 1
m_Value: 13.9
focalLength:
m_OverrideState: 1
m_Value: 256
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 0.8
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 7.8
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Holographic
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.048
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0.93
contrast:
m_OverrideState: 1
m_Value: 6.8
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.181
smoothness:
m_OverrideState: 1
m_Value: 0.56
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 91ce03fb36a3365488c495345046ab81
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 30.63
aperture:
m_OverrideState: 1
m_Value: 14.6
focalLength:
m_OverrideState: 1
m_Value: 184
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 0.8
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 7.8
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Missiles
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.048
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0.93
contrast:
m_OverrideState: 1
m_Value: 6.8
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.181
smoothness:
m_OverrideState: 1
m_Value: 0.56
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14ce29f03789adf40a7fec02bb6ac9f3
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,226 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 58.2
aperture:
m_OverrideState: 1
m_Value: 4.1
focalLength:
m_OverrideState: 1
m_Value: 208
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.34
intensity:
m_OverrideState: 1
m_Value: 1
scatter:
m_OverrideState: 1
m_Value: 0.826
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Nebulas
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 0
intensity:
m_OverrideState: 1
m_Value: 0.09
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 0
m_Value: 0.5
contrast:
m_OverrideState: 0
m_Value: -0.3
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 1
m_Value: 12
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 0
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.192
smoothness:
m_OverrideState: 1
m_Value: 0.347
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d5e118ae3dfb26147bd1e8ad5412ff88
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 24.2
aperture:
m_OverrideState: 1
m_Value: 7.7
focalLength:
m_OverrideState: 1
m_Value: 192
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.99
intensity:
m_OverrideState: 1
m_Value: 0.8
scatter:
m_OverrideState: 1
m_Value: 0.558
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 1
temperature:
m_OverrideState: 1
m_Value: 7.8
tint:
m_OverrideState: 1
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: Turrets
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.048
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 1.61
contrast:
m_OverrideState: 1
m_Value: 8.3
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.181
smoothness:
m_OverrideState: 1
m_Value: 0.56
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cb0aae91aeb59b24aa9211b20f3fe8ee
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 24.2
aperture:
m_OverrideState: 1
m_Value: 7.7
focalLength:
m_OverrideState: 1
m_Value: 190
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 1
intensity:
m_OverrideState: 1
m_Value: 2.88
scatter:
m_OverrideState: 1
m_Value: 0.82
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 0
temperature:
m_OverrideState: 0
m_Value: 7.8
tint:
m_OverrideState: 0
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: WarpJump
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.252
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0
contrast:
m_OverrideState: 1
m_Value: 8.3
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 0
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.181
smoothness:
m_OverrideState: 1
m_Value: 0.096
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e14200efbeefaec46955dfaded839630
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,246 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-2439872706674709594
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c01700fd266d6914ababb731e09af2eb, type: 3}
m_Name: DepthOfField
m_EditorClassIdentifier:
active: 0
mode:
m_OverrideState: 1
m_Value: 2
gaussianStart:
m_OverrideState: 1
m_Value: 10
gaussianEnd:
m_OverrideState: 1
m_Value: 30
gaussianMaxRadius:
m_OverrideState: 1
m_Value: 1
highQualitySampling:
m_OverrideState: 1
m_Value: 0
focusDistance:
m_OverrideState: 1
m_Value: 32.66
aperture:
m_OverrideState: 1
m_Value: 13.4
focalLength:
m_OverrideState: 1
m_Value: 288
bladeCount:
m_OverrideState: 1
m_Value: 5
bladeCurvature:
m_OverrideState: 1
m_Value: 1
bladeRotation:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-2154685693240888407
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0b2db86121404754db890f4c8dfe81b2, type: 3}
m_Name: Bloom
m_EditorClassIdentifier:
active: 1
skipIterations:
m_OverrideState: 1
m_Value: 1
threshold:
m_OverrideState: 1
m_Value: 0.7
intensity:
m_OverrideState: 1
m_Value: 1
scatter:
m_OverrideState: 1
m_Value: 0.69
clamp:
m_OverrideState: 1
m_Value: 65472
tint:
m_OverrideState: 1
m_Value: {r: 1, g: 1, b: 1, a: 1}
highQualityFiltering:
m_OverrideState: 1
m_Value: 1
downscale:
m_OverrideState: 0
m_Value: 0
maxIterations:
m_OverrideState: 0
m_Value: 6
dirtTexture:
m_OverrideState: 1
m_Value: {fileID: 0}
dimension: 1
dirtIntensity:
m_OverrideState: 1
m_Value: 0
--- !u!114 &-808006152824296517
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 221518ef91623a7438a71fef23660601, type: 3}
m_Name: WhiteBalance
m_EditorClassIdentifier:
active: 0
temperature:
m_OverrideState: 0
m_Value: 7.8
tint:
m_OverrideState: 0
m_Value: 0
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d7fd9488000d3734a9e00ee676215985, type: 3}
m_Name: WarpTunnel
m_EditorClassIdentifier:
components:
- {fileID: 8888579287495606339}
- {fileID: -2154685693240888407}
- {fileID: -2439872706674709594}
- {fileID: 2651481852041275419}
- {fileID: 4082488353432010529}
- {fileID: -808006152824296517}
- {fileID: 3333710037340004473}
--- !u!114 &2651481852041275419
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 81180773991d8724ab7f2d216912b564, type: 3}
m_Name: ChromaticAberration
m_EditorClassIdentifier:
active: 1
intensity:
m_OverrideState: 1
m_Value: 0.252
--- !u!114 &3333710037340004473
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 66f335fb1ffd8684294ad653bf1c7564, type: 3}
m_Name: ColorAdjustments
m_EditorClassIdentifier:
active: 1
postExposure:
m_OverrideState: 1
m_Value: 0.74
contrast:
m_OverrideState: 1
m_Value: 2
colorFilter:
m_OverrideState: 0
m_Value: {r: 1, g: 1, b: 1, a: 1}
hueShift:
m_OverrideState: 0
m_Value: 0
saturation:
m_OverrideState: 0
m_Value: -29.6
--- !u!114 &4082488353432010529
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 899c54efeace73346a0a16faa3afe726, type: 3}
m_Name: Vignette
m_EditorClassIdentifier:
active: 1
color:
m_OverrideState: 1
m_Value: {r: 0, g: 0, b: 0, a: 1}
center:
m_OverrideState: 1
m_Value: {x: 0.5, y: 0.5}
intensity:
m_OverrideState: 1
m_Value: 0.224
smoothness:
m_OverrideState: 1
m_Value: 0.257
rounded:
m_OverrideState: 1
m_Value: 1
--- !u!114 &8888579287495606339
MonoBehaviour:
m_ObjectHideFlags: 3
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 97c23e3b12dc18c42a140437e53d3951, type: 3}
m_Name: Tonemapping
m_EditorClassIdentifier:
active: 1
mode:
m_OverrideState: 1
m_Value: 0
neutralHDRRangeReductionMode:
m_OverrideState: 0
m_Value: 2
acesPreset:
m_OverrideState: 0
m_Value: 3
hueShiftAmount:
m_OverrideState: 0
m_Value: 0
detectPaperWhite:
m_OverrideState: 0
m_Value: 0
paperWhite:
m_OverrideState: 0
m_Value: 300
detectBrightnessLimits:
m_OverrideState: 0
m_Value: 1
minNits:
m_OverrideState: 0
m_Value: 0.005
maxNits:
m_OverrideState: 0
m_Value: 1000

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 14e677441db932344abd9f55fd20efff
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 9b99e5fbc1ab0b3439350f00b26d78d5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
fileFormatVersion: 2
guid: 16efff009a4e5e84fa8e394b50cf46b6
DefaultImporter:
userData:

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: 32afb9cd68cbcc54cb603fb69693c3df
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,624 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DAudioController : MonoBehaviour
{
// Singleton instance
public static F3DAudioController instance;
// Audio timers
float timer_01, timer_02;
public Transform audioSource;
[Header("Vulcan")] public AudioClip[] vulcanHit; // Impact prefabs array
public AudioClip vulcanShot; // Shot prefab
public float vulcanDelay; // Shot delay in ms
public float vulcanHitDelay; // Hit delay in ms
[Header("Solo gun")] public AudioClip[] soloGunHit;
public AudioClip soloGunShot;
public float soloGunDelay;
public float soloGunHitDelay;
[Header("Sniper")] public AudioClip[] sniperHit;
public AudioClip sniperShot;
public float sniperDelay;
public float sniperHitDelay;
[Header("Shot gun")] public AudioClip[] shotGunHit;
public AudioClip shotGunShot;
public float shotGunDelay;
public float shotGunHitDelay;
[Header("Seeker")] public AudioClip[] seekerHit;
public AudioClip seekerShot;
public float seekerDelay;
public float seekerHitDelay;
[Header("Rail gun")] public AudioClip[] railgunHit;
public AudioClip railgunShot;
public float railgunDelay;
public float railgunHitDelay;
[Header("Plasma gun")] public AudioClip[] plasmagunHit;
public AudioClip plasmagunShot;
public float plasmagunDelay;
public float plasmagunHitDelay;
[Header("Plasma beam")] public AudioClip plasmabeamOpen; // Open audio clip prefab
public AudioClip plasmabeamLoop; // Loop audio clip prefab
public AudioClip plasmabeamClose; // Close audio clip prefab
[Header("Plasma beam heavy")] public AudioClip plasmabeamHeavyOpen;
public AudioClip plasmabeamHeavyLoop;
public AudioClip plasmabeamHeavyClose;
[Header("Lightning gun")] public AudioClip lightningGunOpen;
public AudioClip lightningGunLoop;
public AudioClip lightningGunClose;
[Header("Flame gun")] public AudioClip flameGunOpen;
public AudioClip flameGunLoop;
public AudioClip flameGunClose;
[Header("Laser impulse")] public AudioClip[] laserImpulseHit;
public AudioClip laserImpulseShot;
public float laserImpulseDelay;
public float laserImpulseHitDelay;
void Awake()
{
// Initialize singleton
instance = this;
}
void Update()
{
// Update timers
timer_01 += Time.deltaTime;
timer_02 += Time.deltaTime;
}
// Play vulcan shot audio at specific position
public void VulcanShot(Vector3 pos)
{
// Audio source can only be played once for each vulcanDelay
if (timer_01 >= vulcanDelay)
{
// Spawn audio source prefab from pool
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, vulcanShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
// Modify audio source settings specific to it's type
aSrc.pitch = Random.Range(0.95f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 5f;
aSrc.loop = false;
aSrc.Play();
// Reset delay timer
timer_01 = 0f;
}
}
}
// Play vulcan hit audio at specific position
public void VulcanHit(Vector3 pos)
{
if (timer_02 >= vulcanHitDelay)
{
// Spawn random hit audio prefab from pool for specific weapon type
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
vulcanHit[Random.Range(0, vulcanHit.Length)], pos, null).gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.95f, 1f);
aSrc.volume = Random.Range(0.6f, 1f);
aSrc.minDistance = 7f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play solo gun shot audio at specific position
public void SoloGunShot(Vector3 pos)
{
if (timer_01 >= soloGunDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, soloGunShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.95f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 30f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play solo gun hit audio at specific position
public void SoloGunHit(Vector3 pos)
{
if (timer_02 >= soloGunHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
soloGunHit[Random.Range(0, soloGunHit.Length)], pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.95f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 50f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play sniper shot audio at specific position
public void SniperShot(Vector3 pos)
{
if (timer_01 >= sniperDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, sniperShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.9f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 6f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play sniper hit audio at specific position
public void SniperHit(Vector3 pos)
{
if (timer_02 >= sniperHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
sniperHit[Random.Range(0, sniperHit.Length)], pos, null).gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.9f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 8f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play shotgun shot audio at specific position
public void ShotGunShot(Vector3 pos)
{
if (timer_01 >= shotGunDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, shotGunShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.9f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 8f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play shotgun hit audio at specific position
public void ShotGunHit(Vector3 pos)
{
if (timer_02 >= shotGunHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
shotGunHit[Random.Range(0, shotGunHit.Length)], pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.9f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 7f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play seeker shot audio at specific position
public void SeekerShot(Vector3 pos)
{
if (timer_01 >= seekerDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, seekerShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.4f, 0.5f);
aSrc.minDistance = 8f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play seeker hit audio at specific position
public void SeekerHit(Vector3 pos)
{
if (timer_02 >= seekerHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
seekerHit[Random.Range(0, seekerHit.Length)], pos, null).gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.4f, 0.5f);
aSrc.minDistance = 25f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play railgun shot audio at specific position
public void RailGunShot(Vector3 pos)
{
if (timer_01 >= railgunDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, railgunShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 4f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play railgun hit audio at specific position
public void RailGunHit(Vector3 pos)
{
if (timer_02 >= railgunHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
railgunHit[Random.Range(0, railgunHit.Length)], pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 20f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play plasma gun shot audio at specific position
public void PlasmaGunShot(Vector3 pos)
{
if (timer_01 >= plasmagunDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmagunShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 4f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play plasma gun hit audio at specific position
public void PlasmaGunHit(Vector3 pos)
{
if (timer_02 >= plasmagunHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
plasmagunHit[Random.Range(0, plasmagunHit.Length)], pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 50f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
// Play plasma beam shot and loop audio at specific position
public void PlasmaBeamLoop(Vector3 pos, Transform loopParent)
{
AudioSource aOpen =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamOpen, pos, null)
.gameObject.GetComponent<AudioSource>();
AudioSource aLoop =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamLoop, pos, loopParent)
.gameObject.GetComponent<AudioSource>();
if (aOpen != null && aLoop != null)
{
aOpen.pitch = Random.Range(0.8f, 1f);
aOpen.volume = Random.Range(0.8f, 1f);
aOpen.minDistance = 50f;
aOpen.loop = false;
aOpen.Play();
aLoop.pitch = Random.Range(0.95f, 1f);
aLoop.volume = Random.Range(0.95f, 1f);
aLoop.loop = true;
aLoop.minDistance = 50f;
aLoop.Play();
}
}
// Play plasma beam closing audio at specific position
public void PlasmaBeamClose(Vector3 pos)
{
AudioSource aClose =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamClose, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aClose != null)
{
aClose.pitch = Random.Range(0.8f, 1f);
aClose.volume = Random.Range(0.8f, 1f);
aClose.minDistance = 50f;
aClose.loop = false;
aClose.Play();
}
}
// Play heavy plasma beam shot and loop audio at specific position
public void PlasmaBeamHeavyLoop(Vector3 pos, Transform loopParent)
{
AudioSource aOpen =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamHeavyOpen, pos, null)
.gameObject.GetComponent<AudioSource>();
AudioSource aLoop =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamHeavyLoop, pos, loopParent)
.gameObject.GetComponent<AudioSource>();
if (aOpen != null && aLoop != null)
{
aOpen.pitch = Random.Range(0.8f, 1f);
aOpen.volume = Random.Range(0.8f, 1f);
aOpen.minDistance = 50f;
aOpen.loop = false;
aOpen.Play();
aLoop.pitch = Random.Range(0.95f, 1f);
aLoop.volume = Random.Range(0.95f, 1f);
aLoop.loop = true;
aLoop.minDistance = 50f;
aLoop.Play();
}
}
// Play heavy plasma beam closing audio at specific position
public void PlasmaBeamHeavyClose(Vector3 pos)
{
AudioSource aClose =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, plasmabeamHeavyClose, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aClose != null)
{
aClose.pitch = Random.Range(0.8f, 1f);
aClose.volume = Random.Range(0.8f, 1f);
aClose.minDistance = 50f;
aClose.loop = false;
aClose.Play();
}
}
// Play lightning gun shot and loop audio at specific position
public void LightningGunLoop(Vector3 pos, Transform loopParent)
{
AudioSource aOpen =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, lightningGunOpen, pos, null)
.gameObject.GetComponent<AudioSource>();
AudioSource aLoop =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, lightningGunLoop, pos, loopParent.parent)
.gameObject.GetComponent<AudioSource>();
if (aOpen != null && aLoop != null)
{
aOpen.pitch = Random.Range(0.8f, 1f);
aOpen.volume = Random.Range(0.8f, 1f);
aOpen.minDistance = 50f;
aOpen.loop = false;
aOpen.Play();
aLoop.pitch = Random.Range(0.95f, 1f);
aLoop.volume = Random.Range(0.95f, 1f);
aLoop.loop = true;
aLoop.minDistance = 50f;
aLoop.Play();
}
}
// Play lightning gun closing audio at specific position
public void LightningGunClose(Vector3 pos)
{
AudioSource aClose =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, lightningGunClose, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aClose != null)
{
aClose.pitch = Random.Range(0.8f, 1f);
aClose.volume = Random.Range(0.8f, 1f);
aClose.minDistance = 50f;
aClose.loop = false;
aClose.Play();
}
}
// Play flame shot and loop audio at specific position
public void FlameGunLoop(Vector3 pos, Transform loopParent)
{
AudioSource aOpen =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, flameGunOpen, pos, null)
.gameObject.GetComponent<AudioSource>();
AudioSource aLoop =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, flameGunLoop, pos, loopParent.parent)
.gameObject.GetComponent<AudioSource>();
if (aOpen != null && aLoop != null)
{
aOpen.pitch = Random.Range(0.8f, 1f);
aOpen.volume = Random.Range(0.8f, 1f);
aOpen.minDistance = 50f;
aOpen.loop = false;
aOpen.Play();
aLoop.pitch = Random.Range(0.95f, 1f);
aLoop.volume = Random.Range(0.95f, 1f);
aLoop.loop = true;
aLoop.minDistance = 50f;
aLoop.Play();
}
}
// Play flame closing audio at specific position
public void FlameGunClose(Vector3 pos)
{
AudioSource aClose =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, flameGunClose, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aClose != null)
{
aClose.pitch = Random.Range(0.8f, 1f);
aClose.volume = Random.Range(0.8f, 1f);
aClose.minDistance = 50f;
aClose.loop = false;
aClose.Play();
}
}
// Play laser pulse shot audio at specific position
public void LaserImpulseShot(Vector3 pos)
{
if (timer_01 >= laserImpulseDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource, laserImpulseShot, pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.9f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 20f;
aSrc.loop = false;
aSrc.Play();
timer_01 = 0f;
}
}
}
// Play laser pulse hit audio at specific position
public void LaserImpulseHit(Vector3 pos)
{
if (timer_02 >= laserImpulseHitDelay)
{
AudioSource aSrc =
F3DPoolManager.Pools["GeneratedPool"].SpawnAudio(audioSource,
laserImpulseHit[Random.Range(0, plasmagunHit.Length)], pos, null)
.gameObject.GetComponent<AudioSource>();
if (aSrc != null)
{
aSrc.pitch = Random.Range(0.8f, 1f);
aSrc.volume = Random.Range(0.8f, 1f);
aSrc.minDistance = 20f;
aSrc.loop = false;
aSrc.Play();
timer_02 = 0f;
}
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: deb1b38f7c8f8e44385c9f01d055bfd0
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,244 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
[RequireComponent(typeof(LineRenderer))]
public class F3DBeam : MonoBehaviour
{
public LayerMask layerMask;
public F3DFXType fxType; // Weapon type
public bool OneShot; // Constant or single beam?
public Texture[] BeamFrames; // Animation frame sequence
public float FrameStep; // Animation time
public float beamScale; // Default beam scale to be kept over distance
public float MaxBeamLength; // Maximum beam length
public bool AnimateUV; // UV Animation
public float UVTime; // UV Animation speed
public Transform rayImpact; // Impact transform
public Transform rayMuzzle; // Muzzle flash transform
LineRenderer lineRenderer; // Line rendered component
RaycastHit hitPoint; // Raycast structure
RaycastHit2D hitPoint2D; // Raycasthit in 2d
int frameNo; // Frame counter
int FrameTimerID; // Frame timer reference
float beamLength; // Current beam length
float initialBeamOffset; // Initial UV offset
public float fxOffset; // Fx offset from bullet's touch point
void Awake()
{
// Get line renderer component
lineRenderer = GetComponent<LineRenderer>();
// Assign first frame texture
if (!AnimateUV && BeamFrames.Length > 0)
lineRenderer.material.mainTexture = BeamFrames[0];
// Randomize uv offset
initialBeamOffset = Random.Range(0f, 5f);
}
// OnSpawned called by pool manager
void OnSpawned()
{
// Do one time raycast in case of one shot flag
if (OneShot)
Raycast();
// Start animation sequence if beam frames array has more than 2 elements
if (BeamFrames.Length > 1)
Animate();
}
// OnDespawned called by pool manager
void OnDespawned()
{
// Reset frame counter
frameNo = 0;
// Clear timer
if (FrameTimerID != -1)
{
F3DTime.time.RemoveTimer(FrameTimerID);
FrameTimerID = -1;
}
}
// Hit point calculation
void Raycast()
{
// Prepare structure and create ray
hitPoint = new RaycastHit();
Ray ray = new Ray(transform.position, transform.forward);
// Calculate default beam proportion multiplier based on default scale and maximum length
float propMult = MaxBeamLength * (beamScale / 10f);
// Raycast
if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask))
{
// Get current beam length and update line renderer accordingly
beamLength = Vector3.Distance(transform.position, hitPoint.point);
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length
propMult = beamLength * (beamScale / 10f);
// Spawn prefabs and apply force
switch (fxType)
{
case F3DFXType.Sniper:
F3DFXController.instance.SniperImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(4f);
break;
case F3DFXType.RailGun:
F3DFXController.instance.RailgunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(7f);
break;
case F3DFXType.PlasmaBeam:
ApplyForce(0.5f);
break;
case F3DFXType.PlasmaBeamHeavy:
ApplyForce(2f);
break;
}
// Adjust impact effect position
if (rayImpact)
rayImpact.position = hitPoint.point - transform.forward * 0.5f;
}
//checking in 2d mode
else
{
RaycastHit2D ray2D = Physics2D.Raycast(new Vector2(transform.position.x, transform.position.y),
new Vector2(transform.forward.x, transform.forward.y), beamLength, layerMask);
if (ray2D)
{
// Get current beam length and update line renderer accordingly
beamLength = Vector3.Distance(transform.position, ray2D.point);
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length
propMult = beamLength * (beamScale / 10f);
// Spawn prefabs and apply force
switch (fxType)
{
case F3DFXType.Sniper:
F3DFXController.instance.SniperImpact(ray2D.point + ray2D.normal * fxOffset);
ApplyForce(4f);
break;
case F3DFXType.RailGun:
F3DFXController.instance.RailgunImpact(ray2D.point + ray2D.normal * fxOffset);
ApplyForce(7f);
break;
case F3DFXType.PlasmaBeam:
ApplyForce(0.5f);
break;
case F3DFXType.PlasmaBeamHeavy:
ApplyForce(2f);
break;
}
// Adjust impact effect position
if (rayImpact)
rayImpact.position = new Vector3(ray2D.point.x,
ray2D.point.y,
this.gameObject.transform.position.z) - transform.forward * 0.5f;
}
// Nothing was his
else
{
// Set beam to maximum length
beamLength = MaxBeamLength;
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Adjust impact effect position
if (rayImpact)
rayImpact.position = transform.position + transform.forward * beamLength;
}
}
// Adjust muzzle position
if (rayMuzzle)
rayMuzzle.position = transform.position + transform.forward * 0.1f;
// Set beam scaling according to its length
lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f));
}
// Advance texture frame
void OnFrameStep()
{
// Set current texture frame based on frame counter
lineRenderer.material.mainTexture = BeamFrames[frameNo];
frameNo++;
// Reset frame counter
if (frameNo == BeamFrames.Length)
frameNo = 0;
}
// Initialize frame animation
void Animate()
{
if (BeamFrames.Length > 1)
{
// Set current frame
frameNo = 0;
lineRenderer.material.mainTexture = BeamFrames[frameNo];
// Add timer
FrameTimerID = F3DTime.time.AddTimer(FrameStep, BeamFrames.Length - 1, OnFrameStep);
frameNo = 1;
}
}
// Apply force to last hit object
void ApplyForce(float force)
{
if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point,
ForceMode.VelocityChange);
}
// Set offset of impact
public void SetOffset(float offset)
{
fxOffset = offset;
}
private float animateUVTime;
void Update()
{
// Animate texture UV
if (AnimateUV)
{
animateUVTime += Time.deltaTime;
if (animateUVTime > 1.0f)
animateUVTime = 0f;
var v = animateUVTime * UVTime + initialBeamOffset;
lineRenderer.material.SetVector("_Offset", new Vector2(v, 0));
}
// Raycast for laser beams
if (!OneShot)
Raycast();
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1a9aefbed78059c4c965f18823e35186
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,57 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
[RequireComponent(typeof(LineRenderer))]
public class F3DCurvedBeam : MonoBehaviour
{
public Transform dest;
public float beamScale; // Default beam scale to be kept over distance
public float UVTime; // UV Animation speed
LineRenderer lineRenderer; // Line rendered component
public int curvePoints;
public float curveHeight;
float initialBeamOffset; // Initial UV offset
void Start()
{
// Get line renderer component
lineRenderer = GetComponent<LineRenderer>();
// Randomize uv offset
initialBeamOffset = Random.Range(0f, 5f);
lineRenderer.positionCount = curvePoints;
}
void Update()
{
lineRenderer.material.SetTextureOffset("_MainTex", new Vector2(Time.time * UVTime + initialBeamOffset, 0f));
float distToDest = Vector3.Distance(transform.position, dest.position);
lineRenderer.SetPosition(0, transform.position);
float piRate = Mathf.PI / (curvePoints - 1);
for (int i = 1; i < curvePoints - 1; i++)
{
float distRatio = (distToDest / (curvePoints - 1)) * i;
Vector3 midPos = Vector3.Normalize(dest.position - transform.position) * distRatio;
float cHeight = Mathf.Sin(piRate * i) * curveHeight;
midPos += transform.up * cHeight;
lineRenderer.SetPosition(i, transform.position + midPos);
}
lineRenderer.SetPosition(curvePoints - 1, dest.position);
float propMult = distToDest * (beamScale / 10f);
// Set beam scaling according to its length
lineRenderer.material.SetTextureScale("_MainTex", new Vector2(propMult, 1f));
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a1fb4a84404a99f4d89184722d264b97
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,69 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DDespawn : MonoBehaviour
{
public float DespawnDelay; // Despawn delay in ms
public bool DespawnOnMouseUp; // Despawn on mouse up used for beams demo
AudioSource aSrc; // Cached audio source component
void Awake()
{
// Get audio source component
aSrc = GetComponent<AudioSource>();
}
// OnSpawned called by pool manager
public void OnSpawned()
{
// Invokes despawn using timer delay
if (!DespawnOnMouseUp)
F3DTime.time.AddTimer(DespawnDelay, 1, DespawnOnTimer);
}
// OnDespawned called by pool manager
public void OnDespawned()
{
}
// Run required checks for the looping audio source and despawn the game object
public void DespawnOnTimer()
{
if (aSrc != null)
{
if (aSrc.loop)
DespawnOnMouseUp = true;
else
{
DespawnOnMouseUp = false;
Despawn();
}
}
else
{
Despawn();
}
}
// Despawn game object this script attached to
public void Despawn()
{
F3DPoolManager.Pools["GeneratedPool"].Despawn(transform);
//F3DPool.instance.Despawn(transform);
}
void Update()
{
// Despawn on mouse up
if (Input.GetMouseButtonUp(0))
if (aSrc != null && aSrc.loop || DespawnOnMouseUp)
Despawn();
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: af19da7458dc9174699d0b34f404eafc
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,504 @@
using UnityEngine;
using System.Collections;
using System;
namespace FORGE3D
{
// Weapon types
public enum F3DFXType
{
Vulcan,
SoloGun,
Sniper,
ShotGun,
Seeker,
RailGun,
PlasmaGun,
PlasmaBeam,
PlasmaBeamHeavy,
LightningGun,
FlameRed,
LaserImpulse
}
public class F3DFXController : MonoBehaviour
{
// Singleton instance
public static F3DFXController instance;
// Current firing socket
private int curSocket = 0;
// Timer reference
private int timerID = -1;
[Header("Turret setup")] public Transform[] TurretSocket; // Sockets reference
public ParticleSystem[] ShellParticles; // Bullet shells particle system
public F3DFXType DefaultFXType; // Default starting weapon type
[Header("Vulcan")] public Transform vulcanProjectile; // Projectile prefab
public Transform vulcanMuzzle; // Muzzle flash prefab
public Transform vulcanImpact; // Impact prefab
public float vulcanOffset;
public float VulcanFireRate = 0.07f;
[Header("Solo gun")] public Transform soloGunProjectile;
public Transform soloGunMuzzle;
public Transform soloGunImpact;
public float soloGunOffset;
[Header("Sniper")] public Transform sniperBeam;
public Transform sniperMuzzle;
public Transform sniperImpact;
public float sniperOffset;
[Header("Shotgun")] public Transform shotGunProjectile;
public Transform shotGunMuzzle;
public Transform shotGunImpact;
public float shotGunOffset;
[Header("Seeker")] public Transform seekerProjectile;
public Transform seekerMuzzle;
public Transform seekerImpact;
public float seekerOffset;
[Header("Rail gun")] public Transform railgunBeam;
public Transform railgunMuzzle;
public Transform railgunImpact;
public float railgunOffset;
[Header("Plasma gun")] public Transform plasmagunProjectile;
public Transform plasmagunMuzzle;
public Transform plasmagunImpact;
public float plasmaGunOffset;
[Header("Plasma beam")] public Transform plasmaBeam;
public float plasmaOffset;
[Header("Plasma beam heavy")] public Transform plasmaBeamHeavy;
public float plasmaBeamHeavyOffset;
[Header("Lightning gun")] public Transform lightningGunBeam;
public float lightingGunBeamOffset;
[Header("Flame")] public Transform flameRed;
public float flameOffset;
[Header("Laser impulse")] public Transform laserImpulseProjectile;
public Transform laserImpulseMuzzle;
public Transform laserImpulseImpact;
public float laserImpulseOffset;
private void Awake()
{
// Initialize singleton
instance = this;
// Initialize bullet shells particles
for (int i = 0; i < ShellParticles.Length; i++)
{
var em = ShellParticles[i].emission;
em.enabled = false;
ShellParticles[i].Stop();
ShellParticles[i].gameObject.SetActive(true);
}
}
// Switch to next weapon type
public void NextWeapon()
{
if ((int) DefaultFXType < Enum.GetNames(typeof(F3DFXType)).Length - 1)
{
DefaultFXType++;
}
}
// Switch to previous weapon type
public void PrevWeapon()
{
if (DefaultFXType > 0)
{
DefaultFXType--;
}
}
// Advance to next turret socket
private void AdvanceSocket()
{
curSocket++;
if (curSocket >= TurretSocket.Length)
curSocket = 0;
}
// Fire turret weapon
public void Fire()
{
switch (DefaultFXType)
{
case F3DFXType.Vulcan:
// Fire vulcan at specified rate until canceled
timerID = F3DTime.time.AddTimer(VulcanFireRate, Vulcan);
// Invoke manually before the timer ticked to avoid initial delay
Vulcan();
break;
case F3DFXType.SoloGun:
timerID = F3DTime.time.AddTimer(0.2f, SoloGun);
SoloGun();
break;
case F3DFXType.Sniper:
timerID = F3DTime.time.AddTimer(0.3f, Sniper);
Sniper();
break;
case F3DFXType.ShotGun:
timerID = F3DTime.time.AddTimer(0.3f, ShotGun);
ShotGun();
break;
case F3DFXType.Seeker:
timerID = F3DTime.time.AddTimer(0.2f, Seeker);
Seeker();
break;
case F3DFXType.RailGun:
timerID = F3DTime.time.AddTimer(0.2f, RailGun);
RailGun();
break;
case F3DFXType.PlasmaGun:
timerID = F3DTime.time.AddTimer(0.2f, PlasmaGun);
PlasmaGun();
break;
case F3DFXType.PlasmaBeam:
// Beams has no timer requirement
PlasmaBeam();
break;
case F3DFXType.PlasmaBeamHeavy:
// Beams has no timer requirement
PlasmaBeamHeavy();
break;
case F3DFXType.LightningGun:
// Beams has no timer requirement
LightningGun();
break;
case F3DFXType.FlameRed:
// Flames has no timer requirement
FlameRed();
break;
case F3DFXType.LaserImpulse:
timerID = F3DTime.time.AddTimer(0.15f, LaserImpulse);
LaserImpulse();
break;
}
}
// Stop firing
public void Stop()
{
// Remove firing timer
if (timerID != -1)
{
F3DTime.time.RemoveTimer(timerID);
timerID = -1;
}
switch (DefaultFXType)
{
case F3DFXType.PlasmaBeam:
F3DAudioController.instance.PlasmaBeamClose(transform.position);
break;
case F3DFXType.PlasmaBeamHeavy:
F3DAudioController.instance.PlasmaBeamHeavyClose(transform.position);
break;
case F3DFXType.LightningGun:
F3DAudioController.instance.LightningGunClose(transform.position);
break;
case F3DFXType.FlameRed:
F3DAudioController.instance.FlameGunClose(transform.position);
break;
}
}
// Fire vulcan weapon
private void Vulcan()
{
// Get random rotation that offset spawned projectile
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
// Spawn muzzle flash and projectile with the rotation offset at current socket position
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanProjectile,
TurretSocket[curSocket].position + TurretSocket[curSocket].forward,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.gameObject.GetComponent<F3DProjectile>();
if (proj)
{
proj.SetOffset(vulcanOffset);
}
// Emit one bullet shell
if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1);
// Play shot sound effect
F3DAudioController.instance.VulcanShot(TurretSocket[curSocket].position);
// Advance to next turret socket
AdvanceSocket();
}
// Spawn vulcan weapon impact
public void VulcanImpact(Vector3 pos)
{
// Spawn impact prefab at specified position
F3DPoolManager.Pools["GeneratedPool"].Spawn(vulcanImpact, pos, Quaternion.identity, null);
// Play impact sound effect
F3DAudioController.instance.VulcanHit(pos);
}
// Fire sologun weapon
private void SoloGun()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunProjectile,
TurretSocket[curSocket].position + TurretSocket[curSocket].forward,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.GetComponent<F3DProjectile>();
if (proj)
{
proj.SetOffset(soloGunOffset);
}
F3DAudioController.instance.SoloGunShot(TurretSocket[curSocket].position);
AdvanceSocket();
}
// Spawn sologun weapon impact
public void SoloGunImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(soloGunImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.SoloGunHit(pos);
}
// Fire sniper weapon
private void Sniper()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperBeam, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var beam = newGO.GetComponent<F3DBeam>();
if (beam)
{
beam.SetOffset(sniperOffset);
}
F3DAudioController.instance.SniperShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1);
AdvanceSocket();
}
// Spawn sniper weapon impact
public void SniperImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(sniperImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.SniperHit(pos);
}
// Fire shotgun weapon
private void ShotGun()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
F3DPoolManager.Pools["GeneratedPool"].Spawn(shotGunProjectile, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null);
F3DAudioController.instance.ShotGunShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1);
AdvanceSocket();
}
// Fire seeker weapon
private void Seeker()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(seekerMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(seekerProjectile, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.GetComponent<F3DProjectile>();
if (proj)
{
proj.SetOffset(seekerOffset);
}
F3DAudioController.instance.SeekerShot(TurretSocket[curSocket].position);
AdvanceSocket();
}
// Spawn seeker weapon impact
public void SeekerImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(seekerImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.SeekerHit(pos);
}
// Fire rail gun weapon
private void RailGun()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(railgunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(railgunBeam, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var beam = newGO.GetComponent<F3DBeam>();
if (beam)
{
beam.SetOffset(railgunOffset);
}
F3DAudioController.instance.RailGunShot(TurretSocket[curSocket].position);
if (ShellParticles.Length > 0)
ShellParticles[curSocket].Emit(1);
AdvanceSocket();
}
// Spawn rail gun weapon impact
public void RailgunImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(railgunImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.RailGunHit(pos);
}
// Fire plasma gun weapon
private void PlasmaGun()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmagunMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGo =
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmagunProjectile, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGo.GetComponent<F3DProjectile>();
if (proj)
{
proj.SetOffset(plasmaOffset);
}
F3DAudioController.instance.PlasmaGunShot(TurretSocket[curSocket].position);
AdvanceSocket();
}
// Spawn plasma gun weapon impact
public void PlasmaGunImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmagunImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.PlasmaGunHit(pos);
}
// Fire plasma beam weapon
private void PlasmaBeam()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeam, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
F3DAudioController.instance.PlasmaBeamLoop(transform.position, transform.parent);
}
// Fire heavy beam weapon
private void PlasmaBeamHeavy()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(plasmaBeamHeavy, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
F3DAudioController.instance.PlasmaBeamHeavyLoop(transform.position, transform.parent);
}
// Fire lightning gun weapon
private void LightningGun()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(lightningGunBeam, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
F3DAudioController.instance.LightningGunLoop(transform.position, transform);
}
// Fire flames weapon
private void FlameRed()
{
for (var i = 0; i < TurretSocket.Length; i++)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(flameRed, TurretSocket[i].position,
TurretSocket[i].rotation,
TurretSocket[i]);
}
F3DAudioController.instance.FlameGunLoop(transform.position, transform);
}
// Fire laser pulse weapon
private void LaserImpulse()
{
var offset = Quaternion.Euler(UnityEngine.Random.onUnitSphere);
F3DPoolManager.Pools["GeneratedPool"].Spawn(laserImpulseMuzzle, TurretSocket[curSocket].position,
TurretSocket[curSocket].rotation, TurretSocket[curSocket]);
var newGO =
F3DPoolManager.Pools["GeneratedPool"].Spawn(laserImpulseProjectile, TurretSocket[curSocket].position,
offset * TurretSocket[curSocket].rotation, null).gameObject;
var proj = newGO.GetComponent<F3DProjectile>();
if (proj)
{
proj.SetOffset(laserImpulseOffset);
}
F3DAudioController.instance.LaserImpulseShot(TurretSocket[curSocket].position);
AdvanceSocket();
}
// Spawn laser pulse weapon impact
public void LaserImpulseImpact(Vector3 pos)
{
F3DPoolManager.Pools["GeneratedPool"].Spawn(laserImpulseImpact, pos, Quaternion.identity, null);
F3DAudioController.instance.LaserImpulseHit(pos);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: d2b82c757a706dd44ad77efcf0d513f4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,81 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DFlameThrower : MonoBehaviour
{
public Light pLight; // Attached point light
public ParticleSystem heat; // Heat particles
int lightState; // Point light state flag (fading in or out)
bool despawn; // Despawn state flag
ParticleSystem ps;
void Start()
{
ps = GetComponent<ParticleSystem>();
}
// OnSpawned called by pool manager
void OnSpawned()
{
despawn = false;
lightState = 1;
pLight.intensity = 0f;
}
// OnDespawned called by pool manager
void OnDespawned()
{
}
// Despawn game object
void OnDespawn()
{
F3DPoolManager.Pools["GeneratedPool"].Despawn(transform);
}
void Update()
{
// Despawn on mouse
if (Input.GetMouseButtonUp(0))
{
if (!despawn)
{
// Set despawn flag and add despawn timer allowing particles fading
despawn = true;
F3DTime.time.AddTimer(1f, 1, OnDespawn);
// Stop the particle systems
ps.Stop();
if (heat)
heat.Stop();
// Toggle light state
pLight.intensity = 0.6f;
lightState = -1;
}
}
// Fade in point light
if (lightState == 1)
{
pLight.intensity = Mathf.Lerp(pLight.intensity, 0.7f, Time.deltaTime*10f);
if (pLight.intensity >= 0.5f)
lightState = 0;
}
// Fade out point light
else if (lightState == -1)
{
pLight.intensity = Mathf.Lerp(pLight.intensity, -0.1f, Time.deltaTime*10f);
if (pLight.intensity <= 0f)
lightState = 0;
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 842145e30d6938c49848dd118ba75ff1
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,225 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
[RequireComponent(typeof (LineRenderer))]
public class F3DLightning : MonoBehaviour
{
public LayerMask layerMask;
public Texture[] BeamFrames; // Animation frame sequence
public float FrameStep; // Animation time
public bool RandomizeFrames; // Randomization of animation frames
public int Points; // How many points should be used to construct the beam
public float MaxBeamLength; // Maximum beam length
public float beamScale; // Default beam scale to be kept over distance
public bool AnimateUV; // UV Animation
public float UVTime; // UV Animation speed
public bool Oscillate; // Beam oscillation flag
public float Amplitude; // Beam amplitude
public float OscillateTime; // Beam oscillation rate
public Transform rayImpact; // Impact transform
public Transform rayMuzzle; // Muzzle flash transform
LineRenderer lineRenderer; // Line rendered component
RaycastHit hitPoint; // Raycast structure
int frameNo; // Frame counter
int FrameTimerID; // Frame timer reference
int OscillateTimerID; // Beam oscillation timer reference
float beamLength; // Current beam length
float initialBeamOffset; // Initial UV offset
void Awake()
{
// Get line renderer component
lineRenderer = GetComponent<LineRenderer>();
// Assign first frame texture
if (!AnimateUV && BeamFrames.Length > 0)
lineRenderer.material.mainTexture = BeamFrames[0];
// Randomize uv offset
initialBeamOffset = Random.Range(0f, 5f);
}
// OnSpawned called by pool manager
void OnSpawned()
{
// Start animation sequence if beam frames array has more than 2 elements
if (BeamFrames.Length > 1)
Animate();
// Start oscillation sequence
if (Oscillate && Points > 0)
OscillateTimerID = F3DTime.time.AddTimer(OscillateTime, OnOscillate);
}
// OnDespawned called by pool manager
void OnDespawned()
{
// Reset frame counter
frameNo = 0;
// Clear frame animation timer
if (FrameTimerID != -1)
{
F3DTime.time.RemoveTimer(FrameTimerID);
FrameTimerID = -1;
}
// Clear oscillation timer
if (OscillateTimerID != -1)
{
F3DTime.time.RemoveTimer(OscillateTimerID);
OscillateTimerID = -1;
}
}
// Hit point calculation
void Raycast()
{
// Prepare structure and create ray
hitPoint = new RaycastHit();
Ray ray = new Ray(transform.position, transform.forward);
// Calculate default beam proportion multiplier based on default scale and maximum length
float propMult = MaxBeamLength*(beamScale/10f);
// Raycast
if (Physics.Raycast(ray, out hitPoint, MaxBeamLength, layerMask))
{
// Get current beam length
beamLength = Vector3.Distance(transform.position, hitPoint.point);
// Update line renderer
if (!Oscillate)
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Calculate default beam proportion multiplier based on default scale and current length
propMult = beamLength*(beamScale/10f);
// Apply hit force to rigidbody
ApplyForce(0.1f);
// Adjust impact effect position
if (rayImpact)
rayImpact.position = hitPoint.point - transform.forward*0.5f;
}
// Nothing was his
else
{
// Set beam to maximum length
beamLength = MaxBeamLength;
// Update beam length
if (!Oscillate)
lineRenderer.SetPosition(1, new Vector3(0f, 0f, beamLength));
// Adjust impact effect position
if (rayImpact)
rayImpact.position = transform.position + transform.forward*beamLength;
}
// Adjust muzzle position
if (rayMuzzle)
rayMuzzle.position = transform.position + transform.forward*0.1f;
// Set beam scaling according to its length
lineRenderer.material.SetTextureScale("_BaseMap", new Vector2(propMult, 1f));
}
// Generate random noise numbers based on amplitude
float GetRandomNoise()
{
return Random.Range(-Amplitude, Amplitude);
}
// Advance texture frame
void OnFrameStep()
{
// Randomize frame counter
if (RandomizeFrames)
frameNo = Random.Range(0, BeamFrames.Length);
// Set current texture frame based on frame counter
lineRenderer.material.mainTexture = BeamFrames[frameNo];
frameNo++;
// Reset frame counter
if (frameNo == BeamFrames.Length)
frameNo = 0;
}
// Oscillate beam
void OnOscillate()
{
// Calculate number of points based on beam length and default number of points
int points = (int) ((beamLength/10f)*Points);
// Update line rendered segments in case number of points less than 2
if (points < 2)
{
// lineRenderer.SetVertexCount(2);
lineRenderer.positionCount = 2;
lineRenderer.SetPosition(0, Vector3.zero);
lineRenderer.SetPosition(1, new Vector3(0, 0, beamLength));
}
// Update line renderer segments
else
{
// Update number of points for line renderer
lineRenderer.positionCount = points;
// Set zero point manually
lineRenderer.SetPosition(0, Vector3.zero);
// Update each point with random noise based on amplitude
for (int i = 1; i < points - 1; i++)
lineRenderer.SetPosition(i,
new Vector3(GetRandomNoise(), GetRandomNoise(), (beamLength/(points - 1))*i));
// Set last point manually
lineRenderer.SetPosition(points - 1, new Vector3(0f, 0f, beamLength));
}
}
// Initialize frame animation
void Animate()
{
// Set current frame
frameNo = 0;
lineRenderer.material.mainTexture = BeamFrames[frameNo];
// Add timer
FrameTimerID = F3DTime.time.AddTimer(FrameStep, OnFrameStep);
frameNo = 1;
}
// Apply force to last hit object
void ApplyForce(float force)
{
if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward*force, hitPoint.point, ForceMode.VelocityChange);
}
void Update()
{
// Animate texture UV
if (AnimateUV)
lineRenderer.material.SetVector("_Offset", new Vector2(Time.time*UVTime + initialBeamOffset, 0f));
// Process raycasting
Raycast();
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: cff0637a442fa1d448d0e544a0a4dd2e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,190 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DMissile : MonoBehaviour
{
public enum MissileType
{
Unguided,
Guided,
Predictive
}
public MissileType missileType;
public Transform target;
public LayerMask layerMask;
public float detonationDistance;
public float lifeTime = 5f; // Missile life time
public float despawnDelay; // Delay despawn in ms
public float velocity = 300f; // Missile velocity
public float alignSpeed = 1f;
public float RaycastAdvance = 2f; // Raycast advance multiplier
public bool DelayDespawn = false; // Missile despawn flag
public ParticleSystem[] delayedParticles; // Array of delayed particles
private ParticleSystem[] particles; // Array of Missile particles
private new Transform transform; // Cached transform
private bool isHit = false; // Missile hit flag
private bool isFXSpawned = false; // Hit FX prefab spawned flag
private float timer = 0f; // Missile timer
private Vector3 targetLastPos;
private Vector3 step;
private MeshRenderer meshRenderer;
public F3DMissileLauncher launcher;
private void Awake()
{
// Cache transform and get all particle systems attached
transform = GetComponent<Transform>();
particles = GetComponentsInChildren<ParticleSystem>();
meshRenderer = GetComponent<MeshRenderer>();
}
// OnSpawned called by pool manager
public void OnSpawned()
{
isHit = false;
isFXSpawned = false;
timer = 0f;
targetLastPos = Vector3.zero;
step = Vector3.zero;
meshRenderer.enabled = true;
}
// OnDespawned called by pool manager
public void OnDespawned()
{
}
// Stop attached particle systems emission and allow them to fade out before despawning
private void Delay()
{
if (particles.Length > 0 && delayedParticles.Length > 0)
{
bool delayed;
for (var i = 0; i < particles.Length; i++)
{
delayed = false;
for (var y = 0; y < delayedParticles.Length; y++)
if (particles[i] == delayedParticles[y])
{
delayed = true;
break;
}
particles[i].Stop(false);
if (!delayed)
particles[i].Clear(false);
}
}
}
// Despawn routine
private void OnMissileDestroy()
{
F3DPoolManager.Pools["GeneratedPool"].Despawn(transform);
}
private void OnHit()
{
meshRenderer.enabled = false;
isHit = true;
// Invoke delay routine if required
if (DelayDespawn)
{
// Reset missile timer and let particles systems stop emitting and fade out correctly
timer = 0f;
Delay();
}
}
private void Update()
{
// If something was hit
if (isHit)
{
// Execute once
if (!isFXSpawned)
{
// Put your calls to effect manager that spawns explosion on hit
// .....
launcher.SpawnExplosion(transform.position);
isFXSpawned = true;
}
// Despawn current missile
if (!DelayDespawn || (DelayDespawn && (timer >= despawnDelay)))
OnMissileDestroy();
}
// No collision occurred yet
else
{
// Navigate
if (target != null)
{
if (missileType == MissileType.Predictive)
{
var hitPos = F3DPredictTrajectory.Predict(transform.position, target.position, targetLastPos,
velocity);
targetLastPos = target.position;
transform.rotation = Quaternion.Lerp(transform.rotation,
Quaternion.LookRotation(hitPos - transform.position), Time.deltaTime*alignSpeed);
}
else if (missileType == MissileType.Guided)
{
transform.rotation = Quaternion.Lerp(transform.rotation,
Quaternion.LookRotation(target.position - transform.position), Time.deltaTime*alignSpeed);
}
}
// Missile step per frame based on velocity and time
step = transform.forward*Time.deltaTime*velocity;
if (target != null && missileType != MissileType.Unguided &&
Vector3.SqrMagnitude(transform.position - target.position) <= detonationDistance)
{
OnHit();
}
else if (missileType == MissileType.Unguided &&
Physics.Raycast(transform.position, transform.forward, step.magnitude*RaycastAdvance, layerMask))
{
OnHit();
}
// Nothing hit
else
{
// Despawn missile at the end of life cycle
if (timer >= lifeTime)
{
// Do not detonate
isFXSpawned = true;
OnHit();
}
}
// Advances missile forward
transform.position += step;
}
// Updates missile timer
timer += Time.deltaTime;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2eb81a48b708c7d4586ad5144351d65f
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,33 @@
using UnityEngine;
namespace FORGE3D
{
public static class F3DPredictTrajectory
{
public static Vector3 Predict(Vector3 sPos, Vector3 tPos, Vector3 tLastPos, float pSpeed)
{
// Target velocity
var tVel = (tPos - tLastPos) / Time.deltaTime;
// Time to reach the target
var flyTime = GetProjFlightTime(tPos - sPos, tVel, pSpeed);
if (flyTime > 0)
return tPos + flyTime * tVel;
return tPos;
}
private static float GetProjFlightTime(Vector3 dist, Vector3 tVel, float pSpeed)
{
var a = Vector3.Dot(tVel, tVel) - pSpeed * pSpeed;
var b = 2.0f * Vector3.Dot(tVel, dist);
var c = Vector3.Dot(dist, dist);
var det = b * b - 4 * a * c;
if (det > 0)
return 2 * c / (Mathf.Sqrt(det) - b);
return -1;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 681169f10d4a7a64a9d696b62d2f5946
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,171 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DProjectile : MonoBehaviour
{
public F3DFXType fxType; // Weapon type
public LayerMask layerMask;
public float lifeTime = 5f; // Projectile life time
public float despawnDelay; // Delay despawn in ms
public float velocity = 300f; // Projectile velocity
public float RaycastAdvance = 2f; // Raycast advance multiplier
public bool DelayDespawn = false; // Projectile despawn flag
public ParticleSystem[] delayedParticles; // Array of delayed particles
ParticleSystem[] particles; // Array of projectile particles
new Transform transform; // Cached transform
RaycastHit hitPoint; // Raycast structure
bool isHit = false; // Projectile hit flag
bool isFXSpawned = false; // Hit FX prefab spawned flag
float timer = 0f; // Projectile timer
float fxOffset; // Offset of fxImpact
void Awake()
{
// Cache transform and get all particle systems attached
transform = GetComponent<Transform>();
particles = GetComponentsInChildren<ParticleSystem>();
}
// OnSpawned called by pool manager
public void OnSpawned()
{
// Reset flags and raycast structure
isHit = false;
isFXSpawned = false;
timer = 0f;
hitPoint = new RaycastHit();
}
// OnDespawned called by pool manager
public void OnDespawned()
{
}
// Stop attached particle systems emission and allow them to fade out before despawning
void Delay()
{
if (particles.Length > 0 && delayedParticles.Length > 0)
{
bool delayed;
for (int i = 0; i < particles.Length; i++)
{
delayed = false;
for (int y = 0; y < delayedParticles.Length; y++)
if (particles[i] == delayedParticles[y])
{
delayed = true;
break;
}
particles[i].Stop(false);
if (!delayed)
particles[i].Clear(false);
}
}
}
// OnDespawned called by pool manager
void OnProjectileDestroy()
{
F3DPoolManager.Pools["GeneratedPool"].Despawn(transform);
}
// Apply hit force on impact
void ApplyForce(float force)
{
if (hitPoint.rigidbody != null)
hitPoint.rigidbody.AddForceAtPosition(transform.forward * force, hitPoint.point,
ForceMode.VelocityChange);
}
void Update()
{
// If something was hit
if (isHit)
{
// Execute once
if (!isFXSpawned)
{
// Invoke corresponding method that spawns FX
switch (fxType)
{
case F3DFXType.Vulcan:
F3DFXController.instance.VulcanImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(2.5f);
break;
case F3DFXType.SoloGun:
F3DFXController.instance.SoloGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case F3DFXType.Seeker:
F3DFXController.instance.SeekerImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(30f);
break;
case F3DFXType.PlasmaGun:
F3DFXController.instance.PlasmaGunImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
case F3DFXType.LaserImpulse:
F3DFXController.instance.LaserImpulseImpact(hitPoint.point + hitPoint.normal * fxOffset);
ApplyForce(25f);
break;
}
isFXSpawned = true;
}
// Despawn current projectile
if (!DelayDespawn || (DelayDespawn && (timer >= despawnDelay)))
OnProjectileDestroy();
}
// No collision occurred yet
else
{
// Projectile step per frame based on velocity and time
Vector3 step = transform.forward * Time.deltaTime * velocity;
// Raycast for targets with ray length based on frame step by ray cast advance multiplier
if (Physics.Raycast(transform.position, transform.forward, out hitPoint,
step.magnitude * RaycastAdvance,
layerMask))
{
isHit = true;
// Invoke delay routine if required
if (DelayDespawn)
{
// Reset projectile timer and let particles systems stop emitting and fade out correctly
timer = 0f;
Delay();
}
}
// Nothing hit
else
{
// Projectile despawn after run out of time
if (timer >= lifeTime)
OnProjectileDestroy();
}
// Advances projectile forward
transform.position += step;
}
// Updates projectile timer
timer += Time.deltaTime;
}
//Set offset
public void SetOffset(float offset)
{
fxOffset = offset;
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71d84e8c92ffdf1438c9798f91d60981
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,112 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DPulsewave : MonoBehaviour
{
public float FadeOutDelay; // Color fade delay in ms
public float FadeOutTime; // Color fade speed
public float ScaleTime; // Scaling speed
public Vector3 ScaleSize; // The size wave will be scaled to
public bool DebugLoop; // Constant looping flag mainly used in preview scene
new Transform transform; // Cached transform
MeshRenderer meshRenderer; // Cached mesh renderer
int timerID = -1; // Timer reference
bool isFadeOut; // Fading flag
bool isEnabled; // Enabled flag
Color defaultColor; // Default wave color
Color color; // Current wave color
int tintColorRef; // Shader property reference
void Awake()
{
// Cache components
transform = GetComponent<Transform>();
meshRenderer = GetComponent<MeshRenderer>();
// Get shader property
tintColorRef = Shader.PropertyToID("_Color");
// Store default color
defaultColor = meshRenderer.material.GetColor(tintColorRef);
}
void Start()
{
// Fire up manually
if (DebugLoop)
OnSpawned();
}
// OnSpawned called by pool manager
void OnSpawned()
{
// Set scale to zero
transform.localScale = new Vector3(0f, 0f, 0f);
// Set required flags and set delayed fade flag using timer
isEnabled = true;
isFadeOut = false;
timerID = F3DTime.time.AddTimer(FadeOutDelay, OnFadeOut);
// Reset default color
meshRenderer.material.SetColor(tintColorRef, defaultColor);
color = defaultColor;
}
// OnDespawned called by pool manager
void OnDespawned()
{
// Remove timer
if (timerID >= 0)
{
F3DTime.time.RemoveTimer(timerID);
timerID = -1;
}
}
// Toggle fading state
void OnFadeOut()
{
isFadeOut = true;
}
void Update()
{
// Enabled state
if (isEnabled)
{
// Scale the wave
transform.localScale = Vector3.Lerp(transform.localScale, ScaleSize, Time.deltaTime*ScaleTime);
// Check the fading state
if (isFadeOut)
{
// Lerp color and update the shader
color = Color.Lerp(color, new Color(0, 0, 0, -0.1f), Time.deltaTime*FadeOutTime);
meshRenderer.material.SetColor(tintColorRef, color);
// Make sure alpha value is not overshooting
if (color.a <= 0f)
{
// Disable the update loop
isEnabled = false;
// Reset the sequence in case of the debug loop flag
if (DebugLoop)
{
OnDespawned();
OnSpawned();
}
}
}
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5b203429db6b687449eae99800566219
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,33 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DRandomize : MonoBehaviour
{
private new Transform transform; // Cached transform
private Vector3 defaultScale; // Default scale
public bool RandomScale, RandomRotation; // Randomize flags
public float MinScale, MaxScale; // Min/Max scale range
public float MinRotation, MaxRotaion; // Min/Max rotation range
void Awake()
{
// Store transform component and default scale
transform = GetComponent<Transform>();
defaultScale = transform.localScale;
}
// Randomize scale and rotation according to the values set in the inspector
void OnEnable()
{
if (RandomScale)
transform.localScale = defaultScale*Random.Range(MinScale, MaxScale);
if (RandomRotation)
transform.rotation *= Quaternion.Euler(0, 0, Random.Range(MinRotation, MaxRotaion));
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a5df3c5f0444ba74991107c0d882530e
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DRift : MonoBehaviour
{
public float RotationSpeed;
public float MorphSpeed, MorphFactor;
Vector3 dScale;
// Use this for initialization
void Start()
{
dScale = transform.localScale;
}
// Update is called once per frame
void Update()
{
transform.rotation = transform.rotation*Quaternion.Euler(0, 0, RotationSpeed*Time.deltaTime);
transform.localScale = new Vector3(dScale.x, dScale.y,
dScale.z + Mathf.Sin(Time.time*MorphSpeed)*MorphFactor);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 71916944db778864d8f45c7c0b018d86
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,36 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace FORGE3D
{
public class F3DShotgun : MonoBehaviour
{
private readonly List<ParticleCollisionEvent> _collisionEvents = new List<ParticleCollisionEvent>();
private ParticleSystem _ps;
private void Start()
{
_ps = GetComponent<ParticleSystem>();
}
// On particle collision
private void OnParticleCollision(GameObject other)
{
var numCollisionEvents = _ps.GetCollisionEvents(other, _collisionEvents);
// Play collision sound and apply force to the rigidbody was hit
for (var j = 0; j < numCollisionEvents; j++)
{
F3DAudioController.instance.ShotGunHit(_collisionEvents[j].intersection);
var rb = other.GetComponent<Rigidbody>();
if (!rb) continue;
var pos = _collisionEvents[j].intersection;
var force = _collisionEvents[j].velocity.normalized * 50f;
rb.AddForceAtPosition(force, pos);
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5d5fe4243ee50ba4b9c493fe0fd51183
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,142 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System;
namespace FORGE3D
{
public class F3DTime : MonoBehaviour
{
public static F3DTime time;
// Timer objects
List<Timer> timers;
// Timer removal queue
List<int> removalPending;
private int idCounter;
/// <summary>
/// Timer entity class
/// </summary>
class Timer
{
public int id;
public bool isActive;
public float rate;
public int ticks;
public int ticksElapsed;
public float last;
public Action callBack;
public Timer(int id_, float rate_, int ticks_, Action callback_)
{
id = id_;
rate = rate_ < 0 ? 0 : rate_;
ticks = ticks_ < 0 ? 0 : ticks_;
callBack = callback_;
last = 0;
ticksElapsed = 0;
isActive = true;
}
public void Tick()
{
last += Time.deltaTime;
if (isActive && last >= rate)
{
last = 0;
ticksElapsed++;
callBack.Invoke();
if (ticks > 0 && ticks == ticksElapsed)
{
isActive = false;
F3DTime.time.RemoveTimer(id);
}
}
}
}
/// <summary>
/// Awake
/// </summary>
void Awake()
{
time = this;
timers = new List<Timer>();
removalPending = new List<int>();
}
/// <summary>
/// Creates new timer
/// </summary>
/// <param name="rate">Tick rate</param>
/// <param name="callBack">Callback method</param>
/// <returns>Time GUID</returns>
public int AddTimer(float rate, Action callBack)
{
return AddTimer(rate, 0, callBack);
}
/// <summary>
/// Creates new timer
/// </summary>
/// <param name="rate">Tick rate</param>
/// <param name="ticks">Number of ticks before timer removal</param>
/// <param name="callBack">Callback method</param>
/// <returns>Timer GUID</returns>
public int AddTimer(float rate, int ticks, Action callBack)
{
Timer newTimer = new Timer(++idCounter, rate, ticks, callBack);
timers.Add(newTimer);
return newTimer.id;
}
/// <summary>
/// Removes timer
/// </summary>
/// <param name="timerId">Timer GUID</param>
public void RemoveTimer(int timerId)
{
removalPending.Add(timerId);
}
/// <summary>
/// Timer removal queue handler
/// </summary>
void Remove()
{
if (removalPending.Count > 0)
{
foreach (int id in removalPending)
for (int i = 0; i < timers.Count; i++)
if (timers[i].id == id)
{
timers.RemoveAt(i);
break;
}
removalPending.Clear();
}
}
/// <summary>
/// Updates timers
/// </summary>
void Tick()
{
for (int i = 0; i < timers.Count; i++)
timers[i].Tick();
}
// Update is called once per frame
void Update()
{
Remove();
Tick();
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 5309af59ecdc1064aa93cd2541329379
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: -500
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,66 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DWarpJump : MonoBehaviour
{
public ParticleSystem WarpSpark;
public Transform ShipPos;
public float ShipJumpSpeed;
public Vector3 ShipJumpStartPoint;
public Vector3 ShipJumpEndPoint;
public bool SendOnSpawned;
public bool DebugLoop;
private bool isWarping;
// Use this for initialization
private void Start()
{
if (SendOnSpawned)
BroadcastMessage("OnSpawned", SendMessageOptions.DontRequireReceiver);
if (DebugLoop)
F3DTime.time.AddTimer(4, Reset);
}
private void Reset()
{
BroadcastMessage("OnSpawned", SendMessageOptions.DontRequireReceiver);
var psys = GetComponentsInChildren<ParticleSystem>();
foreach (var p in psys)
{
p.Stop(true);
p.Play(true);
}
}
public void OnSpawned()
{
isWarping = false;
WarpSpark.transform.localPosition = ShipJumpStartPoint;
ShipPos.position = WarpSpark.transform.position;
F3DTime.time.AddTimer(3, 1, OnWarp);
}
private void OnWarp()
{
isWarping = true;
}
private void ShiftShipPosition()
{
WarpSpark.transform.localPosition = Vector3.Lerp(WarpSpark.transform.localPosition, ShipJumpEndPoint,
Time.deltaTime * ShipJumpSpeed);
ShipPos.position = WarpSpark.transform.position;
}
private void Update()
{
if (isWarping)
ShiftShipPosition();
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0236143663ac56b49997791c5dde49a4
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,64 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DWarpJumpTunnel : MonoBehaviour
{
private new Transform transform;
private MeshRenderer meshRenderer;
public float StartDelay, FadeDelay;
public Vector3 ScaleTo;
public float ScaleTime;
public float ColorTime, ColorFadeTime;
public float RotationSpeed;
private bool grow;
private float alpha;
private int alphaID;
private void Awake()
{
transform = GetComponent<Transform>();
meshRenderer = GetComponent<MeshRenderer>();
alphaID = Shader.PropertyToID("_Alpha");
}
public void OnSpawned()
{
grow = false;
meshRenderer.material.SetFloat(alphaID, 0);
F3DTime.time.AddTimer(StartDelay, 1, ToggleGrow);
F3DTime.time.AddTimer(FadeDelay, 1, ToggleGrow);
transform.localScale = new Vector3(1f, 1f, 1f);
transform.localRotation = transform.localRotation * Quaternion.Euler(0, 0, Random.Range(-360, 360));
}
private void ToggleGrow()
{
grow = !grow;
}
// Update is called once per frame
private void Update()
{
transform.Rotate(0f, 0f, RotationSpeed * Time.deltaTime);
if (grow)
{
transform.localScale = Vector3.Lerp(transform.localScale, ScaleTo, Time.deltaTime * ScaleTime);
alpha = Mathf.Lerp(alpha, 1, Time.deltaTime * ColorTime);
meshRenderer.material.SetFloat(alphaID, alpha);
}
else
{
alpha = Mathf.Lerp(alpha, 0, Time.deltaTime * ColorFadeTime);
meshRenderer.material.SetFloat(alphaID, alpha);
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 579b0f7f37f7a0f4ea9b8ecc4c9dca5d
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {fileID: 2800000, guid: 0971f0a29c2b08d45a19d99b97b61974, type: 3}
userData:

View File

@ -0,0 +1,34 @@
using UnityEngine;
using System.Collections;
namespace FORGE3D
{
public class F3DWarpTunnel : MonoBehaviour
{
public float RotationFactor = 0.1f;
public float MinTick = 1f, MaxTick = 2f;
private float angle;
// Use this for initialization
private void Start()
{
StartCoroutine(RandomDirection());
}
private IEnumerator RandomDirection()
{
while (true)
{
angle = Random.Range(-360, 360);
yield return new WaitForSeconds(Random.Range(MinTick, MaxTick));
}
}
// Update is called once per frame
private void Update()
{
transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.Euler(0, 0, angle),
Time.deltaTime * RotationFactor);
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 99edf0380ccd8584a95df9f7126f0424
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 048409e56e71a3949adf1bb716d063ec
folderAsset: yes
timeCreated: 1470146167
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
using System;
namespace FORGE3D
{
public class F3DMath : MonoBehaviour
{
//Projects a vector onto a plane. The output is not normalized.
public static Vector3 ProjectVectorOnPlane(Vector3 planeNormal, Vector3 vector)
{
return vector - (Vector3.Dot(vector, planeNormal)*planeNormal);
}
public static float SignedVectorAngle(Vector3 referenceVector, Vector3 otherVector, Vector3 normal)
{
Vector3 perpVector;
float angle;
//Use the geometry object normal and one of the input vectors to calculate the perpendicular vector
perpVector = Vector3.Cross(normal, referenceVector);
//Now calculate the dot product between the perpendicular vector (perpVector) and the other input vector
angle = Vector3.Angle(referenceVector, otherVector);
angle *= Mathf.Sign(Vector3.Dot(perpVector, otherVector));
return angle;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 766b03b0bcef2124dbe7b671e2f317c0
timeCreated: 1466535798
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,5 @@
fileFormatVersion: 2
guid: cb3d0a01b2cd1104da44be8bcef8d641
folderAsset: yes
DefaultImporter:
userData:

View File

@ -0,0 +1,94 @@
using UnityEngine;
using System.Collections;
/*
Attach this script as a parent to some game objects. The script will then combine the meshes at startup.
This is useful as a performance optimization since it is faster to render one big mesh than many small meshes. See the docs on graphics performance optimization for more info.
Different materials will cause multiple meshes to be created, thus it is useful to share as many textures/material as you can.
*/
[AddComponentMenu("Mesh/Combine Children")]
public class CombineChildren : MonoBehaviour
{
/// Usually rendering with triangle strips is faster.
/// However when combining objects with very low triangle counts, it can be faster to use triangles.
/// Best is to try out which value is faster in practice.
public bool generateTriangleStrips = true;
/// This option has a far longer preprocessing time at startup but leads to better runtime performance.
void Start()
{
Component[] filters = GetComponentsInChildren(typeof(MeshFilter));
Matrix4x4 myTransform = transform.worldToLocalMatrix;
Hashtable materialToMesh = new Hashtable();
for (int i = 0; i < filters.Length; i++)
{
MeshFilter filter = (MeshFilter)filters[i];
Renderer curRenderer = filters[i].GetComponent<Renderer>();
MeshCombineUtility.MeshInstance instance = new MeshCombineUtility.MeshInstance();
instance.mesh = filter.sharedMesh;
if (curRenderer != null && curRenderer.enabled && instance.mesh != null)
{
instance.transform = myTransform * filter.transform.localToWorldMatrix;
Material[] materials = curRenderer.sharedMaterials;
for (int m = 0; m < materials.Length; m++)
{
instance.subMeshIndex = System.Math.Min(m, instance.mesh.subMeshCount - 1);
ArrayList objects = (ArrayList)materialToMesh[materials[m]];
if (objects != null)
{
objects.Add(instance);
}
else
{
objects = new ArrayList();
objects.Add(instance);
materialToMesh.Add(materials[m], objects);
}
}
curRenderer.enabled = false;
}
}
foreach (DictionaryEntry de in materialToMesh)
{
ArrayList elements = (ArrayList)de.Value;
MeshCombineUtility.MeshInstance[] instances = (MeshCombineUtility.MeshInstance[])elements.ToArray(typeof(MeshCombineUtility.MeshInstance));
// We have a maximum of one material, so just attach the mesh to our own game object
if (materialToMesh.Count == 1)
{
// Make sure we have a mesh filter & renderer
if (GetComponent(typeof(MeshFilter)) == null)
gameObject.AddComponent(typeof(MeshFilter));
if (!GetComponent<MeshRenderer>())
gameObject.AddComponent<MeshRenderer>();
MeshFilter filter = (MeshFilter)GetComponent(typeof(MeshFilter));
filter.mesh = MeshCombineUtility.Combine(instances, generateTriangleStrips);
GetComponent<Renderer>().material = (Material)de.Key;
GetComponent<Renderer>().enabled = true;
}
// We have multiple materials to take care of, build one mesh / gameobject for each material
// and parent it to this object
else
{
GameObject go = new GameObject("Combined mesh");
go.transform.parent = transform;
go.transform.localScale = Vector3.one;
go.transform.localRotation = Quaternion.identity;
go.transform.localPosition = Vector3.zero;
go.AddComponent(typeof(MeshFilter));
go.AddComponent<MeshRenderer>();
go.GetComponent<Renderer>().material = (Material)de.Key;
MeshFilter filter = (MeshFilter)go.GetComponent(typeof(MeshFilter));
filter.mesh = MeshCombineUtility.Combine(instances, generateTriangleStrips);
}
}
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c3c375da1a5b59e4db0156e0b024181c
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -0,0 +1,224 @@
using UnityEngine;
using System.Collections;
public class MeshCombineUtility
{
public struct MeshInstance
{
public Mesh mesh;
public int subMeshIndex;
public Matrix4x4 transform;
}
public static Mesh Combine(MeshInstance[] combines, bool generateStrips)
{
int vertexCount = 0;
int triangleCount = 0;
int stripCount = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
{
vertexCount += combine.mesh.vertexCount;
if (generateStrips)
{
// SUBOPTIMAL FOR PERFORMANCE
int curStripCount = combine.mesh.GetTriangles(combine.subMeshIndex).Length;
if (curStripCount != 0)
{
if (stripCount != 0)
{
if ((stripCount & 1) == 1)
stripCount += 3;
else
stripCount += 2;
}
stripCount += curStripCount;
}
else
{
generateStrips = false;
}
}
}
}
// Precomputed how many triangles we need instead
if (!generateStrips)
{
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
{
triangleCount += combine.mesh.GetTriangles(combine.subMeshIndex).Length;
}
}
}
Vector3[] vertices = new Vector3[vertexCount];
Vector3[] normals = new Vector3[vertexCount];
Vector4[] tangents = new Vector4[vertexCount];
Vector2[] uv = new Vector2[vertexCount];
Vector2[] uv1 = new Vector2[vertexCount];
Color[] colors = new Color[vertexCount];
int[] triangles = new int[triangleCount];
int[] strip = new int[stripCount];
int offset;
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
Copy(combine.mesh.vertexCount, combine.mesh.vertices, vertices, ref offset, combine.transform);
}
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
{
Matrix4x4 invTranspose = combine.transform;
invTranspose = invTranspose.inverse.transpose;
CopyNormal(combine.mesh.vertexCount, combine.mesh.normals, normals, ref offset, invTranspose);
}
}
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
{
Matrix4x4 invTranspose = combine.transform;
invTranspose = invTranspose.inverse.transpose;
CopyTangents(combine.mesh.vertexCount, combine.mesh.tangents, tangents, ref offset, invTranspose);
}
}
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
Copy(combine.mesh.vertexCount, combine.mesh.uv, uv, ref offset);
}
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
Copy(combine.mesh.vertexCount, combine.mesh.uv2, uv1, ref offset);
}
offset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
CopyColors(combine.mesh.vertexCount, combine.mesh.colors, colors, ref offset);
}
int triangleOffset = 0;
int stripOffset = 0;
int vertexOffset = 0;
foreach (MeshInstance combine in combines)
{
if (combine.mesh)
{
if (generateStrips)
{
int[] inputstrip = combine.mesh.GetTriangles(combine.subMeshIndex);
if (stripOffset != 0)
{
if ((stripOffset & 1) == 1)
{
strip[stripOffset + 0] = strip[stripOffset - 1];
strip[stripOffset + 1] = inputstrip[0] + vertexOffset;
strip[stripOffset + 2] = inputstrip[0] + vertexOffset;
stripOffset += 3;
}
else
{
strip[stripOffset + 0] = strip[stripOffset - 1];
strip[stripOffset + 1] = inputstrip[0] + vertexOffset;
stripOffset += 2;
}
}
for (int i = 0; i < inputstrip.Length; i++)
{
strip[i + stripOffset] = inputstrip[i] + vertexOffset;
}
stripOffset += inputstrip.Length;
}
else
{
int[] inputtriangles = combine.mesh.GetTriangles(combine.subMeshIndex);
for (int i = 0; i < inputtriangles.Length; i++)
{
triangles[i + triangleOffset] = inputtriangles[i] + vertexOffset;
}
triangleOffset += inputtriangles.Length;
}
vertexOffset += combine.mesh.vertexCount;
}
}
Mesh mesh = new Mesh();
mesh.name = "Combined Mesh";
mesh.vertices = vertices;
mesh.normals = normals;
mesh.colors = colors;
mesh.uv = uv;
mesh.uv2 = uv1;
mesh.tangents = tangents;
if (generateStrips)
mesh.SetTriangles(strip, 0);
else
mesh.triangles = triangles;
return mesh;
}
static void Copy(int vertexcount, Vector3[] src, Vector3[] dst, ref int offset, Matrix4x4 transform)
{
for (int i = 0; i < src.Length; i++)
dst[i + offset] = transform.MultiplyPoint(src[i]);
offset += vertexcount;
}
static void CopyNormal(int vertexcount, Vector3[] src, Vector3[] dst, ref int offset, Matrix4x4 transform)
{
for (int i = 0; i < src.Length; i++)
dst[i + offset] = transform.MultiplyVector(src[i]).normalized;
offset += vertexcount;
}
static void Copy(int vertexcount, Vector2[] src, Vector2[] dst, ref int offset)
{
for (int i = 0; i < src.Length; i++)
dst[i + offset] = src[i];
offset += vertexcount;
}
static void CopyColors(int vertexcount, Color[] src, Color[] dst, ref int offset)
{
for (int i = 0; i < src.Length; i++)
dst[i + offset] = src[i];
offset += vertexcount;
}
static void CopyTangents(int vertexcount, Vector4[] src, Vector4[] dst, ref int offset, Matrix4x4 transform)
{
for (int i = 0; i < src.Length; i++)
{
Vector4 p4 = src[i];
Vector3 p = new Vector3(p4.x, p4.y, p4.z);
p = transform.MultiplyVector(p).normalized;
dst[i + offset] = new Vector4(p.x, p.y, p.z, p4.w);
}
offset += vertexcount;
}
}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: ff84002b1be31b9479168867949053c9
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

Some files were not shown because too many files have changed in this diff Show More