added attacking, seted attack animation, updating mana canvas
This commit is contained in:
parent
a5ed0753bb
commit
f2f6abcdbc
@ -4,10 +4,16 @@ using UnityEngine;
|
|||||||
public class PlayerView : MonoBehaviour
|
public class PlayerView : MonoBehaviour
|
||||||
{
|
{
|
||||||
public Action OnStep;
|
public Action OnStep;
|
||||||
|
public Action OnAttackEnd;
|
||||||
public GameObject charBarCanvas;
|
public GameObject charBarCanvas;
|
||||||
|
|
||||||
public void Step()
|
public void Step()
|
||||||
{
|
{
|
||||||
OnStep?.Invoke();
|
OnStep?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void AttackEnd()
|
||||||
|
{
|
||||||
|
OnAttackEnd?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -73419,7 +73419,7 @@ AnimationClip:
|
|||||||
m_HasGenericRootTransform: 0
|
m_HasGenericRootTransform: 0
|
||||||
m_HasMotionFloatCurves: 0
|
m_HasMotionFloatCurves: 0
|
||||||
m_Events:
|
m_Events:
|
||||||
- time: 0.33333334
|
- time: 0.53333336
|
||||||
functionName: Step
|
functionName: Step
|
||||||
data:
|
data:
|
||||||
objectReferenceParameter: {fileID: 0}
|
objectReferenceParameter: {fileID: 0}
|
||||||
|
@ -9,10 +9,10 @@ AnimatorStateTransition:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions:
|
||||||
- m_ConditionMode: 1
|
- m_ConditionMode: 1
|
||||||
m_ConditionEvent: isMoving
|
m_ConditionEvent: Move
|
||||||
m_EventTreshold: 0
|
m_EventTreshold: 0
|
||||||
- m_ConditionMode: 1
|
- m_ConditionMode: 1
|
||||||
m_ConditionEvent: Move
|
m_ConditionEvent: isMoving
|
||||||
m_EventTreshold: 0
|
m_EventTreshold: 0
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: 9222683897014232595}
|
m_DstState: {fileID: 9222683897014232595}
|
||||||
@ -291,7 +291,7 @@ AnimatorState:
|
|||||||
m_MirrorParameterActive: 0
|
m_MirrorParameterActive: 0
|
||||||
m_CycleOffsetParameterActive: 0
|
m_CycleOffsetParameterActive: 0
|
||||||
m_TimeParameterActive: 0
|
m_TimeParameterActive: 0
|
||||||
m_Motion: {fileID: 7400000, guid: 16ed038afc692fa47966f433a5a5ca1d, type: 2}
|
m_Motion: {fileID: 7400000, guid: 097363ae0f4e1f447b1b623e24b9cd2e, type: 2}
|
||||||
m_Tag:
|
m_Tag:
|
||||||
m_SpeedParameter:
|
m_SpeedParameter:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
@ -330,7 +330,7 @@ AnimatorStateMachine:
|
|||||||
m_ChildStates:
|
m_ChildStates:
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 7761001461743940837}
|
m_State: {fileID: 7761001461743940837}
|
||||||
m_Position: {x: 310, y: 30, z: 0}
|
m_Position: {x: 340, y: 60, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: -2148098699553998022}
|
m_State: {fileID: -2148098699553998022}
|
||||||
m_Position: {x: 100, y: 190, z: 0}
|
m_Position: {x: 100, y: 190, z: 0}
|
||||||
@ -342,7 +342,7 @@ AnimatorStateMachine:
|
|||||||
m_Position: {x: 700, y: 50, z: 0}
|
m_Position: {x: 700, y: 50, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 5596697925261898950}
|
m_State: {fileID: 5596697925261898950}
|
||||||
m_Position: {x: 120, y: 310, z: 0}
|
m_Position: {x: 100, y: 340, z: 0}
|
||||||
- serializedVersion: 1
|
- serializedVersion: 1
|
||||||
m_State: {fileID: 4786967278910117454}
|
m_State: {fileID: 4786967278910117454}
|
||||||
m_Position: {x: 630, y: 220, z: 0}
|
m_Position: {x: 630, y: 220, z: 0}
|
||||||
@ -400,49 +400,49 @@ AnimatorController:
|
|||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: BackToIdle
|
- m_Name: BackToIdle
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: Build
|
- m_Name: Build
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: TreeAttack
|
- m_Name: TreeAttack
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: Move
|
- m_Name: Move
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: SuperJump
|
- m_Name: SuperJump
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: Frozen
|
- m_Name: Frozen
|
||||||
m_Type: 9
|
m_Type: 9
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
- m_Name: isMoving
|
- m_Name: isMoving
|
||||||
m_Type: 4
|
m_Type: 4
|
||||||
m_DefaultFloat: 0
|
m_DefaultFloat: 0
|
||||||
m_DefaultInt: 0
|
m_DefaultInt: 0
|
||||||
m_DefaultBool: 0
|
m_DefaultBool: 0
|
||||||
m_Controller: {fileID: 9100000}
|
m_Controller: {fileID: 0}
|
||||||
m_AnimatorLayers:
|
m_AnimatorLayers:
|
||||||
- serializedVersion: 5
|
- serializedVersion: 5
|
||||||
m_Name: Base Layer
|
m_Name: Base Layer
|
||||||
@ -485,10 +485,7 @@ AnimatorStateTransition:
|
|||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_Conditions:
|
m_Conditions: []
|
||||||
- m_ConditionMode: 1
|
|
||||||
m_ConditionEvent: Move
|
|
||||||
m_EventTreshold: 0
|
|
||||||
m_DstStateMachine: {fileID: 0}
|
m_DstStateMachine: {fileID: 0}
|
||||||
m_DstState: {fileID: 5596697925261898950}
|
m_DstState: {fileID: 5596697925261898950}
|
||||||
m_Solo: 0
|
m_Solo: 0
|
||||||
@ -746,7 +743,7 @@ AnimatorState:
|
|||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: Movement
|
m_Name: AltMovement
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions:
|
m_Transitions:
|
||||||
@ -852,7 +849,7 @@ AnimatorState:
|
|||||||
m_CorrespondingSourceObject: {fileID: 0}
|
m_CorrespondingSourceObject: {fileID: 0}
|
||||||
m_PrefabInstance: {fileID: 0}
|
m_PrefabInstance: {fileID: 0}
|
||||||
m_PrefabAsset: {fileID: 0}
|
m_PrefabAsset: {fileID: 0}
|
||||||
m_Name: AlternativeMovement
|
m_Name: Movement
|
||||||
m_Speed: 1
|
m_Speed: 1
|
||||||
m_CycleOffset: 0
|
m_CycleOffset: 0
|
||||||
m_Transitions:
|
m_Transitions:
|
||||||
@ -866,7 +863,7 @@ AnimatorState:
|
|||||||
m_MirrorParameterActive: 0
|
m_MirrorParameterActive: 0
|
||||||
m_CycleOffsetParameterActive: 0
|
m_CycleOffsetParameterActive: 0
|
||||||
m_TimeParameterActive: 0
|
m_TimeParameterActive: 0
|
||||||
m_Motion: {fileID: 7400000, guid: 7e952fd84f7afa045a61c323ff891957, type: 2}
|
m_Motion: {fileID: 7400000, guid: 09fd661a46c13de49b4e4a8a7257ebcf, type: 2}
|
||||||
m_Tag:
|
m_Tag:
|
||||||
m_SpeedParameter:
|
m_SpeedParameter:
|
||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
|
@ -15,3 +15,4 @@ MonoBehaviour:
|
|||||||
fieldDataPath: FieldData
|
fieldDataPath: FieldData
|
||||||
cameraDataPath: CameraData
|
cameraDataPath: CameraData
|
||||||
playerDataPath: PlayerData
|
playerDataPath: PlayerData
|
||||||
|
weaponDataPath: WeaponsData
|
||||||
|
@ -473,7 +473,7 @@ MonoBehaviour:
|
|||||||
m_Script: {fileID: 11500000, guid: ac42f823a8de86b4d8175e8025500660, type: 3}
|
m_Script: {fileID: 11500000, guid: ac42f823a8de86b4d8175e8025500660, type: 3}
|
||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
duration: 0
|
duration: 3
|
||||||
--- !u!114 &1475618471
|
--- !u!114 &1475618471
|
||||||
MonoBehaviour:
|
MonoBehaviour:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
@ -24,7 +24,7 @@ namespace Chars
|
|||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damag(float dmg)
|
public void Damage(float dmg)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
throw new System.NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,6 @@ namespace Chars
|
|||||||
public void Spawn();
|
public void Spawn();
|
||||||
public void Death();
|
public void Death();
|
||||||
public void Attack(HexDirection direction);
|
public void Attack(HexDirection direction);
|
||||||
public void Damag(float dmg);
|
public void Damage(float dmg);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using Data;
|
using Data;
|
||||||
|
using DefaultNamespace.Weapons;
|
||||||
using DG.Tweening;
|
using DG.Tweening;
|
||||||
using HexFiled;
|
using HexFiled;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
@ -10,6 +11,7 @@ namespace Chars
|
|||||||
struct AnimLength
|
struct AnimLength
|
||||||
{
|
{
|
||||||
public float Move;
|
public float Move;
|
||||||
|
public float Attack;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Player : IUnit
|
public class Player : IUnit
|
||||||
@ -24,46 +26,38 @@ namespace Chars
|
|||||||
public Action<GameObject> onPlayerSpawned;
|
public Action<GameObject> onPlayerSpawned;
|
||||||
private Animator _animator;
|
private Animator _animator;
|
||||||
private PlayerView _playerView;
|
private PlayerView _playerView;
|
||||||
private bool _isMoving;
|
private bool _isBusy;
|
||||||
private UnitColor _color;
|
private UnitColor _color;
|
||||||
private static readonly int Moving = Animator.StringToHash("isMoving");
|
|
||||||
private static readonly int Move1 = Animator.StringToHash("Move");
|
|
||||||
private float _hp;
|
private float _hp;
|
||||||
private float _mana;
|
private float _mana;
|
||||||
|
private Weapon _weapon;
|
||||||
|
private HexCell _cellEdge;
|
||||||
|
private CharBar _charBar;
|
||||||
|
|
||||||
public bool IsMoving => _isMoving;
|
public bool IsBusy => _isBusy;
|
||||||
public GameObject PlayerInstance => _instance;
|
public GameObject PlayerInstance => _instance;
|
||||||
public PlayerView PlayerView => _playerView;
|
public PlayerView PlayerView => _playerView;
|
||||||
|
|
||||||
public Player(PlayerData playerData, HexGrid hexGrid)
|
public Player(PlayerData playerData, Weapon weapon, HexGrid hexGrid)
|
||||||
{
|
{
|
||||||
|
_weapon = weapon;
|
||||||
_spawnPos = playerData.spawnPos;
|
_spawnPos = playerData.spawnPos;
|
||||||
_prefab = playerData.playerPrefab;
|
_prefab = playerData.playerPrefab;
|
||||||
_isAlive = false;
|
_isAlive = false;
|
||||||
_hexGrid = hexGrid;
|
_hexGrid = hexGrid;
|
||||||
_isMoving = false;
|
_isBusy = false;
|
||||||
_color = playerData.color;
|
_color = playerData.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public void Move(HexDirection direction)
|
public void Move(HexDirection direction)
|
||||||
{
|
{
|
||||||
if (_cell.GetNeighbor(direction))
|
if (_cell.GetNeighbor(direction))
|
||||||
{
|
{
|
||||||
_isMoving = true;
|
_isBusy = true;
|
||||||
_cell = _cell.GetNeighbor(direction);
|
_cell = _cell.GetNeighbor(direction);
|
||||||
_instance.transform.LookAt(_cell.transform);
|
_instance.transform.DOLookAt(_cell.transform.position, 0.1f);
|
||||||
_animator.SetTrigger(Move1);
|
_animator.SetTrigger("Move");
|
||||||
_animator.SetBool(Moving, _isMoving);
|
_animator.SetBool("isMoving", _isBusy);
|
||||||
_playerView.OnStep += () =>
|
|
||||||
{
|
|
||||||
_isMoving = false;
|
|
||||||
_cell.PaintHex(_color);
|
|
||||||
|
|
||||||
_animator.SetBool(Moving, _isMoving);
|
|
||||||
};
|
|
||||||
|
|
||||||
_instance.transform.DOMove(_cell.transform.position, _animLength.Move);
|
_instance.transform.DOMove(_cell.transform.position, _animLength.Move);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -75,13 +69,15 @@ namespace Chars
|
|||||||
{
|
{
|
||||||
switch (clip.name)
|
switch (clip.name)
|
||||||
{
|
{
|
||||||
case "Jump":
|
case "MoveJump":
|
||||||
_animLength.Move = clip.length;
|
_animLength.Move = clip.length;
|
||||||
break;
|
break;
|
||||||
|
case "Attack":
|
||||||
|
_animLength.Attack = clip.length;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,10 +98,33 @@ namespace Chars
|
|||||||
_isAlive = true;
|
_isAlive = true;
|
||||||
_animator = _instance.GetComponent<Animator>();
|
_animator = _instance.GetComponent<Animator>();
|
||||||
_playerView = _instance.GetComponent<PlayerView>();
|
_playerView = _instance.GetComponent<PlayerView>();
|
||||||
|
_charBar = _playerView.charBarCanvas.GetComponent<CharBar>();
|
||||||
SetAnimLength();
|
SetAnimLength();
|
||||||
|
_mana = 100f;
|
||||||
|
_playerView.OnStep += () =>
|
||||||
|
{
|
||||||
|
_isBusy = false;
|
||||||
|
_cell.PaintHex(_color);
|
||||||
|
_animator.SetBool("isMoving", _isBusy);
|
||||||
|
};
|
||||||
|
_playerView.OnAttackEnd += () =>
|
||||||
|
{
|
||||||
|
_isBusy = false;
|
||||||
|
_mana -= _weapon.manaCost;
|
||||||
|
UpdateCanvas();
|
||||||
|
var ball = Object.Instantiate(_weapon.objectToThrow,
|
||||||
|
_instance.transform.position + new Vector3(0, 2), Quaternion.identity);
|
||||||
|
ball.transform.DOMove(_cellEdge.transform.position + new Vector3(0, 2), _weapon.speed, false)
|
||||||
|
.OnComplete(() => { Object.Destroy(ball); });
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateCanvas()
|
||||||
|
{
|
||||||
|
_charBar.ManaBar.fillAmount = _mana / 100;
|
||||||
|
}
|
||||||
|
|
||||||
public void Death()
|
public void Death()
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -113,10 +132,20 @@ namespace Chars
|
|||||||
|
|
||||||
public void Attack(HexDirection direction)
|
public void Attack(HexDirection direction)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (_cell.GetNeighbor(direction))
|
||||||
|
{
|
||||||
|
_isBusy = true;
|
||||||
|
_instance.transform.DOLookAt(_cell.GetNeighbor(direction).transform.position, 0.1f);
|
||||||
|
_animator.SetTrigger("Attack");
|
||||||
|
_cellEdge = _cell.GetNeighbor(direction);
|
||||||
|
while (_cellEdge.GetNeighbor(direction) != null)
|
||||||
|
{
|
||||||
|
_cellEdge = _cellEdge.GetNeighbor(direction);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damag(float dmg)
|
public void Damage(float dmg)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ using Object = UnityEngine.Object;
|
|||||||
|
|
||||||
namespace Chars
|
namespace Chars
|
||||||
{
|
{
|
||||||
public class PlayerControl : IFixedExecute, IInitialization
|
public class PlayerControl : IFixedExecute, IExecute
|
||||||
{
|
{
|
||||||
private Player _player;
|
private Player _player;
|
||||||
private FloatingJoystick _moveJoystick;
|
private FloatingJoystick _moveJoystick;
|
||||||
@ -30,13 +30,18 @@ namespace Chars
|
|||||||
public void FixedExecute()
|
public void FixedExecute()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!_player.IsMoving && _moveJoystick.isPressed)
|
if (!_player.IsBusy && _moveJoystick.Direction != Vector2.zero)
|
||||||
{
|
{
|
||||||
_player.Move(VectorToDirection(_moveJoystick.Direction.normalized));
|
_player.Move(VectorToDirection(_moveJoystick.Direction.normalized));
|
||||||
_player.PlayerView.charBarCanvas.transform.LookAt(
|
|
||||||
_player.PlayerView.charBarCanvas.transform.position + _camera.transform.rotation * Vector3.back,
|
|
||||||
_camera.transform.rotation * Vector3.up);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_player.IsBusy && _attackJoystick.Direction != Vector2.zero)
|
||||||
|
{
|
||||||
|
_player.Attack(VectorToDirection(_attackJoystick.Direction.normalized));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static HexDirection VectorToDirection(Vector2 dir)
|
private static HexDirection VectorToDirection(Vector2 dir)
|
||||||
@ -74,7 +79,8 @@ namespace Chars
|
|||||||
return HexDirection.W;
|
return HexDirection.W;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Init()
|
|
||||||
|
public void Execute()
|
||||||
{
|
{
|
||||||
_player.PlayerView.charBarCanvas.transform.LookAt(
|
_player.PlayerView.charBarCanvas.transform.LookAt(
|
||||||
_player.PlayerView.charBarCanvas.transform.position + _camera.transform.rotation * Vector3.back,
|
_player.PlayerView.charBarCanvas.transform.position + _camera.transform.rotation * Vector3.back,
|
||||||
|
@ -14,7 +14,7 @@ namespace Controller
|
|||||||
controllers.Add(hexGrid);
|
controllers.Add(hexGrid);
|
||||||
hexGrid.OnHexPainted += DoSomething;
|
hexGrid.OnHexPainted += DoSomething;
|
||||||
|
|
||||||
Player player = new Player(data.PlayerData, hexGrid);
|
Player player = new Player(data.PlayerData, data.WeaponsData.WeaponsList[0], hexGrid);
|
||||||
|
|
||||||
List<IUnit> units = new List<IUnit> { player };
|
List<IUnit> units = new List<IUnit> { player };
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Chars;
|
using Chars;
|
||||||
|
using DefaultNamespace.Weapons;
|
||||||
using Runtime.Data;
|
using Runtime.Data;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
@ -14,7 +15,21 @@ namespace Data
|
|||||||
private CameraData _cameraData;
|
private CameraData _cameraData;
|
||||||
[SerializeField] private string playerDataPath;
|
[SerializeField] private string playerDataPath;
|
||||||
private PlayerData _playerData;
|
private PlayerData _playerData;
|
||||||
|
[SerializeField] private string weaponDataPath;
|
||||||
|
private WeaponsData _weaponData;
|
||||||
|
|
||||||
|
public WeaponsData WeaponsData
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_weaponData == null)
|
||||||
|
{
|
||||||
|
_weaponData = Load<WeaponsData>("Data/" + weaponDataPath);
|
||||||
|
}
|
||||||
|
|
||||||
|
return _weaponData;
|
||||||
|
}
|
||||||
|
}
|
||||||
public FieldData FieldData
|
public FieldData FieldData
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -12,6 +12,6 @@ public class FadeIn : MonoBehaviour
|
|||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
var back = GetComponent<Image>();
|
var back = GetComponent<Image>();
|
||||||
back.DOFade(0, 5).OnComplete(() => gameObject.SetActive(false));
|
back.DOFade(0, duration).OnComplete(() => gameObject.SetActive(false));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
24
Assets/Scripts/Weapons/WeaponsData.cs
Normal file
24
Assets/Scripts/Weapons/WeaponsData.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
namespace DefaultNamespace.Weapons
|
||||||
|
{
|
||||||
|
[CreateAssetMenu(fileName = "Weapons", menuName = "Data/Weapons", order = 0)]
|
||||||
|
public class WeaponsData : ScriptableObject
|
||||||
|
{
|
||||||
|
[SerializeField]
|
||||||
|
private List<Weapon> _weapons;
|
||||||
|
|
||||||
|
public List<Weapon> WeaponsList => _weapons;
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public struct Weapon
|
||||||
|
{
|
||||||
|
public GameObject objectToThrow;
|
||||||
|
public int manaCost;
|
||||||
|
public int damage;
|
||||||
|
public float speed;
|
||||||
|
}
|
||||||
|
}
|
3
Assets/Scripts/Weapons/WeaponsData.cs.meta
Normal file
3
Assets/Scripts/Weapons/WeaponsData.cs.meta
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b06259b938024e6e8a1f34610d0b60db
|
||||||
|
timeCreated: 1640106833
|
Loading…
x
Reference in New Issue
Block a user