migration from new repo
This commit is contained in:
commit
423134a840
26930 changed files with 3458568 additions and 0 deletions
108
Assets/_/Features/Player/Runtime/Deplacements.cs
Normal file
108
Assets/_/Features/Player/Runtime/Deplacements.cs
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
using System.Timers;
|
||||
using Core.Runtime;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace Player.Runtime
|
||||
{
|
||||
public class Deplacements : BaseMonobehaviour
|
||||
{
|
||||
|
||||
#region Publics
|
||||
|
||||
//
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Unity API
|
||||
|
||||
private void Start()
|
||||
{
|
||||
_agent = GetComponent<UnityEngine.AI.NavMeshAgent>();
|
||||
_animator = GetComponent<Animator>();
|
||||
GoToCurrentTarget();
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
_animator.SetFloat("Speed", _agent.speed);
|
||||
_timer += Time.deltaTime;
|
||||
|
||||
if (_isMoving)
|
||||
{
|
||||
if (_timer >= _moveDuration)
|
||||
{
|
||||
StopMoving();
|
||||
_agent.speed = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_timer >= _pauseDuration)
|
||||
{
|
||||
_agent.speed = 2;
|
||||
GoToCurrentTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Main Methods
|
||||
|
||||
private void GoToCurrentTarget()
|
||||
{
|
||||
_timer = 0f;
|
||||
_isMoving = true;
|
||||
_agent.isStopped = false;
|
||||
|
||||
// Choisir un point aléatoire dans la zone définie
|
||||
Vector3 randomTarget = new Vector3(
|
||||
Random.Range(_zoneXZMin.x, _zoneXZMax.x),
|
||||
transform.position.y,
|
||||
Random.Range(_zoneXZMin.y, _zoneXZMax.y)
|
||||
);
|
||||
|
||||
_agent.SetDestination(randomTarget);
|
||||
}
|
||||
|
||||
private void StopMoving()
|
||||
{
|
||||
_timer = 0f;
|
||||
_isMoving = false;
|
||||
_agent.isStopped = true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utils
|
||||
|
||||
/* Fonctions privées utiles */
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Privates and Protected
|
||||
|
||||
[FormerlySerializedAs("zoneXZMin")]
|
||||
[Header("Zone de déplacement aléatoire")]
|
||||
[SerializeField] private Vector2 _zoneXZMin = new Vector2(-10f, -10f);
|
||||
[FormerlySerializedAs("zoneXZMax")]
|
||||
[SerializeField] private Vector2 _zoneXZMax = new Vector2(10f, 10f);
|
||||
|
||||
[FormerlySerializedAs("moveDuration")]
|
||||
[SerializeField] private float _moveDuration = 3f;
|
||||
[FormerlySerializedAs("pauseDuration")]
|
||||
[SerializeField] private float _pauseDuration = 2f;
|
||||
|
||||
private UnityEngine.AI.NavMeshAgent _agent;
|
||||
private float _timer = 0f;
|
||||
private bool _isMoving = true;
|
||||
private Animator _animator;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/Player/Runtime/Deplacements.cs.meta
Normal file
3
Assets/_/Features/Player/Runtime/Deplacements.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 8df21a82aab04a5b85f770d843b22ae9
|
||||
timeCreated: 1753966942
|
||||
16
Assets/_/Features/Player/Runtime/Player.Runtime.asmdef
Normal file
16
Assets/_/Features/Player/Runtime/Player.Runtime.asmdef
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
{
|
||||
"name": "Player.Runtime",
|
||||
"rootNamespace": "Player.Runtime",
|
||||
"references": [
|
||||
"GUID:2ca720bbf8aa349608caa5ce4acaa603"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 4a640bb60ad60478bba0cc41f9b80929
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
49
Assets/_/Features/Player/Runtime/PlayerClass.cs
Normal file
49
Assets/_/Features/Player/Runtime/PlayerClass.cs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
namespace Player.Runtime
|
||||
{
|
||||
public class PlayerClass
|
||||
{
|
||||
public string GuildName
|
||||
{
|
||||
get { return _guildName; }
|
||||
set { _guildName = value; }
|
||||
}
|
||||
|
||||
public int GuildLevel
|
||||
{
|
||||
get { return _guildLevel; }
|
||||
set { _guildLevel = value; }
|
||||
}
|
||||
|
||||
public int Money
|
||||
{
|
||||
get { return _money; }
|
||||
set { _money = value; }
|
||||
}
|
||||
|
||||
public int AdventurersMax
|
||||
{
|
||||
get { return _adventurersMax; }
|
||||
set { _adventurersMax = value; }
|
||||
}
|
||||
|
||||
public int AdventurersCount
|
||||
{
|
||||
get { return _adventurersCount; }
|
||||
set { _adventurersCount = value; }
|
||||
}
|
||||
|
||||
string _guildName;
|
||||
int _guildLevel;
|
||||
int _money;
|
||||
int _adventurersMax;
|
||||
int _adventurersCount;
|
||||
|
||||
public PlayerClass(string guildName, int guildLevel, int money, int adventurersMax)
|
||||
{
|
||||
_guildName = guildName.Trim();
|
||||
_guildLevel = guildLevel;
|
||||
_money = money;
|
||||
_adventurersMax = adventurersMax;
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/_/Features/Player/Runtime/PlayerClass.cs.meta
Normal file
3
Assets/_/Features/Player/Runtime/PlayerClass.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9da827f7c32645c1ad4ce947588e6cff
|
||||
timeCreated: 1754049032
|
||||
Loading…
Add table
Add a link
Reference in a new issue