Merge branch 'Prod' into Alexei
# Conflicts: # Assets/Resources/Data/ItemData.asset
This commit is contained in:
commit
5f0c2b0446
55
.vscode/launch.json
vendored
Normal file
55
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
|
||||
{
|
||||
"name": "Unity Editor",
|
||||
"type": "unity",
|
||||
"path": "/G:/Unity/Jump_And_Grub/Library/EditorInstance.json",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "Windows Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "OSX Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "Linux Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "iOS Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "Android Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "Xbox One Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "PS4 Player",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
},
|
||||
{
|
||||
"name": "SwitchPlayer",
|
||||
"type": "unity",
|
||||
"request": "launch"
|
||||
}
|
||||
]
|
||||
}
|
42
.vscode/tasks.json
vendored
Normal file
42
.vscode/tasks.json
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "build",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"build",
|
||||
"${workspaceFolder}/Assembly-CSharp.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "publish",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"publish",
|
||||
"${workspaceFolder}/Assembly-CSharp.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
},
|
||||
{
|
||||
"label": "watch",
|
||||
"command": "dotnet",
|
||||
"type": "process",
|
||||
"args": [
|
||||
"watch",
|
||||
"run",
|
||||
"${workspaceFolder}/Assembly-CSharp.csproj",
|
||||
"/property:GenerateFullPaths=true",
|
||||
"/consoleloggerparameters:NoSummary"
|
||||
],
|
||||
"problemMatcher": "$msCompile"
|
||||
}
|
||||
]
|
||||
}
|
@ -83,7 +83,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
m_PresetInfoIsWorld: 1
|
||||
--- !u!114 &6763014501615571600
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -186,7 +186,7 @@ RectTransform:
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 1.1486}
|
||||
m_AnchoredPosition: {x: 0, y: 1.1485596}
|
||||
m_SizeDelta: {x: 10, y: 5.4055}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!223 &8490769543284739872
|
||||
@ -232,7 +232,7 @@ MonoBehaviour:
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
m_DynamicPixelsPerUnit: 1
|
||||
m_PresetInfoIsWorld: 1
|
||||
m_PresetInfoIsWorld: 0
|
||||
--- !u!114 &1271697267505620599
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
|
8
Assets/Prefab/Tests.meta
Normal file
8
Assets/Prefab/Tests.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dfc9988be09620a4798e070262bdf0c6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
230
Assets/Prefab/Tests/Bullet.prefab
Normal file
230
Assets/Prefab/Tests/Bullet.prefab
Normal file
@ -0,0 +1,230 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1508996612506205613
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1508996612506205614}
|
||||
- component: {fileID: 1508996612506205615}
|
||||
m_Layer: 0
|
||||
m_Name: Circle
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1508996612506205614
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996612506205613}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0.5, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 1508996612687079457}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1508996612506205615
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996612506205613}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, 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: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: -2413806693520163455, guid: ebe73ca9363db456bacf42c025bb4847,
|
||||
type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1508996612687079456
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1508996612687079457}
|
||||
- component: {fileID: 1508996612687079458}
|
||||
m_Layer: 0
|
||||
m_Name: Square
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1508996612687079457
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996612687079456}
|
||||
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: -0.5, z: 0}
|
||||
m_LocalScale: {x: 0.23946421, y: 0.53201, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1508996612506205614}
|
||||
m_Father: {fileID: 1508996613087134754}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!212 &1508996612687079458
|
||||
SpriteRenderer:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996612687079456}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 10754, 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: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 48e93eef0688c4a259cb0eddcd8661f7,
|
||||
type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_MaskInteraction: 0
|
||||
m_SpriteSortPoint: 0
|
||||
--- !u!1 &1508996613087134753
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 1508996613087134754}
|
||||
- component: {fileID: 8444853135865988787}
|
||||
- component: {fileID: 3509611387413288450}
|
||||
m_Layer: 0
|
||||
m_Name: Bullet
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &1508996613087134754
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996613087134753}
|
||||
m_LocalRotation: {x: 0.5, y: -0.5, z: -0.5, w: 0.5}
|
||||
m_LocalPosition: {x: 0, y: 0.5, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children:
|
||||
- {fileID: 1508996612687079457}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: -90, z: -90}
|
||||
--- !u!54 &8444853135865988787
|
||||
Rigidbody:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996613087134753}
|
||||
serializedVersion: 2
|
||||
m_Mass: 1
|
||||
m_Drag: 0
|
||||
m_AngularDrag: 0.05
|
||||
m_UseGravity: 0
|
||||
m_IsKinematic: 0
|
||||
m_Interpolate: 0
|
||||
m_Constraints: 0
|
||||
m_CollisionDetection: 0
|
||||
--- !u!114 &3509611387413288450
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1508996613087134753}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7fd043b309962ec4ab2244e7b7257fe7, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
7
Assets/Prefab/Tests/Bullet.prefab.meta
Normal file
7
Assets/Prefab/Tests/Bullet.prefab.meta
Normal file
@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 657111cb607c294479046ca0faef6c69
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
14
Assets/Prefab/Tests/DestroyBullet.cs
Normal file
14
Assets/Prefab/Tests/DestroyBullet.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class DestroyBullet : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
Destroy(gameObject, 2f);
|
||||
}
|
||||
|
||||
|
||||
}
|
11
Assets/Prefab/Tests/DestroyBullet.cs.meta
Normal file
11
Assets/Prefab/Tests/DestroyBullet.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7fd043b309962ec4ab2244e7b7257fe7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
59
Assets/Prefab/Tests/Fire.cs
Normal file
59
Assets/Prefab/Tests/Fire.cs
Normal file
@ -0,0 +1,59 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Fire : MonoBehaviour
|
||||
{
|
||||
public Transform barrel;
|
||||
public GameObject bulletPref;
|
||||
|
||||
public GameObject[] ammo;
|
||||
public Stack<GameObject> ammoStack = new Stack<GameObject>();
|
||||
|
||||
private int ammoAnount;
|
||||
|
||||
private void Start() {
|
||||
//ammo.Push(bulletPref);
|
||||
for(int i = 0; i <=2; i++)
|
||||
{
|
||||
ammoStack.Push(ammo[i]);
|
||||
ammo[i].SetActive(false);
|
||||
Debug.Log($"Should print out : {ammoStack.Peek()}");
|
||||
|
||||
}
|
||||
// foreach (var item in ammoStack)
|
||||
// {
|
||||
// item.SetActive(false);
|
||||
// }
|
||||
|
||||
// if(ammo.Length <= 3)
|
||||
// {
|
||||
// ammoStack.Pop().SetActive(false);
|
||||
// Debug.Log($"Should print out : {ammoStack.Peek().name}");
|
||||
|
||||
// }
|
||||
ammoAnount = 0;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if(Input.GetButtonDown("Fire1") && ammoAnount > 0)
|
||||
{
|
||||
var spawnBullet = Instantiate(bulletPref, barrel.localPosition, barrel.rotation);
|
||||
//spawnBullet.GetComponent<Rigidbody>().
|
||||
spawnBullet.transform.Translate(Vector3.forward * Time.deltaTime * 10f);
|
||||
ammoAnount -= 1;
|
||||
ammoStack.Pop().SetActive(false);
|
||||
}
|
||||
|
||||
if(Input.GetKeyDown(KeyCode.R))
|
||||
{
|
||||
ammoAnount = 3;
|
||||
for (int i = 0; i <= 2; i++)
|
||||
{
|
||||
ammoStack.Push(ammo[i]);
|
||||
ammo[i].SetActive(true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Prefab/Tests/Fire.cs.meta
Normal file
11
Assets/Prefab/Tests/Fire.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9f62e81b9dba43648bc3e2f3bcd1bc9e
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -3931,6 +3931,11 @@ PrefabInstance:
|
||||
propertyPath: m_PresetInfoIsWorld
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 9185818537322146330, guid: dec5dd0d644d5c548a53563e65837162,
|
||||
type: 3}
|
||||
propertyPath: m_FillAmount
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||
--- !u!1 &5591725933991455353 stripped
|
||||
|
@ -11,7 +11,7 @@ MonoBehaviour:
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: effbc11b6ae8444c8d20e929ce28183e, type: 3}
|
||||
m_Name: ItemData
|
||||
m_EditorClassIdentifier:
|
||||
m_EditorClassIdentifier:
|
||||
itemInfos:
|
||||
- prefab: {fileID: 919132149155446097, guid: 4166c606d638610418dc9ead794d697b, type: 3}
|
||||
isInstantUse: 0
|
||||
@ -19,23 +19,23 @@ MonoBehaviour:
|
||||
icon: {fileID: 21300000, guid: 543c4732bd2d47a41bdbbf2156eb358c, type: 3}
|
||||
spawnablePrefab: {fileID: 4774919592469818776, guid: 0dbed8f974ba44a42af9d8fcae504ce0,
|
||||
type: 3}
|
||||
values:
|
||||
spawnChance: 0.23
|
||||
values:
|
||||
spawnChance: 0.2
|
||||
- prefab: {fileID: 3197816592181874056, guid: 2704c4f795b0d7748a3e3fa53be4d893,
|
||||
type: 3}
|
||||
isInstantUse: 1
|
||||
type: AttackBonus
|
||||
icon: {fileID: 21300000, guid: caf8bc0311dd2fc4ca1528a82a063754, type: 3}
|
||||
spawnablePrefab: {fileID: 0}
|
||||
values: 0500000064000000
|
||||
spawnChance: 0.62
|
||||
values: 030000000f000000
|
||||
spawnChance: 0.516
|
||||
- prefab: {fileID: 8639522512577941448, guid: 7b6a7f64e52da514d88aa97ad8f863df,
|
||||
type: 3}
|
||||
isInstantUse: 1
|
||||
type: DefenceBonus
|
||||
icon: {fileID: 21300000, guid: 35be128594dcdce48b5d8e5317b38ed9, type: 3}
|
||||
spawnablePrefab: {fileID: 0}
|
||||
values: 1e0000001e000000
|
||||
spawnChance: 0.77
|
||||
values: 0a0000001e000000
|
||||
spawnChance: 0.797
|
||||
fromTimeSpawn: 3
|
||||
toTimeSpawn: 10
|
||||
|
8
Assets/Scripts/States.meta
Normal file
8
Assets/Scripts/States.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4690d5b96a9971f4fa845f4b25440eba
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
65
Assets/Scripts/States/Gamelogic.cs
Normal file
65
Assets/Scripts/States/Gamelogic.cs
Normal file
@ -0,0 +1,65 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Gamelogic : MonoBehaviour
|
||||
{
|
||||
Mana manaSystem;
|
||||
|
||||
private void Start() {
|
||||
manaSystem = new Mana();
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
Debug.Log("HP: " + manaSystem.Current_MP);
|
||||
|
||||
manaSystem.Update();
|
||||
}
|
||||
}
|
||||
public class Mana
|
||||
{
|
||||
public float Max_MP = 100;
|
||||
public float Current_MP = 1;
|
||||
List<ManaRegen> regenList;
|
||||
public Mana()
|
||||
{
|
||||
regenList = new List<ManaRegen>();
|
||||
}
|
||||
public Mana(float max, float current)
|
||||
{
|
||||
Max_MP = max;
|
||||
Current_MP = current;
|
||||
regenList = new List<ManaRegen>();
|
||||
}
|
||||
public void Update() {
|
||||
foreach (var regen in regenList.ToArray())
|
||||
{
|
||||
if(Current_MP < Max_MP && regen.fDuraton > 0)
|
||||
{
|
||||
Current_MP += regen.fManaPerSecond * Time.deltaTime;
|
||||
}
|
||||
regen.fDuraton -= 1f *Time.deltaTime;
|
||||
|
||||
if(regen.fDuraton < 0)
|
||||
{
|
||||
regenList.RemoveAt(regenList.IndexOf(regen));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class ManaRegen
|
||||
{
|
||||
public float fDuraton;
|
||||
public float fManaPerSecond;
|
||||
|
||||
public ManaRegen()
|
||||
{
|
||||
|
||||
}
|
||||
public ManaRegen(float duration, float manaPerSecond)
|
||||
{
|
||||
fDuraton = duration;
|
||||
fManaPerSecond = manaPerSecond;
|
||||
}
|
||||
}
|
11
Assets/Scripts/States/Gamelogic.cs.meta
Normal file
11
Assets/Scripts/States/Gamelogic.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d34080a61fa47645b032357092bcc99
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
60
Assets/Scripts/States/ManaBar.cs
Normal file
60
Assets/Scripts/States/ManaBar.cs
Normal file
@ -0,0 +1,60 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ManaBar : MonoBehaviour
|
||||
{
|
||||
public Slider manaBar;
|
||||
|
||||
private int maxMana = 100;
|
||||
private int currentMana;
|
||||
private WaitForSeconds regenTick = new WaitForSeconds(0.5f);
|
||||
private Coroutine regen;
|
||||
|
||||
|
||||
public static ManaBar instance;
|
||||
|
||||
private void Awake() {
|
||||
instance = this;
|
||||
}
|
||||
|
||||
private void Start() {
|
||||
currentMana = maxMana;
|
||||
manaBar.maxValue = maxMana;
|
||||
manaBar.value = maxMana;
|
||||
}
|
||||
|
||||
public void UseMana(int amount)
|
||||
{
|
||||
if(currentMana - amount >= 0 )
|
||||
{
|
||||
currentMana -= amount;
|
||||
manaBar.value = currentMana;
|
||||
|
||||
if(regen != null)
|
||||
StopCoroutine(regen);
|
||||
|
||||
regen = StartCoroutine(RegenMana());
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.Log("Not enough mana");
|
||||
}
|
||||
}
|
||||
|
||||
private IEnumerator RegenMana()
|
||||
{
|
||||
yield return new WaitForSeconds(0.1f);
|
||||
|
||||
while(currentMana < maxMana)
|
||||
{
|
||||
currentMana += maxMana / 10;
|
||||
manaBar.value = currentMana;
|
||||
yield return regenTick;
|
||||
}
|
||||
|
||||
regen = null;
|
||||
}
|
||||
|
||||
}
|
11
Assets/Scripts/States/ManaBar.cs.meta
Normal file
11
Assets/Scripts/States/ManaBar.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38891abd62cc9634584e630986c02534
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
13
Assets/Scripts/States/Player.cs
Normal file
13
Assets/Scripts/States/Player.cs
Normal file
@ -0,0 +1,13 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Player : MonoBehaviour
|
||||
{
|
||||
private void Update() {
|
||||
if(Input.GetKeyDown(KeyCode.Space))
|
||||
{
|
||||
ManaBar.instance.UseMana(15);
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/States/Player.cs.meta
Normal file
11
Assets/Scripts/States/Player.cs.meta
Normal file
@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8effecfd846c8cf43ab76c0185e0f2a0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -66,7 +66,7 @@ namespace Units
|
||||
{
|
||||
_weapon.SetModifiedDamage(0);
|
||||
}
|
||||
|
||||
|
||||
public void SetDefenceBonus(int duration, int value)
|
||||
{
|
||||
TimerHelper.Instance.StartTimer(StopDefenceBonus, duration);
|
||||
@ -77,7 +77,7 @@ namespace Units
|
||||
{
|
||||
_defenceBonus = 0;
|
||||
}
|
||||
|
||||
|
||||
public void Move(HexDirection direction)
|
||||
{
|
||||
if (!_cell.GetNeighbor(direction) || _isBusy) return;
|
||||
@ -169,7 +169,8 @@ namespace Units
|
||||
_animator = _instance.GetComponent<Animator>();
|
||||
_unitView = _instance.GetComponent<UnitView>();
|
||||
_barCanvas = _unitView.BarCanvas.GetComponent<BarCanvas>();
|
||||
_unitView.SetUp(_barCanvas.SpawnShotUI(_weapon.shots), _weapon, RegenMana, _data.manaRegen, CaptureHex, this);
|
||||
_unitView.SetUp(_barCanvas.SpawnShotUI(_weapon.shots), _weapon, RegenMana, _data.manaRegen, CaptureHex,
|
||||
this);
|
||||
SetAnimLength();
|
||||
MusicController.Instance.AddAudioSource(_instance);
|
||||
_mana = _data.maxMana;
|
||||
@ -201,6 +202,7 @@ namespace Units
|
||||
{
|
||||
_inventory.Remove(item);
|
||||
}
|
||||
|
||||
private void MoveEnd()
|
||||
{
|
||||
_isBusy = false;
|
||||
@ -274,6 +276,8 @@ namespace Units
|
||||
float maxHp = _data.maxHP;
|
||||
float maxMana = _data.maxMana;
|
||||
_barCanvas.ManaBar.DOFillAmount(mana / maxMana, 0.5f).SetEase(Ease.InQuad);
|
||||
//_barCanvas.ManaBar.value =
|
||||
//_unitView.RegenMana(10);
|
||||
_barCanvas.HealthBar.DOFillAmount(hp / maxHp, 0.5f).SetEase(Ease.InQuad);
|
||||
}
|
||||
|
||||
@ -324,7 +328,6 @@ namespace Units
|
||||
|
||||
private void Damage(int dmg)
|
||||
{
|
||||
|
||||
if (_defenceBonus == 0 && _hp - dmg <= 0f)
|
||||
{
|
||||
Death();
|
||||
@ -338,7 +341,7 @@ namespace Units
|
||||
{
|
||||
_hp -= dmg;
|
||||
}
|
||||
|
||||
|
||||
UpdateBarCanvas();
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,9 @@ public class UnitView : MonoBehaviour
|
||||
private Action _startRegen;
|
||||
private Coroutine _previosRegen;
|
||||
private Coroutine _previosReload;
|
||||
//
|
||||
private WaitForSeconds regenTick = new WaitForSeconds(0.5f);
|
||||
//
|
||||
private int _mana;
|
||||
private Action _capureHex;
|
||||
private Sequence _sequence;
|
||||
@ -92,13 +95,17 @@ public class UnitView : MonoBehaviour
|
||||
|
||||
public void RegenMana(int mana)
|
||||
{
|
||||
|
||||
if (_previosRegen != null)
|
||||
{
|
||||
StopCoroutine(_previosRegen);
|
||||
}
|
||||
|
||||
_mana = mana;
|
||||
//_startRegen.Invoke();
|
||||
_previosRegen = StartCoroutine(Regen());
|
||||
|
||||
//return _mana;
|
||||
}
|
||||
|
||||
private void Step()
|
||||
@ -146,9 +153,24 @@ public class UnitView : MonoBehaviour
|
||||
yield return new WaitForSeconds(_weapon.reloadTime);
|
||||
if (_toReloadStack.Count == 0) yield break;
|
||||
var shot = _toReloadStack.Pop();
|
||||
shot.Switch();
|
||||
_shootUIStack.Push(shot);
|
||||
StartCoroutine(Reload());
|
||||
|
||||
// _shootUIStack.Push(shot);
|
||||
shot.Switch();
|
||||
_shootUIStack.Push(shot);
|
||||
|
||||
foreach (var item in _toReloadStack)
|
||||
{
|
||||
if(Time.deltaTime < _weapon.reloadTime)
|
||||
{
|
||||
StopCoroutine(_previosReload);
|
||||
_previosReload = null;
|
||||
}
|
||||
_previosReload = StartCoroutine(Reload());
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
private IEnumerator Regen()
|
||||
@ -158,9 +180,17 @@ public class UnitView : MonoBehaviour
|
||||
yield break;
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds(1f);
|
||||
_mana += _manaRegen;
|
||||
_startRegen.Invoke();
|
||||
StartCoroutine(Regen());
|
||||
|
||||
yield return new WaitForSeconds(2f);
|
||||
while(_mana < 100)
|
||||
{
|
||||
_mana += _manaRegen;
|
||||
_startRegen.Invoke();
|
||||
}
|
||||
|
||||
//StartCoroutine(Regen());
|
||||
_previosRegen = null;
|
||||
|
||||
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user