working on enemies

This commit is contained in:
2025-08-20 05:06:00 +02:00
parent f6a4db7b4d
commit fb1c3f8290
619 changed files with 46709 additions and 668 deletions

View File

@@ -1,22 +1,25 @@
using RebootKit.Engine.Main;
using System;
using System.Collections.Generic;
using RebootKit.Engine.Main;
using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation;
using RebootReality.jelycho.InfectedArea;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AddressableAssets;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho.Beacons {
public class BaseManagerActorData : IActorData {
public void Serialize(NetworkBufferWriter writer) {
}
public void Deserialize(NetworkBufferReader reader) {
}
public void Serialize(NetworkBufferWriter writer) { }
public void Deserialize(NetworkBufferReader reader) { }
public int GetMaxBytes() {
return 0;
}
}
public enum BaseManagerActorCommands : byte {
None = 0x00,
SpawnBeacon = 0x01,
@@ -24,11 +27,11 @@ namespace RebootReality.jelycho.Beacons {
public struct SpawnBeaconCommandData : ISerializableEntity {
public Vector3 Position;
public void Serialize(NetworkBufferWriter writer) {
writer.Write(Position);
}
public void Deserialize(NetworkBufferReader reader) {
reader.Read(out Position);
}
@@ -37,8 +40,12 @@ namespace RebootReality.jelycho.Beacons {
return sizeof(float) * 3;
}
}
public class BaseManagerActor : Actor {
static readonly Logger s_Logger = new Logger(nameof(BaseManagerActor));
[field: SerializeField] public MotherActor Mother { get; private set; }
[SerializeField] AssetReferenceGameObject m_BeaconPrefab;
[SerializeField] float m_ConnectionRopeLength = 10.0f;
[SerializeField] float m_BeaconSpawnRadius = 15.0f;
@@ -47,21 +54,44 @@ namespace RebootReality.jelycho.Beacons {
[SerializeField] float m_BeaconSpawnShakeRadius = 20.0f;
[SerializeField] float m_BeaconSpawnShakeDuration = 1.0f;
readonly List<Beacon> m_Beacons = new List<Beacon>();
void Start() {
if (RR.World.Context is WorldContext worldContext) {
worldContext.InfectedAreaManager.Add(Mother.transform.position, m_BeaconSpawnRadius);
}
}
protected override IActorData CreateActorData() {
return new BaseManagerActorData();
}
protected override void OnActorCommandServer(ulong senderID, ActorCommand actorCommand) {
if (actorCommand.CommandID == (byte)BaseManagerActorCommands.SpawnBeacon) {
if (actorCommand.CommandID == (byte) BaseManagerActorCommands.SpawnBeacon) {
SpawnBeaconCommandData commandData = new SpawnBeaconCommandData();
DataSerializationUtils.Deserialize(actorCommand.Data, ref commandData);
RR.SpawnActor(m_BeaconPrefab, commandData.Position, Quaternion.identity);
Transform closestGutConnector = FindClosestGutConnector(commandData.Position);
if (closestGutConnector == null) {
return;
}
Actor beaconActor = RR.SpawnActor(m_BeaconPrefab, commandData.Position, Quaternion.identity);
if (beaconActor is not Beacon beacon) {
s_Logger.Info($"Cannot spawn beacon at position: {commandData.Position}");
return;
}
m_Beacons.Add(beacon);
ConnectGut(beacon.GutConnector, closestGutConnector);
if (RR.World.Context is WorldContext worldContext) {
worldContext.FeedbacksManager.ShakeCamera(commandData.Position,
m_BeaconSpawnRadius,
m_BeaconSpawnShakeIntensity,
m_BeaconSpawnShakeDuration);
worldContext.InfectedAreaManager.Add(commandData.Position, m_BeaconSpawnRadius);
}
}
}
@@ -71,7 +101,34 @@ namespace RebootReality.jelycho.Beacons {
Position = position
};
SendActorCommand((byte)BaseManagerActorCommands.SpawnBeacon, ref commandData);
SendActorCommand((byte) BaseManagerActorCommands.SpawnBeacon, ref commandData);
}
Transform FindClosestGutConnector(float3 position) {
float spawnRadiusSq = m_BeaconSpawnRadius * m_BeaconSpawnRadius;
float closestDistanceSq = math.distancesq(position, Mother.transform.position);
Transform connector = null;
if (closestDistanceSq < spawnRadiusSq) {
connector = Mother.GutConnector;
}
foreach (Beacon beacon in m_Beacons) {
float beaconDistSq = math.distancesq(position, beacon.transform.position);
if (beaconDistSq < closestDistanceSq) {
closestDistanceSq = beaconDistSq;
connector = beacon.GutConnector;
}
}
return connector;
}
void ConnectGut(Transform connectorA, Transform connectorB) {
if (RR.World.Context is WorldContext worldContext) {
worldContext.RopesManager.SpawnRope(connectorA.position, connectorB.position, true, true);
}
}
}
}

View File

@@ -4,7 +4,7 @@ using UnityEngine;
namespace RebootReality.jelycho.Beacons {
public class Beacon : Actor {
[SerializeField] BeaconGraphics m_Graphics;
[field: SerializeField] public Transform RopeConnectionPoint { get; private set; }
[field: SerializeField] public Transform GutConnector { get; private set; }
void Start() {
m_Graphics.Grow();

View File

@@ -0,0 +1,50 @@
using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Enemies;
using UnityEngine;
namespace RebootReality.jelycho.Beacons {
public class MotherActorData : IActorData {
public ulong Health;
public float HungerLevel;
public int GetMaxBytes() {
return sizeof(ulong) +
sizeof(float);
}
public void Serialize(NetworkBufferWriter writer) {
writer.Write(Health);
writer.Write(HungerLevel);
}
public void Deserialize(NetworkBufferReader reader) {
reader.Read(out Health);
reader.Read(out HungerLevel);
}
}
public class MotherActor : Actor, IKillable {
MotherActorData m_ActorData = new MotherActorData();
[field: SerializeField] public Transform GutConnector { get; private set; }
//
// @MARK: Actor
//
protected override IActorData CreateActorData() {
return m_ActorData;
}
//
// @MARK: IKillable
//
public bool IsAlive() {
return m_ActorData.Health > 0;
}
public ulong OnHit(Actor attacker, ulong damage) {
return damage;
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 18d3888d591847098197a645fe279b2f
timeCreated: 1754955025

View File

@@ -0,0 +1,10 @@
using RebootKit.Engine.Simulation;
namespace RebootReality.jelycho.Enemies {
public interface IKillable {
bool IsAlive();
// @NOTE: Returns damage dealt
ulong OnHit(Actor attacker, ulong damage);
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 5449b1adab2f474b9d7a25cb59c66e6d
timeCreated: 1754955332

View File

@@ -0,0 +1,68 @@
using System.Collections.Generic;
using RebootKit.Engine.Extensions;
using RebootKit.Engine.Main;
using RebootKit.Engine.Simulation;
using Unity.Collections;
using UnityEngine;
using UnityEngine.AddressableAssets;
namespace RebootReality.jelycho.Enemies {
public class WavesManagerActor : Actor {
[SerializeField] AssetReferenceGameObject[] m_ZombiesPrefabs;
[SerializeField] Transform[] m_SpawnPoints;
[SerializeField] float m_SpawnRate = 32;
[SerializeField] int m_MaxZombies = 1000;
int m_Stage;
int m_ZombiesToSpawn;
float m_SpawnTimer;
readonly List<ZombieActor> m_AliveZombies = new List<ZombieActor>(128);
//
// @MARK: Waves Manager
//
public void StartWave(int stage) {
m_Stage = stage;
m_ZombiesToSpawn = stage * 10;
m_SpawnTimer = 1.0f;
}
void SpawnZombieAtRandomPosition() {
Transform spawnPoint = m_SpawnPoints.Random();
ZombieActor zombieActor = (ZombieActor) RR.SpawnActor(m_ZombiesPrefabs.Random(), spawnPoint.position, spawnPoint.rotation);
zombieActor.died.AddListener(() => {
m_AliveZombies.RemoveSwapBack(zombieActor);
});
m_AliveZombies.Add(zombieActor);
}
//
// @MARK: IActor
//
protected override IActorData CreateActorData() {
return new NoActorData();
}
public override void OnServerTick(float deltaTime) {
base.OnServerTick(deltaTime);
if (m_ZombiesToSpawn <= 0) {
return;
}
if (m_AliveZombies.Count >= m_MaxZombies) {
return;
}
m_SpawnTimer -= deltaTime;
if (m_SpawnTimer <= 0.0f) {
SpawnZombieAtRandomPosition();
m_ZombiesToSpawn -= 1;
m_SpawnTimer = 1.0f / m_SpawnRate;
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 554400bcdd2649daa241c7ba9c4884dd
timeCreated: 1755566821

View File

@@ -1,8 +1,13 @@
using System;
using RebootKit.Engine.Extensions;
using RebootKit.Engine.Main;
using RebootKit.Engine.Network;
using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Player;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho.Enemies {
@@ -18,21 +23,39 @@ namespace RebootReality.jelycho.Enemies {
}
}
public interface IKillable {
bool IsAlive();
float OnHit(Actor attacker, float damage);
}
public class ZombieActor : Actor, IKillable {
static readonly Logger s_Logger = new Logger(nameof(ZombieActor));
static readonly int s_MovementSpeedHash = Animator.StringToHash("MovementSpeed");
enum AIState {
Idle,
Dead,
AttackBase,
AttackCharacter,
PanicEscape,
Berserk
}
[SerializeField] Animator m_Animator;
[SerializeField] NavMeshAgent m_NavAgent;
[SerializeField] Collider[] m_RagdollColliders;
[SerializeField] Rigidbody[] m_RagdollRigidbodies;
[SerializeField] Collider[] m_Hitboxes;
[SerializeField] float m_MaxAttackDistance = 1.0f;
[SerializeField] float m_LoseInterestMinDistance = 10.0f;
[SerializeField] ulong m_BaseDamage = 10;
[SerializeField] float m_AttackDelay = 1.0f;
AIState m_State = AIState.Idle;
PlayerActor m_PlayerTarget;
float m_NextAttackTimer;
public UnityEvent died = new UnityEvent();
//
// @MARK: Unity callbacks
@@ -40,6 +63,151 @@ namespace RebootReality.jelycho.Enemies {
void Awake() {
SetRagdollLocal(false);
}
//
// @MARK: Actor
//
public override void OnClientTick(float deltaTime) {
base.OnClientTick(deltaTime);
if (!IsAlive()) {
return;
}
float velXZ = m_NavAgent.velocity.With(y: 0).magnitude;
m_Animator.SetFloat(s_MovementSpeedHash, velXZ);
}
public override void OnServerTick(float deltaTime) {
base.OnServerTick(deltaTime);
if (RR.World.Context is not WorldContext world) {
s_Logger.Error("Invalid world context");
return;
}
switch (m_State) {
case AIState.Idle: {
ServerTickIdle(deltaTime);
break;
}
case AIState.AttackBase: {
ServerTickAttackBase(deltaTime);
break;
}
case AIState.AttackCharacter: {
ServerTickAttackCharacter(deltaTime);
break;
}
case AIState.PanicEscape: {
break;
}
case AIState.Berserk: {
ServerTickBerserk(deltaTime);
break;
}
}
}
//
// @MARK: Zombie
//
void ServerTickIdle(float dt) {
(PlayerActor playerActor, float distSqToPlayer) = FindClosestPlayerActor(transform.position);
if (playerActor == null || distSqToPlayer >= m_LoseInterestMinDistance * m_LoseInterestMinDistance) {
return;
}
m_State = AIState.AttackCharacter;
m_PlayerTarget = playerActor;
s_Logger.Info($"Found player actor to attack: {m_PlayerTarget}");
m_NavAgent.SetDestination(m_PlayerTarget.transform.position);
m_NavAgent.isStopped = false;
}
void ServerTickAttackCharacter(float dt) {
if (m_PlayerTarget == null || !m_PlayerTarget.IsAlive()) {
SetIdleState();
return;
}
float3 playerPos = m_PlayerTarget.transform.position;
float3 zombiePos = transform.position;
float distToPlayerSq = math.distancesq(playerPos, zombiePos);
if (distToPlayerSq >= m_LoseInterestMinDistance * m_LoseInterestMinDistance) {
SetIdleState();
return;
}
if (distToPlayerSq <= m_MaxAttackDistance * m_MaxAttackDistance) {
m_NextAttackTimer -= dt;
if (m_NextAttackTimer <= 0.0f) {
m_Animator.CrossFade("Attack_0", 0.0f, 0);
m_NextAttackTimer = m_AttackDelay;
}
if (!m_NavAgent.isStopped) {
m_NavAgent.isStopped = true;
}
return;
}
float distFromDstToTargetSq = math.distancesq(playerPos, m_NavAgent.destination);
if (distFromDstToTargetSq > 1.0f) {
m_NavAgent.isStopped = false;
m_NavAgent.SetDestination(m_PlayerTarget.transform.position);
}
}
void ServerTickAttackBase(float dt) {
}
void ServerTickBerserk(float dt) {
}
void SetIdleState() {
m_PlayerTarget = null;
m_State = AIState.Idle;
}
void Die() {
s_Logger.Info("Die");
EnableRagdoll();
m_State = AIState.Dead;
died.Invoke();
}
(PlayerActor, float) FindClosestPlayerActor(float3 origin) {
if (RR.World.Context is not WorldContext context) {
return (null, -1.0f);
}
PlayerActor res = null;
float closestDistanceSq = float.MaxValue;
foreach (Actor actor in RR.Actors()) {
if (actor is not PlayerActor playerActor) {
continue;
}
float distSq = math.distancesq(actor.transform.position, origin);
if (distSq < closestDistanceSq) {
res = playerActor;
closestDistanceSq = distSq;
}
}
return (res, closestDistanceSq);
}
//
// @MARK: Actor
@@ -85,29 +253,29 @@ namespace RebootReality.jelycho.Enemies {
//
// @MARK: IKillable
//
public float Health { get; private set; } = 100.0f;
public ulong Health { get; private set; } = 100;
public bool IsAlive() {
return Health > 0.0f;
return Health > 0;
}
public float OnHit(Actor attacker, float damage) {
public ulong OnHit(Actor attacker, ulong damage) {
if (!RR.IsServer()) {
s_Logger.Error("OnHit can only be called on the server.");
return 0.0f;
return 0;
}
if (!IsAlive()) {
return 0.0f;
return 0;
}
s_Logger.Info($"Hit: {damage}");
damage = math.min(damage, Health);
Health -= damage;
if (Health <= 0.0f) {
s_Logger.Info("Die");
EnableRagdoll();
return damage - Mathf.Abs(Health);
if (Health <= 0) {
Die();
return damage;
}
return damage;

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: dc4d1f6b80d3495fb6f769d7d6f522ac
timeCreated: 1754960964

View File

@@ -0,0 +1,33 @@
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEngine;
namespace RebootReality.jelycho.InfectedArea {
public class InfectedAreaInfo {
public float3 Center;
public float Radius;
public ParticleSystem ParticleSystem;
}
public class InfectedAreaManager : MonoBehaviour {
[SerializeField] ParticleSystem m_ParticlesPrefab;
public readonly List<InfectedAreaInfo> InfectedAreas = new List<InfectedAreaInfo>();
public void Add(float3 center, float radius) {
ParticleSystem ps = Instantiate(m_ParticlesPrefab, center, Quaternion.identity);
ParticleSystem.ShapeModule shapeModule = ps.shape;
shapeModule.radius = radius;
ps.Play();
InfectedAreaInfo info = new InfectedAreaInfo {
Center = center,
Radius = radius,
ParticleSystem = ps
};
InfectedAreas.Add(info);
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 50204864deec444b894e83b64bcfb2da
timeCreated: 1754970262

View File

@@ -0,0 +1,161 @@
using System.Collections.Generic;
using RebootKit.Engine.Main;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Experimental.Rendering;
using UnityEngine.Rendering;
using UnityEngine.Rendering.RendererUtils;
using UnityEngine.Rendering.RenderGraphModule;
using UnityEngine.Rendering.RenderGraphModule.Util;
using UnityEngine.Rendering.Universal;
namespace RebootReality.jelycho.InfectedArea {
class InfectedAreaRenderPass : ScriptableRenderPass {
const string k_InfectedTextureName = "_InfectedTexture";
const string k_InfectedRenderPass = "InfectedRenderPass";
const string k_CompositeInfectedRenderPass = "CompositeInfectedRenderPass";
class MainPassData {
internal List<InfectedAreaInfo> Areas;
internal Material Material;
internal int PassIndex;
}
class CompositePassData {
internal Material Material;
internal int PassIndex;
internal TextureHandle FrameTexture;
internal TextureHandle InfectedTexture;
}
static MaterialPropertyBlock s_SharedPropertyBlock = new MaterialPropertyBlock();
static readonly int s_Center = Shader.PropertyToID("_Center");
static readonly int s_Radius = Shader.PropertyToID("_Radius");
static readonly int s_FrameTexture = Shader.PropertyToID("_FrameTexture");
static readonly int s_InfectedTexture = Shader.PropertyToID("_InfectedTexture");
Material m_Material;
Material m_CompositeMaterial;
Shader m_StencilShader;
public InfectedAreaRenderPass(Material material, Material compositeMaterial) {
m_Material = material;
m_CompositeMaterial = compositeMaterial;
}
public override void RecordRenderGraph(RenderGraph renderGraph, ContextContainer frameData) {
if (RR.World == null || RR.World.Context is not WorldContext worldContext) {
return;
}
UniversalResourceData resourceData = frameData.Get<UniversalResourceData>();
UniversalCameraData cameraData = frameData.Get<UniversalCameraData>();
if (resourceData.isActiveTargetBackBuffer) {
return;
}
TextureHandle source = resourceData.activeColorTexture;
TextureDesc infectedTextureDesc = resourceData.activeColorTexture.GetDescriptor(renderGraph);
infectedTextureDesc.name = "InfectedColor";
infectedTextureDesc.colorFormat = GraphicsFormat.R8G8B8A8_SRGB;
TextureHandle infectedColorTexture = renderGraph.CreateTexture(infectedTextureDesc);
TextureDesc finalTextureDesc = resourceData.activeColorTexture.GetDescriptor(renderGraph);
finalTextureDesc.name = "InfectedCombined";
TextureHandle finalColorTexture = renderGraph.CreateTexture(finalTextureDesc);
if (!source.IsValid() || !infectedColorTexture.IsValid() || !finalColorTexture.IsValid()) {
return;
}
using (IRasterRenderGraphBuilder builder = renderGraph.AddRasterRenderPass(passName,
out MainPassData passData,
profilingSampler)) {
passData.Material = m_Material;
passData.PassIndex = 0;
passData.Areas = worldContext.InfectedAreaManager.InfectedAreas;
builder.SetRenderAttachment(infectedColorTexture, 0, AccessFlags.Write);
builder.SetRenderAttachmentDepth(resourceData.activeDepthTexture, AccessFlags.Write);
builder.SetRenderFunc((MainPassData data, RasterGraphContext rgContext) => {
s_SharedPropertyBlock.Clear();
foreach (InfectedAreaInfo infectedAreaInfo in data.Areas) {
s_SharedPropertyBlock.SetVector(s_Center, infectedAreaInfo.Center.xyzz);
s_SharedPropertyBlock.SetFloat(s_Radius, infectedAreaInfo.Radius);
rgContext.cmd.DrawProcedural(Matrix4x4.identity,
data.Material,
data.PassIndex,
MeshTopology.Triangles,
3,
1,
s_SharedPropertyBlock);
}
});
}
using (IRasterRenderGraphBuilder builder = renderGraph.AddRasterRenderPass(passName + " Composite",
out CompositePassData passData,
profilingSampler)) {
passData.Material = m_CompositeMaterial;
passData.PassIndex = 0;
passData.FrameTexture = resourceData.activeColorTexture;
passData.InfectedTexture = infectedColorTexture;
builder.UseTexture(passData.FrameTexture, AccessFlags.Read);
builder.UseTexture(passData.InfectedTexture, AccessFlags.Read);
builder.SetRenderAttachment(finalColorTexture, 0, AccessFlags.Write);
builder.SetRenderFunc((CompositePassData data, RasterGraphContext rgContext) => {
s_SharedPropertyBlock.Clear();
s_SharedPropertyBlock.SetTexture(s_FrameTexture, data.FrameTexture);
s_SharedPropertyBlock.SetTexture(s_InfectedTexture, data.InfectedTexture);
rgContext.cmd.DrawProcedural(Matrix4x4.identity,
data.Material,
data.PassIndex,
MeshTopology.Triangles,
3,
1,
s_SharedPropertyBlock);
});
}
resourceData.cameraColor = finalColorTexture;
}
}
public class InfectedAreaRendererFeature : ScriptableRendererFeature {
[SerializeField] Material m_Material;
[SerializeField] Material m_CompositeMaterial;
InfectedAreaRenderPass m_InfectedAreaRenderPass;
public override void Create() {
m_InfectedAreaRenderPass = new InfectedAreaRenderPass(m_Material, m_CompositeMaterial) {
renderPassEvent = RenderPassEvent.BeforeRenderingTransparents
};
}
protected override void Dispose(bool disposing) { }
public override void AddRenderPasses(ScriptableRenderer renderer, ref RenderingData renderingData) {
if (m_InfectedAreaRenderPass == null) {
return;
}
if (renderingData.cameraData.cameraType == CameraType.Game) {
renderer.EnqueuePass(m_InfectedAreaRenderPass);
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: a03f4b2ef7a841e4a26d2aab5261b738
timeCreated: 1754960974

View File

@@ -0,0 +1,151 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-609742405778081162
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: m_infected_area
m_Shader: {fileID: -6465566751694194690, guid: 4ccde60b0a95f71449e050a008235aca, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _CurrentTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _InfectionTexture:
m_Texture: {fileID: 2800000, guid: db34508bee7214f4b9478f36c9543e74, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Noise:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _Radius: 15
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Center: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.44212446, g: 0.17221434, b: 0.8113208, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
- _Tint: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: acdf5baca64517945ba0eeef899d8ded
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,147 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &-609742405778081162
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: m_infected_area_composite
m_Shader: {fileID: -6465566751694194690, guid: 3048f25764480c442b45ee642cf8783a, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords: []
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses:
- MOTIONVECTORS
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _FrameTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _InfectedTexture:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BumpScale: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _OcclusionStrength: 1
- _Opacity: 0.171
- _Parallax: 0.005
- _QueueControl: 0
- _QueueOffset: 0
- _Radius: 15
- _ReceiveShadows: 1
- _Smoothness: 0.5
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _Center: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 0.25882354, g: 0.44313726, b: 0.2862054, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 8157bb80733421a4684097b7add06523
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,159 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: m_infected_area_particle
m_Shader: {fileID: 4800000, guid: b7839dad95683814aa64166edc107ae2, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords:
- _COLORADDSUBDIFF_ON
- _RECEIVE_SHADOWS_OFF
- _SURFACE_TYPE_TRANSPARENT
m_InvalidKeywords:
- _FLIPBOOKBLENDING_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses:
- DepthOnly
- SHADOWCASTER
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 2800000, guid: 0bbc8da6131e666478c9d8b3267d93f5, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 2
- _BlendModePreserveSpecular: 0
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMode: 1
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 1
- _DstBlendAlpha: 1
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 0
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _SrcBlendAlpha: 1
- _Surface: 1
- _WorkflowMode: 1
- _ZWrite: 0
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 1, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &8903409285488033795
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 18a3341346d8a2943840d0773eefda4a
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,154 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 8
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: m_infected_area_particle_trail
m_Shader: {fileID: 4800000, guid: b7839dad95683814aa64166edc107ae2, type: 3}
m_Parent: {fileID: 0}
m_ModifiedSerializedProperties: 0
m_ValidKeywords: []
m_InvalidKeywords:
- _FLIPBOOKBLENDING_OFF
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap:
RenderType: Opaque
disabledShaderPasses: []
m_LockedProperties:
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BaseMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _SpecGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_Lightmaps:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_LightmapsInd:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- unity_ShadowMasks:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Ints: []
m_Floats:
- _AddPrecomputedVelocity: 0
- _AlphaClip: 0
- _AlphaToMask: 0
- _Blend: 0
- _BlendModePreserveSpecular: 1
- _BlendOp: 0
- _BumpScale: 1
- _CameraFadingEnabled: 0
- _CameraFarFadeDistance: 2
- _CameraNearFadeDistance: 1
- _ClearCoatMask: 0
- _ClearCoatSmoothness: 0
- _ColorMode: 0
- _Cull: 2
- _Cutoff: 0.5
- _DetailAlbedoMapScale: 1
- _DetailNormalMapScale: 1
- _DistortionBlend: 0.5
- _DistortionEnabled: 0
- _DistortionStrength: 1
- _DistortionStrengthScaled: 0.1
- _DstBlend: 0
- _DstBlendAlpha: 0
- _EnvironmentReflections: 1
- _FlipbookBlending: 0
- _FlipbookMode: 0
- _GlossMapScale: 0
- _Glossiness: 0
- _GlossyReflections: 0
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.005
- _QueueOffset: 0
- _ReceiveShadows: 1
- _Smoothness: 0
- _SmoothnessTextureChannel: 0
- _SoftParticlesEnabled: 0
- _SoftParticlesFarFadeDistance: 1
- _SoftParticlesNearFadeDistance: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlpha: 1
- _Surface: 0
- _WorkflowMode: 1
- _ZWrite: 1
m_Colors:
- _BaseColor: {r: 1, g: 1, b: 1, a: 1}
- _BaseColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
- _CameraFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
- _SpecColor: {r: 0.19999996, g: 0.19999996, b: 0.19999996, a: 1}
m_BuildTextureStacks: []
m_AllowLocking: 1
--- !u!114 &8903409285488033795
MonoBehaviour:
m_ObjectHideFlags: 11
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d0353a89b1f911e48b9e16bdc9f2e058, type: 3}
m_Name:
m_EditorClassIdentifier:
version: 9

View File

@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 290798dc97cca674eaa1178f3495df05
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 4ccde60b0a95f71449e050a008235aca
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 3048f25764480c442b45ee642cf8783a
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 11500000, guid: 625f186215c104763be7675aa2d941aa, type: 3}

View File

@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using R3;
using RebootKit.Engine.Extensions;
using RebootKit.Engine.Foundation;
@@ -14,7 +15,7 @@ using UnityEngine.AddressableAssets;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho.Player {
public class PlayerActor : Actor {
public class PlayerActor : Actor, IKillable {
static readonly Logger s_Logger = new Logger(nameof(PlayerActor));
[SerializeField] PlayerAnimator m_PlayerAnimator;
@@ -33,6 +34,7 @@ namespace RebootReality.jelycho.Player {
[SerializeField] float m_RunCameraBobbing = 0.5f;
[SerializeField] float m_IdleCameraBobbing = 0.0f;
[SerializeField] float m_CameraBobbingTransitionSpeed = 5.0f;
[SerializeField] float m_TurnTransitionSpeed = 5.0f;
float m_TargetCameraBobbing = 0.0f;
float m_CurrentCameraBobbing = 0.0f;
@@ -50,6 +52,7 @@ namespace RebootReality.jelycho.Player {
[SerializeField] float m_CharacterRotateFastSpeed = 720.0f;
float m_CharacterTurnVelocity = 0.0f;
float m_CharacterTurnVelocitySmooth = 0.0f;
[Header("Animations")]
[SerializeField] int m_HandsLayerIndex;
@@ -115,6 +118,8 @@ namespace RebootReality.jelycho.Player {
}
}
List<Actor> m_AdditionalMountedActor = new List<Actor>();
protected override IActorData CreateActorData() {
return new PlayerActorData { };
}
@@ -198,6 +203,14 @@ namespace RebootReality.jelycho.Player {
}
}
public void Kick() {
if (!m_IsSetupAsOwner) {
return;
}
m_PlayerAnimator.PlayKickAnimation();
}
public void BeginPrimaryAction() {
if (!m_IsSetupAsOwner) {
s_Logger.Error("Cannot begin primary action when not set up as owner.");
@@ -504,7 +517,7 @@ namespace RebootReality.jelycho.Player {
}
if (targetActor is IKillable killable) {
killable.OnHit(this, 100.0f);
killable.OnHit(this, 100);
}
break;
@@ -724,6 +737,7 @@ namespace RebootReality.jelycho.Player {
item.SetHidden(true);
SendInventoryState();
UpdateEquippedItem();
}
void UpdateEquippedItem() {
@@ -759,18 +773,31 @@ namespace RebootReality.jelycho.Player {
SpawnAdditionalEquippedItemActors();
} else {
m_PlayerAnimator.SetHandsAnimationSet(null);
DestroyAdditionalEquippedItemActors();
}
SetHandsIdleAnimation();
}
void SpawnAdditionalEquippedItemActors() {
DestroyAdditionalEquippedItemActors();
foreach (ItemActorMountingConfig localMountInfo in m_EquippedItem.Config.additionalActorsToMount) {
Actor actor = RR.SpawnLocalOnlyActor(localMountInfo.actor, Vector3.zero, Quaternion.identity);
actor.MountTo(this, localMountInfo.slotName);
m_AdditionalMountedActor.Add(actor);
}
}
void DestroyAdditionalEquippedItemActors() {
foreach (Actor actor in m_AdditionalMountedActor) {
RR.DestroyActor(actor);
}
m_AdditionalMountedActor.Clear();
}
public void WarpTo(Vector3 position) {
if (!RR.IsServer()) {
s_Logger.Error("Only the server can warp players.");
@@ -780,6 +807,17 @@ namespace RebootReality.jelycho.Player {
m_Locomotion.WarpTo(position);
}
//
// @MARK: IKillable
//
public bool IsAlive() {
return true;
}
public ulong OnHit(Actor attacker, ulong damage) {
return 0;
}
//
// @MARK: Common
//
@@ -807,6 +845,7 @@ namespace RebootReality.jelycho.Player {
if (rotateCharacter) {
m_CharacterTurnVelocity = rotateCharacterSpeed * Time.deltaTime;
m_CharacterTurnVelocitySmooth = m_CharacterTurnVelocity;
m_Locomotion.YawRotation = Mathf.MoveTowardsAngle(m_Locomotion.YawRotation,
m_Camera.Yaw,
@@ -914,20 +953,23 @@ namespace RebootReality.jelycho.Player {
forwardNormalized = math.clamp(forwardNormalized, -1.0f, 1.0f);
rightNormalized = math.clamp(rightNormalized, -1.0f, 1.0f);
float turnVelocity = m_CharacterTurnVelocity;
if (math.abs(forwardNormalized) > 0.01f ||
math.abs(rightNormalized) > 0.01f ||
!m_Locomotion.IsGrounded) {
turnVelocity = 0.0f;
m_CharacterTurnVelocitySmooth = 0.0f;
}
PlayerLocomotionAnimatorParams locomotionParams = new PlayerLocomotionAnimatorParams {
IsGrounded = m_Locomotion.IsGrounded,
VelocityForwardNormalized = forwardNormalized,
VelocityRightNormalized = rightNormalized,
TurnVelocity = turnVelocity
TurnVelocity = m_CharacterTurnVelocitySmooth
};
m_PlayerAnimator.SetLocomotionParams(locomotionParams);
m_CharacterTurnVelocitySmooth = Mathf.MoveTowards(m_CharacterTurnVelocitySmooth,
0.0f,
m_TurnTransitionSpeed * Time.deltaTime);
}
}

View File

@@ -1,11 +1,8 @@
using System;
using System.ComponentModel.DataAnnotations.Schema;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using RebootKit.Engine.Animations;
using RebootReality.jelycho.Items;
using Unity.Mathematics;
using UnityEditor.Search;
using UnityEngine;
using UnityEngine.Animations;
using UnityEngine.Events;
@@ -32,7 +29,7 @@ namespace RebootReality.jelycho.Player {
[SerializeField] AnimationClip m_TurnLeftClip;
[SerializeField] float m_TransitionSpeed = 5.0f;
[SerializeField, Range(0.0f, 1.0f)] float m_ForceIdleMagnitudeThreshold = 0.2f;
AnimationMixerPlayable m_Mixer;
float2 m_TargetInput;
float2 m_CurrentInput;
@@ -53,14 +50,16 @@ namespace RebootReality.jelycho.Player {
m_Mixer.SetInputWeight(i, 0.0f);
}
float turnWeight = math.clamp(math.abs(m_Turning), 0.0f, 1.0f);
if (m_Turning > 0.1f) {
m_Mixer.SetInputWeight(5, 1.0f);
m_Mixer.SetInputWeight(5, turnWeight);
} else if (m_Turning < -0.1f) {
m_Mixer.SetInputWeight(6, 1.0f);
} else {
m_Mixer.SetInputWeight(0, 1.0f);
m_Mixer.SetInputWeight(6, turnWeight);
}
m_Mixer.SetInputWeight(0, 1.0f - turnWeight);
return;
}
@@ -278,11 +277,14 @@ namespace RebootReality.jelycho.Player {
public class PlayerAnimator : MonoBehaviour {
[SerializeField] ReAnimator m_ReAnimator;
[SerializeField] int m_HandsLayerIndex = 2;
MixerNode m_LocomotionRootMixer;
LayerMixerNode m_LegsLayerMixer;
BasicCharacterLocomotionReAnimatorNode m_GroundBlendTree;
CharacterHandsReAnimatorNode m_Hands;
AnimationClipNode m_QuickKickNode;
// @TODO: for some reason `SetLocomotionParams` is called before awake
bool m_IsReady = false;
@@ -290,17 +292,20 @@ namespace RebootReality.jelycho.Player {
public UnityEvent onChargeReady = new UnityEvent();
void Awake() {
m_LocomotionRootMixer = m_ReAnimator.FindNode<MixerNode>("locomotion_root");
m_LocomotionRootMixer.SetInputWeight(0, 1.0f);
m_LocomotionRootMixer.SetInputWeight(1, 0.0f);
m_LegsLayerMixer = m_ReAnimator.FindNode<LayerMixerNode>("legs_mixer");
m_LegsLayerMixer.SetLayerWeight(0, 1.0f);
m_LegsLayerMixer.SetLayerWeight(1, 0.0f);
m_LegsLayerMixer.SetLayerWeight(2, 0.0f);
m_GroundBlendTree = m_ReAnimator.FindNode<BasicCharacterLocomotionReAnimatorNode>("locomotion_ground");
m_GroundBlendTree = m_ReAnimator.FindNode<BasicCharacterLocomotionReAnimatorNode>("legs_locomotion_ground");
m_GroundBlendTree.SetInput(new float2(0, 0), 0.0f);
m_Hands = m_ReAnimator.FindNode<CharacterHandsReAnimatorNode>("hands");
m_Hands.OnQuickAttackAnimationFinished += () => { onQuickAttackFinished?.Invoke(); };
m_Hands.OnCharged += () => { onChargeReady?.Invoke(); };
m_QuickKickNode = m_ReAnimator.FindNode<AnimationClipNode>("legs_kick_quick");
m_IsReady = true;
}
@@ -311,8 +316,7 @@ namespace RebootReality.jelycho.Player {
return;
}
m_LocomotionRootMixer.SetInputWeight(0, locomotionParams.IsGrounded ? 1.0f : 0.0f);
m_LocomotionRootMixer.SetInputWeight(1, locomotionParams.IsGrounded ? 0.0f : 1.0f);
m_LegsLayerMixer.SetLayerWeight(1, locomotionParams.IsGrounded ? 0.0f : 1.0f);
float2 groundBlendDirection = new float2(locomotionParams.VelocityRightNormalized,
locomotionParams.VelocityForwardNormalized);
@@ -321,11 +325,11 @@ namespace RebootReality.jelycho.Player {
public void SetHandsAnimationSet(ItemHandsAnimationClipsSet clipsSet) {
if (clipsSet == null) {
m_ReAnimator.SetLayerWeight(1, 0.0f);
m_ReAnimator.SetLayerWeight(m_HandsLayerIndex, 0.0f);
return;
}
m_ReAnimator.SetLayerWeight(1, 1.0f);
m_ReAnimator.SetLayerWeight(m_HandsLayerIndex, 1.0f);
m_Hands.UpdateClips(clipsSet);
}
@@ -344,5 +348,13 @@ namespace RebootReality.jelycho.Player {
public void PlayChargedUse() {
m_Hands.PlayChargedUse();
}
public void PlayKickAnimation() {
m_LegsLayerMixer.SetLayerWeight(2, 1.0f);
m_QuickKickNode.PlayOnceWithCallback(() => {
m_LegsLayerMixer.SetLayerWeight(2, 0.0f);
});
}
}
}

View File

@@ -120,6 +120,10 @@ namespace RebootReality.jelycho.Player {
m_Actor.DropItem();
}
if (m_Config.kickActionReference.action.WasReleasedThisFrame()) {
m_Actor.Kick();
}
if (m_Config.primaryActionReference.action.WasPressedThisFrame()) {
m_Actor.BeginPrimaryAction();
}
@@ -164,8 +168,8 @@ namespace RebootReality.jelycho.Player {
public InputActionReference lookActionReference;
public InputActionReference jumpActionReference;
public InputActionReference sprintActionReference;
public InputActionReference dragObjectActionReference;
public InputActionReference dropItemActionReference;
public InputActionReference kickActionReference;
public InputActionReference primaryActionReference;
public InputActionReference secondaryActionReference;
public InputActionReference interactActionReference;

View File

@@ -17,6 +17,8 @@ namespace RebootReality.jelycho.Ropes {
[SerializeField] Material m_Material;
[SerializeField] int m_Layer;
[SerializeField] GutMeshGenerationConfig m_GutMeshGenerationConfig = new GutMeshGenerationConfig {
radius = 0.2f,
resolution = 16
@@ -87,7 +89,7 @@ namespace RebootReality.jelycho.Ropes {
Graphics.DrawMesh(mesh,
transform.localToWorldMatrix,
m_Material,
gameObject.layer,
m_Layer,
null,
0,
null,

View File

@@ -7,9 +7,12 @@ using Unity.Jobs;
using Unity.Mathematics;
using UnityEngine;
using UnityEngine.Profiling;
using Logger = RebootKit.Engine.Foundation.Logger;
namespace RebootReality.jelycho.Ropes {
public class RopesManager : MonoBehaviour {
static readonly Logger s_Logger = new Logger(nameof(RopesManager));
[SerializeField] float m_RopeSegmentLength = 0.5f;
[SerializeField] int m_ConstrainIterations = 50;
@@ -107,8 +110,8 @@ namespace RebootReality.jelycho.Ropes {
}
// @TODO: finish the rope spawning logic.
public void SpawnRope(float3 start, float3 end, bool lockFirst = false, bool lockLast = false) {
int segmentsCount = (int) (math.distance(start, end) / m_RopeSegmentLength) + 1;
public void SpawnRope(float3 start, float3 end, bool lockFirst = false, bool lockLast = false, float lengthMultiplier = 0.5f) {
int segmentsCount = (int) ((math.distance(start, end) * lengthMultiplier) / m_RopeSegmentLength) + 1;
NativeArray<float3> positions = new NativeArray<float3>(segmentsCount, Allocator.Temp);
for (int i = 0; i < segmentsCount; ++i) {

View File

@@ -1,6 +1,8 @@
using RebootKit.Engine.Simulation;
using RebootReality.jelycho.Beacons;
using RebootReality.jelycho.Enemies;
using RebootReality.jelycho.Feedbacks;
using RebootReality.jelycho.InfectedArea;
using RebootReality.jelycho.Ropes;
using UnityEngine;
@@ -10,5 +12,7 @@ namespace RebootReality.jelycho {
[field: SerializeField] public RopesManager RopesManager { get; private set; }
[field: SerializeField] public BaseManagerActor BaseManager { get; private set; }
[field: SerializeField] public FeedbacksManagerActor FeedbacksManager { get; private set; }
[field: SerializeField] public InfectedAreaManager InfectedAreaManager { get; private set; }
[field: SerializeField] public WavesManagerActor WavesManager { get; private set; }
}
}