Initial Commit
This commit is contained in:
commit
ee5c2f922d
2255 changed files with 547750 additions and 0 deletions
33
Assets/Scripts/StateMachine/ItemUseStateBehaviour.cs
Normal file
33
Assets/Scripts/StateMachine/ItemUseStateBehaviour.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
using DefaultNamespace;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
|
||||
namespace StateMachine
|
||||
{
|
||||
public class ItemUseStateBehaviour : StateMachineBehaviour
|
||||
{
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
|
||||
{
|
||||
var actorFacade = animator.GetComponent<ActorFacade>();
|
||||
if (actorFacade != null)
|
||||
{
|
||||
var entityManager = actorFacade.World.EntityManager;
|
||||
var entity = actorFacade.Entity;
|
||||
|
||||
if (entityManager != null && entityManager.Exists(entity))
|
||||
{
|
||||
if (entityManager.HasComponent<ActorAnimationEventData>(entity))
|
||||
{
|
||||
var data = entityManager.GetComponentData<ActorAnimationEventData>(entity);
|
||||
data.ItemUsedCancled = true;
|
||||
entityManager.SetComponentData(entity, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityManager.AddComponentData(entity, new ActorAnimationEventData { ItemUsedCancled = true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/StateMachine/ItemUseStateBehaviour.cs.meta
Normal file
11
Assets/Scripts/StateMachine/ItemUseStateBehaviour.cs.meta
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 0197f74b46954664c80cca2accb18fe2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
34
Assets/Scripts/StateMachine/PickupStateBehaviour.cs
Normal file
34
Assets/Scripts/StateMachine/PickupStateBehaviour.cs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
using DefaultNamespace;
|
||||
using Unity.Entities;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Animations;
|
||||
|
||||
namespace StateMachine
|
||||
{
|
||||
public class PickupStateBehaviour : StateMachineBehaviour
|
||||
{
|
||||
public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex, AnimatorControllerPlayable controller)
|
||||
{
|
||||
var gameObjectEntity = animator.GetComponent<GameObjectEntity>();
|
||||
if (gameObjectEntity != null)
|
||||
{
|
||||
var entityManager = gameObjectEntity.EntityManager;
|
||||
var entity = gameObjectEntity.Entity;
|
||||
|
||||
if (entityManager != null && entityManager.Exists(entity))
|
||||
{
|
||||
if (entityManager.HasComponent<ActorAnimationEventData>(entity))
|
||||
{
|
||||
var data = entityManager.GetComponentData<ActorAnimationEventData>(entity);
|
||||
data.PickedCanceled = true;
|
||||
entityManager.SetComponentData(entity, data);
|
||||
}
|
||||
else
|
||||
{
|
||||
entityManager.AddComponentData(entity, new ActorAnimationEventData { PickedCanceled = true });
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/StateMachine/PickupStateBehaviour.cs.meta
Normal file
3
Assets/Scripts/StateMachine/PickupStateBehaviour.cs.meta
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
fileFormatVersion: 2
|
||||
guid: a1935f1308c648ed82b9ece45c705b79
|
||||
timeCreated: 1534239155
|
||||
Loading…
Add table
Add a link
Reference in a new issue