Initial Commit

This commit is contained in:
Simeon Radivoev 2022-02-12 12:53:50 +02:00
commit ee5c2f922d
Signed by: simeonradivoev
GPG key ID: 7611A451D2A5D37A
2255 changed files with 547750 additions and 0 deletions

View file

@ -0,0 +1,55 @@
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
public struct ActorAnimationData : IComponentData
{
public float WalkDir;
public float WalkMultiply;
public float StepTimer;
public float LastStepSign;
public float AttackSpeed;
public float LastRotation;
public float LastGunRotation;
public float LastHeadRotation;
public bool1 Landed;
public AnimationTriggerType Triggers;
public ItemUseType UseType;
public bool1 ItemUseAdditive;
public EmotionType Emotion;
public float EmotionTimer;
public float LookWeight;
public float HeadLookWeight;
}
public class ActorAnimationDataComponent : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField, Range(0, 1)] private float HeadLookWeight = 1;
[SerializeField, Range(0, 1)] private float LookWeight = 1;
private Entity m_entity;
private EntityManager m_entityManager;
private void Update()
{
if (m_entityManager != null && m_entityManager.Exists(m_entity) && m_entityManager.HasComponent<ActorAnimationData>(m_entity))
{
var val = m_entityManager.GetComponentData<ActorAnimationData>(m_entity);
val.LookWeight = LookWeight;
val.HeadLookWeight = HeadLookWeight;
m_entityManager.SetComponentData(m_entity, val);
}
}
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
m_entity = entity;
m_entityManager = dstManager;
dstManager.AddComponentData(entity, new ActorAnimationData { Landed = true });
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1c72c6bf622d4206a4da5465adbcc92c
timeCreated: 1531333408

View file

@ -0,0 +1,61 @@
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
public struct ActorAnimationEventData : IComponentData
{
public bool1 Attacked;
public bool1 PickedUp;
public bool1 PickedCanceled;
public bool1 Melee;
public bool1 ItemUsed;
public bool1 ItemUsedCancled;
}
public class ActorAnimationEventComponent : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField] private Entity m_entity;
private EntityManager m_entityManager;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
m_entity = entity;
dstManager.AddComponent<ActorAnimationEventData>(entity);
m_entityManager = dstManager;
}
//animator callback
public void Attack()
{
PostEvent((ref ActorAnimationEventData d) => d.Attacked = true);
}
//animator callback
public void Pickup()
{
PostEvent((ref ActorAnimationEventData d) => d.PickedUp = true);
}
//animator callback
public void Melee()
{
PostEvent((ref ActorAnimationEventData d) => d.Melee = true);
}
//animator callback
public void UseItem()
{
PostEvent((ref ActorAnimationEventData d) => d.ItemUsed = true);
}
private void PostEvent(EntityCommandBufferExtensions.ModifyData<ActorAnimationEventData> eAction)
{
if (m_entityManager != null && m_entityManager.Exists(m_entity))
{
m_entityManager.PostEntityEvent(m_entity, eAction);
}
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ebc072dcce7d48a88505b0e354107676
timeCreated: 1532182486

View file

@ -0,0 +1,26 @@
using System;
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
[Serializable]
public struct ActorAnimationPropertiesData : ISharedComponentData
{
public Vector2 HipAngleRange;
public Vector2 WeaponAngleRange;
public Vector2 HeadAngleRange;
public float HeadRotationOffset;
public Vector2 HeadForward;
}
public class ActorAnimationPropertiesDataComponent : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField] private ActorAnimationPropertiesData m_SerializedData;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddSharedComponentData(entity, m_SerializedData);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 18b11bf53e5240169675470279b0508f
timeCreated: 1531221505

View file

@ -0,0 +1,12 @@
using System;
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct ActorBoundsData : IComponentData
{
[NonSerialized] public Rect Rect;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 16af98b6babd4a548bb86d67de63e106
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,23 @@
using DefaultNamespace;
using Unity.Entities;
using UnityEngine;
public struct ActorData : IComponentData
{
public Vector2 Aim;
public Vector2 GroundUp;
public bool1 Grounded;
public float GroundDinstance;
public Vector2 Look;
public float Health;
}
public class ActorComponent : ComponentDataProxy<ActorData>
{
private void Awake()
{
var val = Value;
val.Grounded = true;
Value = val;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a462e4757eef4e0d8b328486876b6d78
timeCreated: 1531167500

View file

@ -0,0 +1,17 @@
using Unity.Entities;
namespace DefaultNamespace
{
/// <summary>
/// Used to keep GO for some time to do fancy animations.
/// If this component is not present the GO is destroyed instantly.
/// </summary>
[GenerateAuthoringComponent]
public struct ActorDeathAnimationData : IComponentData
{
/// <summary>
/// The amount of time in seconds the GO should remain.
/// </summary>
public float Time;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: e28fcfc7c8964385b6fc2284f4101356
timeCreated: 1533839522

View file

@ -0,0 +1,11 @@
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
public struct ActorDeathData : IComponentData
{
public Vector2 Direction;
public float Force;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ec67e24d4cca4530b3a94d83d355ff0a
timeCreated: 1533842958

View file

@ -0,0 +1,9 @@
using Unity.Entities;
namespace DefaultNamespace
{
public struct ActorGrenadeData : IComponentData
{
public float GrenadeTimer;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: d446da21ec3c4cc19f22c291c7327a76
timeCreated: 1534253886

View file

@ -0,0 +1,11 @@
using System;
using Unity.Entities;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct ActorMeleeData : IComponentData
{
[NonSerialized] public float MeleeTimer;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 143d3ba90a2544039d3013a621f2ed0c
timeCreated: 1533242315

View file

@ -0,0 +1,37 @@
using System;
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
[Serializable]
public struct ActorMeleeSharedData : ISharedComponentData
{
public LayerMask MeleeMask;
public float Range;
public float Angle;
public float Damage;
public float Knockback;
public float Cooldown;
}
public class ActorMeleeSharedDataComponent : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField] private ActorMeleeSharedData m_SerializedData;
private void OnDrawGizmos()
{
Gizmos.DrawLine(
transform.position,
transform.position - Quaternion.Euler(0, 0, m_SerializedData.Angle * 0.5f) * transform.right * m_SerializedData.Range);
Gizmos.DrawLine(
transform.position,
transform.position - Quaternion.Euler(0, 0, -m_SerializedData.Angle * 0.5f) * transform.right * m_SerializedData.Range);
}
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddSharedComponentData(entity, m_SerializedData);
}
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 1510ecf2e3864138bc4f83f56694bbbd
timeCreated: 1532636662

View file

@ -0,0 +1,14 @@
using Trive.Core;
using Unity.Entities;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct ActorNpcData : IComponentData
{
public float AttackCooldown;
public float ActionCooldown;
public float JumpingTimer;
public PIDFloat XPid;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 98d1febc8f35485292eca066f16b1db4
timeCreated: 1533384927

View file

@ -0,0 +1,10 @@
using Unity.Entities;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct ActorTargetData : IComponentData
{
public Entity Target;
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: f69ba83d17d14a50b51bd53c42b19c24
timeCreated: 1533316695

View file

@ -0,0 +1,12 @@
using Unity.Entities;
namespace DefaultNamespace
{
public struct ActorWeaponAccuracyData : IComponentData
{
public float Accuracy;
public float AccuracyMultiply;
public float AccuracyAttackTime;
public float AccuracyRegainSpeed;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6c4b4f69b8f01a44f969e2f466da97e6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,14 @@
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
/// <summary>
/// Controls what other entities can it shoot
/// </summary>
[GenerateAuthoringComponent]
public struct ActorWeaponData : IComponentData
{
public LayerMask ProjectileMask;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: f72ae9c9024a9a24f8f4ac1861c46bfa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,41 @@
using Items;
using System;
using Unity.Entities;
using UnityEngine;
using Hash128 = Unity.Entities.Hash128;
[Serializable]
public struct ActorWeaponPropertiesData : ISharedComponentData, IEquatable<ActorWeaponPropertiesData>
{
public RangedWeaponItem Weapon;
public Hash128 Id { get; set; }
public bool Equals(ActorWeaponPropertiesData other)
{
return Equals(Weapon, other.Weapon) && Id.Equals(other.Id);
}
public override bool Equals(object obj)
{
return obj is ActorWeaponPropertiesData other && Equals(other);
}
public override int GetHashCode()
{
unchecked
{
return ((Weapon != null ? Weapon.GetHashCode() : 0) * 397) ^ Id.GetHashCode();
}
}
}
public class ActorWeaponPropertiesDataComponent : MonoBehaviour, IConvertGameObjectToEntity
{
[SerializeField] private ActorWeaponPropertiesData m_SerializedData;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddSharedComponentData(entity, m_SerializedData);
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b5927b1a88d9374baa4562fbb64e2db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
using Unity.Entities;
namespace DefaultNamespace
{
public struct ActorWeaponReferenceData : IComponentData
{
public Entity Weapon;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 2d1a57d05728a7c4f95196269711e85b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,11 @@
using Unity.Entities;
using UnityEngine;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct AimCenterData : IComponentData
{
public Vector2 Offset;
}
}

View file

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 32ffc1608d0dbe04e871e7f0876e046d
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View file

@ -0,0 +1,9 @@
using Unity.Entities;
namespace DefaultNamespace
{
[GenerateAuthoringComponent]
public struct Enemy : IComponentData
{
}
}

View file

@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 445bb6d4128b494996f99212eca9fae2
timeCreated: 1531149457