Upload from upload_mods.ps1
This commit is contained in:
68
KFAttached/FPSPack/Demo/FPSDemoGUI.cs
Normal file
68
KFAttached/FPSPack/Demo/FPSDemoGUI.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FPSDemoGUI : MonoBehaviour
|
||||
{
|
||||
public GameObject[] Prefabs;
|
||||
public Transform muzzleFlashPoint;
|
||||
public GameObject Gun;
|
||||
public float reactivateTime = 4;
|
||||
public Light Sun;
|
||||
|
||||
private int currentNomber;
|
||||
private GameObject currentInstance;
|
||||
private GUIStyle guiStyleHeader = new GUIStyle();
|
||||
private float sunIntensity;
|
||||
float dpiScale;
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
if (Screen.dpi < 1) dpiScale = 1;
|
||||
if (Screen.dpi < 200) dpiScale = 1;
|
||||
else dpiScale = Screen.dpi / 200f;
|
||||
guiStyleHeader.fontSize = (int)(15f * dpiScale);
|
||||
guiStyleHeader.normal.textColor = new Color(0.15f, 0.15f, 0.15f);
|
||||
currentInstance = Instantiate(Prefabs[currentNomber], transform.position, transform.rotation) as GameObject;
|
||||
var reactivator = currentInstance.AddComponent<FPSDemoReactivator>();
|
||||
reactivator.TimeDelayToReactivate = reactivateTime;
|
||||
sunIntensity = Sun.intensity;
|
||||
}
|
||||
|
||||
private void OnGUI()
|
||||
{
|
||||
if (GUI.Button(new Rect(10 * dpiScale, 15 * dpiScale, 135 * dpiScale, 37 * dpiScale), "PREVIOUS EFFECT"))
|
||||
{
|
||||
ChangeCurrent(-1);
|
||||
}
|
||||
if (GUI.Button(new Rect(160 * dpiScale, 15 * dpiScale, 135 * dpiScale, 37 * dpiScale), "NEXT EFFECT"))
|
||||
{
|
||||
ChangeCurrent(+1);
|
||||
}
|
||||
sunIntensity = GUI.HorizontalSlider(new Rect(10 * dpiScale, 70 * dpiScale, 285 * dpiScale, 15 * dpiScale), sunIntensity, 0, 0.6f);
|
||||
Sun.intensity = sunIntensity;
|
||||
GUI.Label(new Rect(300 * dpiScale, 70 * dpiScale, 30 * dpiScale, 30 * dpiScale), "SUN INTENSITY", guiStyleHeader);
|
||||
GUI.Label(new Rect(400 * dpiScale, 15 * dpiScale, 100 * dpiScale, 20 * dpiScale), "Prefab name is \"" + Prefabs[currentNomber].name + "\" \r\nHold any mouse button that would move the camera", guiStyleHeader);
|
||||
}
|
||||
// Update is called once per frame
|
||||
void ChangeCurrent(int delta)
|
||||
{
|
||||
currentNomber += delta;
|
||||
if (currentNomber > Prefabs.Length - 1)
|
||||
currentNomber = 0;
|
||||
else if (currentNomber < 0)
|
||||
currentNomber = Prefabs.Length - 1;
|
||||
if (currentInstance != null) Destroy(currentInstance);
|
||||
if (currentNomber < 10)
|
||||
{
|
||||
currentInstance = Instantiate(Prefabs[currentNomber], transform.position, transform.rotation) as GameObject;
|
||||
Gun.SetActive(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
currentInstance = Instantiate(Prefabs[currentNomber], muzzleFlashPoint.position, muzzleFlashPoint.rotation) as GameObject;
|
||||
Gun.SetActive(true);
|
||||
}
|
||||
var reactivator = currentInstance.AddComponent<FPSDemoReactivator>();
|
||||
reactivator.TimeDelayToReactivate = reactivateTime;
|
||||
}
|
||||
}
|
||||
11
KFAttached/FPSPack/Demo/FPSDemoGUI.cs.meta
Normal file
11
KFAttached/FPSPack/Demo/FPSDemoGUI.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7f44a7ad42765c94b896425517325f1a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
19
KFAttached/FPSPack/Demo/FPSDemoReactivator.cs
Normal file
19
KFAttached/FPSPack/Demo/FPSDemoReactivator.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FPSDemoReactivator : MonoBehaviour
|
||||
{
|
||||
|
||||
public float StartDelay = 0;
|
||||
public float TimeDelayToReactivate = 3;
|
||||
|
||||
void Start()
|
||||
{
|
||||
InvokeRepeating("Reactivate", StartDelay, TimeDelayToReactivate);
|
||||
}
|
||||
|
||||
void Reactivate()
|
||||
{
|
||||
gameObject.SetActive(false);
|
||||
gameObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
11
KFAttached/FPSPack/Demo/FPSDemoReactivator.cs.meta
Normal file
11
KFAttached/FPSPack/Demo/FPSDemoReactivator.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77e369a1e74c2d84ead64ef026b1c433
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
KFAttached/FPSPack/Demo/FPSFireManager.cs
Normal file
49
KFAttached/FPSPack/Demo/FPSFireManager.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class FPSFireManager : MonoBehaviour
|
||||
{
|
||||
public ImpactInfo[] ImpactElemets = new ImpactInfo[0];
|
||||
public float BulletDistance = 100;
|
||||
public GameObject ImpactEffect;
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (Input.GetMouseButtonDown(0))
|
||||
{
|
||||
RaycastHit hit;
|
||||
var ray = new Ray(transform.position, transform.forward);
|
||||
if (Physics.Raycast(ray, out hit, BulletDistance))
|
||||
{
|
||||
var effect = GetImpactEffect(hit.transform.gameObject);
|
||||
if (effect == null)
|
||||
return;
|
||||
var effectIstance = Instantiate(effect, hit.point, new Quaternion()) as GameObject;
|
||||
ImpactEffect.SetActive(false);
|
||||
ImpactEffect.SetActive(true);
|
||||
effectIstance.transform.LookAt(hit.point + hit.normal);
|
||||
Destroy(effectIstance, 4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
[System.Serializable]
|
||||
public class ImpactInfo
|
||||
{
|
||||
public MaterialType.MaterialTypeEnum MaterialType;
|
||||
public GameObject ImpactEffect;
|
||||
}
|
||||
|
||||
GameObject GetImpactEffect(GameObject impactedGameObject)
|
||||
{
|
||||
var materialType = impactedGameObject.GetComponent<MaterialType>();
|
||||
if (materialType == null)
|
||||
return null;
|
||||
foreach (var impactInfo in ImpactElemets)
|
||||
{
|
||||
if (impactInfo.MaterialType == materialType.TypeOfMaterial)
|
||||
return impactInfo.ImpactEffect;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
11
KFAttached/FPSPack/Demo/FPSFireManager.cs.meta
Normal file
11
KFAttached/FPSPack/Demo/FPSFireManager.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eabaea637d046b649916223ab9952a50
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
22
KFAttached/FPSPack/Demo/MouseLock.cs
Normal file
22
KFAttached/FPSPack/Demo/MouseLock.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using UnityEngine;
|
||||
|
||||
public class MouseLock : MonoBehaviour
|
||||
{
|
||||
|
||||
// Use this for initialization
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
#if UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_5 || UNITY_4_6
|
||||
Screen.lockCursor = true;
|
||||
#else
|
||||
Cursor.visible = false;
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
11
KFAttached/FPSPack/Demo/MouseLock.cs.meta
Normal file
11
KFAttached/FPSPack/Demo/MouseLock.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fc19b6a3661472848bf60b7ac730c242
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user