move animation
This commit is contained in:
parent
26ea17872f
commit
313331f6b2
@ -866,7 +866,7 @@ AnimatorState:
|
||||
m_MirrorParameterActive: 0
|
||||
m_CycleOffsetParameterActive: 0
|
||||
m_TimeParameterActive: 0
|
||||
m_Motion: {fileID: 7400000, guid: 9dd3a0a7b64c33c45b2ff87106004a95, type: 2}
|
||||
m_Motion: {fileID: 7400000, guid: f4bfcb0bd8f4807429f6f6d3dd70cc15, type: 2}
|
||||
m_Tag:
|
||||
m_SpeedParameter:
|
||||
m_MirrorParameter:
|
||||
|
@ -19,5 +19,5 @@ MonoBehaviour:
|
||||
type: 3}
|
||||
joystickView: {fileID: 4385872142190176059, guid: 4df6913b39f4979429158c344680d83f,
|
||||
type: 3}
|
||||
Tick: 0.8
|
||||
Tick: 0.5
|
||||
hexTexture: {fileID: 2800000, guid: 0298dfcb0756f534a9a125d510461c7a, type: 3}
|
||||
|
@ -292,8 +292,8 @@ Transform:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 963194225}
|
||||
m_LocalRotation: {x: 0.2588191, y: 0, z: 0, w: 0.9659258}
|
||||
m_LocalPosition: {x: 15, y: 15, z: -10}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 14.935106, y: 1.1221166, z: 13.4063225}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using Data;
|
||||
using DG.Tweening;
|
||||
using HexFiled;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
@ -17,6 +18,8 @@ namespace Chars
|
||||
private HexGrid _hexGrid;
|
||||
private Texture _texture;
|
||||
public Action<GameObject> OnPlayerSpawned;
|
||||
private Animator _animator;
|
||||
private float _tick;
|
||||
|
||||
public GameObject Playerinstance => _instance;
|
||||
|
||||
@ -27,6 +30,7 @@ namespace Chars
|
||||
_isAlive = false;
|
||||
_hexGrid = hexGrid;
|
||||
_texture = playerData.hexTexture;
|
||||
_tick = playerData.Tick;
|
||||
}
|
||||
|
||||
|
||||
@ -36,8 +40,17 @@ namespace Chars
|
||||
{
|
||||
_cell = _cell.GetNeighbor(direction);
|
||||
_curentPosition = _cell.coordinates;
|
||||
_cell.PaintHex(_texture);
|
||||
_instance.transform.localPosition = _cell.transform.localPosition;
|
||||
|
||||
_instance.transform.LookAt(_cell.transform);
|
||||
_animator.SetTrigger("Move");
|
||||
_animator.SetBool("isMoving", true);
|
||||
_instance.transform.DOMove(_cell.transform.position, _tick).OnComplete(() =>
|
||||
{
|
||||
_animator.SetBool("isMoving", false);
|
||||
_animator.SetTrigger("Jump");
|
||||
_cell.PaintHex(_texture);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,6 +68,7 @@ namespace Chars
|
||||
_instance.transform.localPosition = _cell.transform.localPosition;
|
||||
OnPlayerSpawned?.Invoke(_instance);
|
||||
_isAlive = true;
|
||||
_animator = _instance.GetComponent<Animator>();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,10 +27,12 @@ namespace Chars
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
|
||||
if (Time.time - _curTime >= _tick && _moveJoystick.Direction != Vector2.zero)
|
||||
{
|
||||
_curTime = Time.time;
|
||||
_player.Move(VectorToDirection(_moveJoystick.Direction.normalized));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,4 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace HexFiled
|
||||
namespace HexFiled
|
||||
{
|
||||
public static class HexMetrics {
|
||||
|
||||
|
@ -257,7 +257,14 @@ PlayerSettings:
|
||||
AndroidMinifyDebug: 0
|
||||
AndroidValidateAppBundleSize: 1
|
||||
AndroidAppBundleSizeToValidate: 150
|
||||
m_BuildTargetIcons: []
|
||||
m_BuildTargetIcons:
|
||||
- m_BuildTarget:
|
||||
m_Icons:
|
||||
- serializedVersion: 2
|
||||
m_Icon: {fileID: 2800000, guid: 5bb37d3bcba28fc41a02b3dfb56cccec, type: 3}
|
||||
m_Width: 128
|
||||
m_Height: 128
|
||||
m_Kind: 0
|
||||
m_BuildTargetPlatformIcons:
|
||||
- m_BuildTarget: Android
|
||||
m_Icons:
|
||||
@ -647,6 +654,7 @@ PlayerSettings:
|
||||
ps4videoRecordingFeaturesUsed: 0
|
||||
ps4contentSearchFeaturesUsed: 0
|
||||
ps4CompatibilityPS5: 0
|
||||
ps4AllowPS5Detection: 0
|
||||
ps4GPU800MHz: 1
|
||||
ps4attribEyeToEyeDistanceSettingVR: 0
|
||||
ps4IncludedModules: []
|
||||
|
Loading…
x
Reference in New Issue
Block a user