Merge branch 'Zakhar' of https://github.com/BG-Games/S_Jump-and-grub into Zakhar
# Conflicts: # Assets/Scripts/HexFiled/PaintedController.cs
This commit is contained in:
commit
e196974851
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_FallbackScreenDPI: 96
|
||||||
m_DefaultSpriteDPI: 96
|
m_DefaultSpriteDPI: 96
|
||||||
m_DynamicPixelsPerUnit: 1
|
m_DynamicPixelsPerUnit: 1
|
||||||
m_PresetInfoIsWorld: 0
|
m_PresetInfoIsWorld: 1
|
||||||
--- !u!114 &6763014501615571600
|
--- !u!114 &6763014501615571600
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -186,7 +186,7 @@ RectTransform:
|
|||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {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_SizeDelta: {x: 10, y: 5.4055}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!223 &8490769543284739872
|
--- !u!223 &8490769543284739872
|
||||||
@ -232,7 +232,7 @@ MonoBehaviour:
|
|||||||
m_FallbackScreenDPI: 96
|
m_FallbackScreenDPI: 96
|
||||||
m_DefaultSpriteDPI: 96
|
m_DefaultSpriteDPI: 96
|
||||||
m_DynamicPixelsPerUnit: 1
|
m_DynamicPixelsPerUnit: 1
|
||||||
m_PresetInfoIsWorld: 1
|
m_PresetInfoIsWorld: 0
|
||||||
--- !u!114 &1271697267505620599
|
--- !u!114 &1271697267505620599
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
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
|
propertyPath: m_PresetInfoIsWorld
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 9185818537322146330, guid: dec5dd0d644d5c548a53563e65837162,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: m_FillAmount
|
||||||
|
value: 1
|
||||||
|
objectReference: {fileID: 0}
|
||||||
m_RemovedComponents: []
|
m_RemovedComponents: []
|
||||||
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
m_SourcePrefab: {fileID: 100100000, guid: dec5dd0d644d5c548a53563e65837162, type: 3}
|
||||||
--- !u!1 &5591725933991455353 stripped
|
--- !u!1 &5591725933991455353 stripped
|
||||||
|
@ -20077,10 +20077,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -279.12}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 180}
|
m_SizeDelta: {x: 0, y: 180}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &223373605
|
--- !u!1 &223373605
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -21943,7 +21943,7 @@ RectTransform:
|
|||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0.427, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
@ -22033,10 +22033,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 6
|
m_RootOrder: 6
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -657.36}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 180}
|
m_SizeDelta: {x: 0, y: 180}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &323737875
|
--- !u!1 &323737875
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -26924,10 +26924,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 3
|
m_RootOrder: 3
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -373.68}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 4}
|
m_SizeDelta: {x: 0, y: 4}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &329939466
|
--- !u!114 &329939466
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -80794,10 +80794,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 0
|
m_RootOrder: 0
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -90}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 180}
|
m_SizeDelta: {x: 0, y: 180}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &831510121
|
--- !u!1 &831510121
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -80831,10 +80831,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -184.56}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 4}
|
m_SizeDelta: {x: 0, y: 4}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &831510123
|
--- !u!114 &831510123
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -88697,7 +88697,7 @@ GameObject:
|
|||||||
m_Icon: {fileID: 0}
|
m_Icon: {fileID: 0}
|
||||||
m_NavMeshLayer: 0
|
m_NavMeshLayer: 0
|
||||||
m_StaticEditorFlags: 0
|
m_StaticEditorFlags: 0
|
||||||
m_IsActive: 0
|
m_IsActive: 1
|
||||||
--- !u!224 &1013893794
|
--- !u!224 &1013893794
|
||||||
RectTransform:
|
RectTransform:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -101175,10 +101175,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 4
|
m_RootOrder: 4
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -468.24}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 180}
|
m_SizeDelta: {x: 0, y: 180}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!1 &1151852833
|
--- !u!1 &1151852833
|
||||||
GameObject:
|
GameObject:
|
||||||
@ -108557,7 +108557,7 @@ RectTransform:
|
|||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
@ -134211,7 +134211,7 @@ RectTransform:
|
|||||||
m_RootOrder: 1
|
m_RootOrder: 1
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 0, y: 0}
|
m_SizeDelta: {x: 0, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
@ -134449,10 +134449,10 @@ RectTransform:
|
|||||||
m_Father: {fileID: 1844323541}
|
m_Father: {fileID: 1844323541}
|
||||||
m_RootOrder: 5
|
m_RootOrder: 5
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0, y: 1}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 408.28363, y: -562.8}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 816.56726, y: 4}
|
m_SizeDelta: {x: 0, y: 4}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
--- !u!114 &1579181538
|
--- !u!114 &1579181538
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -138844,7 +138844,7 @@ RectTransform:
|
|||||||
m_AnchorMin: {x: 0.5, y: 0.5}
|
m_AnchorMin: {x: 0.5, y: 0.5}
|
||||||
m_AnchorMax: {x: 0.5, y: 0.5}
|
m_AnchorMax: {x: 0.5, y: 0.5}
|
||||||
m_AnchoredPosition: {x: 0, y: 464.06}
|
m_AnchoredPosition: {x: 0, y: 464.06}
|
||||||
m_SizeDelta: {x: 816.56726, y: 747.36}
|
m_SizeDelta: {x: 816.56726, y: 0}
|
||||||
m_Pivot: {x: 0.5, y: 1}
|
m_Pivot: {x: 0.5, y: 1}
|
||||||
--- !u!114 &1844323542
|
--- !u!114 &1844323542
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
@ -139210,8 +139210,8 @@ RectTransform:
|
|||||||
m_Father: {fileID: 597565997}
|
m_Father: {fileID: 597565997}
|
||||||
m_RootOrder: 2
|
m_RootOrder: 2
|
||||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
m_AnchorMin: {x: 0.427, y: 0}
|
m_AnchorMin: {x: 0, y: 0}
|
||||||
m_AnchorMax: {x: 0.427, y: 1}
|
m_AnchorMax: {x: 0, y: 0}
|
||||||
m_AnchoredPosition: {x: 0, y: 0}
|
m_AnchoredPosition: {x: 0, y: 0}
|
||||||
m_SizeDelta: {x: 100, y: 100}
|
m_SizeDelta: {x: 100, y: 100}
|
||||||
m_Pivot: {x: 0.5, y: 0.5}
|
m_Pivot: {x: 0.5, y: 0.5}
|
||||||
@ -140718,6 +140718,36 @@ CanvasRenderer:
|
|||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_GameObject: {fileID: 1958373585}
|
m_GameObject: {fileID: 1958373585}
|
||||||
m_CullTransparentMesh: 1
|
m_CullTransparentMesh: 1
|
||||||
|
--- !u!1 &1958963362
|
||||||
|
GameObject:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
serializedVersion: 6
|
||||||
|
m_Component:
|
||||||
|
- component: {fileID: 1958963363}
|
||||||
|
m_Layer: 0
|
||||||
|
m_Name: GameObject
|
||||||
|
m_TagString: Untagged
|
||||||
|
m_Icon: {fileID: 0}
|
||||||
|
m_NavMeshLayer: 0
|
||||||
|
m_StaticEditorFlags: 0
|
||||||
|
m_IsActive: 1
|
||||||
|
--- !u!4 &1958963363
|
||||||
|
Transform:
|
||||||
|
m_ObjectHideFlags: 0
|
||||||
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
|
m_PrefabInstance: {fileID: 0}
|
||||||
|
m_PrefabAsset: {fileID: 0}
|
||||||
|
m_GameObject: {fileID: 1958963362}
|
||||||
|
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: []
|
||||||
|
m_Father: {fileID: 0}
|
||||||
|
m_RootOrder: 6
|
||||||
|
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||||
--- !u!1 &1961275222
|
--- !u!1 &1961275222
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
1260
Assets/Scenes/TestMana.unity
Normal file
1260
Assets/Scenes/TestMana.unity
Normal file
File diff suppressed because it is too large
Load Diff
7
Assets/Scenes/TestMana.unity.meta
Normal file
7
Assets/Scenes/TestMana.unity.meta
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 569e1bf438ac89d4f8cc374a6172c47a
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
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:
|
@ -201,7 +201,7 @@ namespace Units
|
|||||||
ball.transform.DOMove(
|
ball.transform.DOMove(
|
||||||
new Vector3(_direction.normalized.x,
|
new Vector3(_direction.normalized.x,
|
||||||
0, _direction.normalized.y) * _weapon.disnatce * _hexGrid.HexDistance +
|
0, _direction.normalized.y) * _weapon.disnatce * _hexGrid.HexDistance +
|
||||||
_instance.transform.position + new Vector3(0, 2, 0),
|
_instance.transform.position + new Vector3(0, 2, 0), // initiate
|
||||||
_weapon.speed)
|
_weapon.speed)
|
||||||
.SetEase(Ease.Linear)
|
.SetEase(Ease.Linear)
|
||||||
.OnComplete(() => Object.Destroy(ball));
|
.OnComplete(() => Object.Destroy(ball));
|
||||||
@ -227,6 +227,8 @@ namespace Units
|
|||||||
float maxHp = _data.maxHP;
|
float maxHp = _data.maxHP;
|
||||||
float maxMana = _data.maxMana;
|
float maxMana = _data.maxMana;
|
||||||
_barCanvas.ManaBar.DOFillAmount(mana / maxMana, 0.5f).SetEase(Ease.InQuad);
|
_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);
|
_barCanvas.HealthBar.DOFillAmount(hp / maxHp, 0.5f).SetEase(Ease.InQuad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,6 +28,9 @@ public class UnitView : MonoBehaviour
|
|||||||
private Action _startRegen;
|
private Action _startRegen;
|
||||||
private Coroutine _previosRegen;
|
private Coroutine _previosRegen;
|
||||||
private Coroutine _previosReload;
|
private Coroutine _previosReload;
|
||||||
|
//
|
||||||
|
//private WaitForSeconds regenTick = new WaitForSeconds(0.5f);
|
||||||
|
//
|
||||||
private int _mana;
|
private int _mana;
|
||||||
private Action _capureHex;
|
private Action _capureHex;
|
||||||
private Sequence _sequence;
|
private Sequence _sequence;
|
||||||
@ -85,13 +88,17 @@ public class UnitView : MonoBehaviour
|
|||||||
|
|
||||||
public void RegenMana(int mana)
|
public void RegenMana(int mana)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (_previosRegen != null)
|
if (_previosRegen != null)
|
||||||
{
|
{
|
||||||
StopCoroutine(_previosRegen);
|
StopCoroutine(_previosRegen);
|
||||||
}
|
}
|
||||||
|
|
||||||
_mana = mana;
|
_mana = mana;
|
||||||
|
//_startRegen.Invoke();
|
||||||
_previosRegen = StartCoroutine(Regen());
|
_previosRegen = StartCoroutine(Regen());
|
||||||
|
|
||||||
|
//return _mana;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Step()
|
private void Step()
|
||||||
@ -135,6 +142,7 @@ public class UnitView : MonoBehaviour
|
|||||||
shot.Switch();
|
shot.Switch();
|
||||||
_shootUIStack.Push(shot);
|
_shootUIStack.Push(shot);
|
||||||
StartCoroutine(Reload());
|
StartCoroutine(Reload());
|
||||||
|
_previosReload = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerator Regen()
|
private IEnumerator Regen()
|
||||||
@ -144,9 +152,17 @@ public class UnitView : MonoBehaviour
|
|||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield return new WaitForSeconds(1f);
|
|
||||||
|
yield return new WaitForSeconds(2f);
|
||||||
|
while(_mana < 100)
|
||||||
|
{
|
||||||
_mana += _manaRegen;
|
_mana += _manaRegen;
|
||||||
_startRegen.Invoke();
|
_startRegen.Invoke();
|
||||||
StartCoroutine(Regen());
|
}
|
||||||
|
|
||||||
|
//StartCoroutine(Regen());
|
||||||
|
_previosRegen = null;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user