initial commit
This commit is contained in:
28
Assets/Tools/CameraZoom.cs
Normal file
28
Assets/Tools/CameraZoom.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FastArena
|
||||
{
|
||||
public class CameraZoom : MonoBehaviour
|
||||
{
|
||||
[HideInInspector] public bool Zoomed;
|
||||
private PlayerController playerC;
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
playerC = GetComponentInParent<PlayerController>();
|
||||
}
|
||||
|
||||
public void Zoom(float zoom)
|
||||
{
|
||||
}
|
||||
|
||||
public IEnumerator ZoomCoroutine(float zoom, float zoomTime)
|
||||
{
|
||||
float targetFOV = playerC.Settings.FieldOfView / zoom;
|
||||
playerC.mouseSens = playerC.Settings.MouseSensivity / zoom;
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Tools/CameraZoom.cs.meta
Normal file
11
Assets/Tools/CameraZoom.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f648910f322ee0d48b646f899671bc56
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
84
Assets/Tools/Gun.cs
Normal file
84
Assets/Tools/Gun.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using JetBrains.Annotations;
|
||||
using UnityEngine;
|
||||
|
||||
namespace FastArena
|
||||
{
|
||||
public class Gun : Tool
|
||||
{
|
||||
public int Damage;
|
||||
public float Accuracy;
|
||||
public bool Auto;
|
||||
public uint FireRate; //shots per minute
|
||||
public uint BulletsPerShot;
|
||||
public GameObject ImpactEffect;
|
||||
public float ImpactForce;
|
||||
|
||||
private Player player;
|
||||
private float shotLatency;
|
||||
private bool ready = true;
|
||||
|
||||
[CanBeNull] private CameraZoom camZoom;
|
||||
private bool zoomed;
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
shotLatency = 60f / FireRate;
|
||||
player = GetComponentInParent<Player>() ?? throw new Exception("can't find Player component");
|
||||
camZoom = GetComponentInParent<CameraZoom>();
|
||||
|
||||
}
|
||||
|
||||
public override void Use0()
|
||||
{
|
||||
if (!ready) return;
|
||||
StartCoroutine(ShootCoroutine());
|
||||
}
|
||||
|
||||
IEnumerator ShootCoroutine()
|
||||
{
|
||||
//Debug.Log("shot");
|
||||
ready = false;
|
||||
var sound = GetComponent<AudioSource>();
|
||||
if(sound != null)
|
||||
sound.Play();
|
||||
Vector3 shotVector = player.CameraPoint.transform.forward;
|
||||
if (Physics.Raycast( player.CameraPoint.transform.position, shotVector, out RaycastHit hit, 1000f))
|
||||
{
|
||||
GameObject target = hit.collider.gameObject;
|
||||
if (ImpactEffect != null)
|
||||
Instantiate(ImpactEffect, hit.point, hit.transform.rotation);
|
||||
if (hit.rigidbody != null)
|
||||
hit.rigidbody.AddForce(shotVector * ImpactForce, ForceMode.Impulse);
|
||||
if (target.TryGetComponent<Mortal>(out var mortal))
|
||||
mortal.Damage(Damage);
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(shotLatency);
|
||||
ready = true;
|
||||
}
|
||||
|
||||
public override void Use1()
|
||||
{
|
||||
if(camZoom == null)
|
||||
return;
|
||||
|
||||
if (zoomed)
|
||||
{
|
||||
camZoom.Zoom(1);
|
||||
zoomed = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
camZoom.Zoom(2);
|
||||
zoomed = true;
|
||||
}
|
||||
}
|
||||
|
||||
public override void Use2()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Tools/Gun.cs.meta
Normal file
11
Assets/Tools/Gun.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 58786de984362db46ad12a240e7fbdc2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
8
Assets/Tools/Sounds.meta
Normal file
8
Assets/Tools/Sounds.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3b1753fa34dddb44b945ac8aed0fbcfe
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Tools/Sounds/Desert-Eagle-Close.ogg
Normal file
BIN
Assets/Tools/Sounds/Desert-Eagle-Close.ogg
Normal file
Binary file not shown.
22
Assets/Tools/Sounds/Desert-Eagle-Close.ogg.meta
Normal file
22
Assets/Tools/Sounds/Desert-Eagle-Close.ogg.meta
Normal file
@@ -0,0 +1,22 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e1dd98eac4000214282d794287e18060
|
||||
AudioImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 6
|
||||
defaultSettings:
|
||||
loadType: 0
|
||||
sampleRateSetting: 0
|
||||
sampleRateOverride: 44100
|
||||
compressionFormat: 1
|
||||
quality: 1
|
||||
conversionMode: 0
|
||||
platformSettingOverrides: {}
|
||||
forceToMono: 0
|
||||
normalize: 1
|
||||
preloadAudioData: 1
|
||||
loadInBackground: 0
|
||||
ambisonic: 0
|
||||
3D: 1
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
244
Assets/Tools/TestGunPrefab.prefab
Normal file
244
Assets/Tools/TestGunPrefab.prefab
Normal file
@@ -0,0 +1,244 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &627321253897974804
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 6613407801610568210}
|
||||
- component: {fileID: 2078643334232883202}
|
||||
- component: {fileID: -5453149367965068600}
|
||||
m_Layer: 0
|
||||
m_Name: TestGunPrefab
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &6613407801610568210
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 627321253897974804}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 7558620357880195813}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &2078643334232883202
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 627321253897974804}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 58786de984362db46ad12a240e7fbdc2, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Damage: 10
|
||||
Accuracy: 1
|
||||
Auto: 0
|
||||
FireRate: 500
|
||||
BulletsPerShot: 1
|
||||
ImpactEffect: {fileID: 100002, guid: 07db998fc9f0b074c845317582a19160, type: 3}
|
||||
ImpactForce: 20
|
||||
--- !u!82 &-5453149367965068600
|
||||
AudioSource:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 627321253897974804}
|
||||
m_Enabled: 1
|
||||
serializedVersion: 4
|
||||
OutputAudioMixerGroup: {fileID: 0}
|
||||
m_audioClip: {fileID: 8300000, guid: e1dd98eac4000214282d794287e18060, type: 3}
|
||||
m_PlayOnAwake: 0
|
||||
m_Volume: 0.333
|
||||
m_Pitch: 1
|
||||
Loop: 0
|
||||
Mute: 0
|
||||
Spatialize: 0
|
||||
SpatializePostEffects: 0
|
||||
Priority: 128
|
||||
DopplerLevel: 1
|
||||
MinDistance: 1
|
||||
MaxDistance: 500
|
||||
Pan2D: 0
|
||||
rolloffMode: 0
|
||||
BypassEffects: 0
|
||||
BypassListenerEffects: 0
|
||||
BypassReverbZones: 0
|
||||
rolloffCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
- serializedVersion: 3
|
||||
time: 1
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
panLevelCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
spreadCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 0
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
reverbZoneMixCustomCurve:
|
||||
serializedVersion: 2
|
||||
m_Curve:
|
||||
- serializedVersion: 3
|
||||
time: 0
|
||||
value: 1
|
||||
inSlope: 0
|
||||
outSlope: 0
|
||||
tangentMode: 0
|
||||
weightedMode: 0
|
||||
inWeight: 0.33333334
|
||||
outWeight: 0.33333334
|
||||
m_PreInfinity: 2
|
||||
m_PostInfinity: 2
|
||||
m_RotationOrder: 4
|
||||
--- !u!1 &7257760758411307048
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 7558620357880195813}
|
||||
- component: {fileID: 3319850981884147298}
|
||||
- component: {fileID: 3938223884345691890}
|
||||
- component: {fileID: 7285393066373520387}
|
||||
m_Layer: 0
|
||||
m_Name: Mesh
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &7558620357880195813
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7257760758411307048}
|
||||
m_LocalRotation: {x: 0.5, y: 0.5, z: 0.5, w: 0.5}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 0.15, y: 0.3, z: 0.15}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 6613407801610568210}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 90}
|
||||
--- !u!33 &3319850981884147298
|
||||
MeshFilter:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7257760758411307048}
|
||||
m_Mesh: {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!23 &3938223884345691890
|
||||
MeshRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7257760758411307048}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 1
|
||||
m_ReceiveShadows: 1
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 2
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 3
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
--- !u!136 &7285393066373520387
|
||||
CapsuleCollider:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 7257760758411307048}
|
||||
m_Material: {fileID: 0}
|
||||
m_IsTrigger: 0
|
||||
m_Enabled: 1
|
||||
m_Radius: 0.5
|
||||
m_Height: 2
|
||||
m_Direction: 1
|
||||
m_Center: {x: 0.000000059604645, y: 0, z: -0.00000008940697}
|
||||
7
Assets/Tools/TestGunPrefab.prefab.meta
Normal file
7
Assets/Tools/TestGunPrefab.prefab.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8af0a794087be534bb32270c0d385176
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
11
Assets/Tools/Tool.cs
Normal file
11
Assets/Tools/Tool.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace FastArena
|
||||
{
|
||||
public abstract class Tool : MonoBehaviour
|
||||
{
|
||||
public abstract void Use0();
|
||||
public abstract void Use1();
|
||||
public abstract void Use2();
|
||||
}
|
||||
}
|
||||
11
Assets/Tools/Tool.cs.meta
Normal file
11
Assets/Tools/Tool.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d7fca69d5729bb40909cc755e9c3147
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user