1
This commit is contained in:
25
Assets/Artists/Scripts/Feel/BITFALL.Feel.asmdef
Normal file
25
Assets/Artists/Scripts/Feel/BITFALL.Feel.asmdef
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "BITFALL.Feel",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:f6155d9ae143f3949ac54e8355593d6c",
|
||||
"GUID:709caf8d7fb6ef24bbba0ab9962a3ad0",
|
||||
"GUID:f822dbf6fdfd4a5469cccaa2e4eed3b6",
|
||||
"GUID:d525ad6bd40672747bde77962f1c401e",
|
||||
"GUID:49b49c76ee64f6b41bf28ef951cb0e50",
|
||||
"GUID:9354affc93e0f3e4a904785e7d4c0f59",
|
||||
"GUID:7efac18f239530141802fb139776f333",
|
||||
"GUID:8d74bfb2f67c5c14a810215b78383d40",
|
||||
"GUID:1235ca61e7f433b408ed5a68767e7123"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
68
Assets/Artists/Scripts/Feel/PlayerGraphics.cs
Normal file
68
Assets/Artists/Scripts/Feel/PlayerGraphics.cs
Normal file
@@ -0,0 +1,68 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Entities;
|
||||
using BITKit;
|
||||
using BITKit.Entities;
|
||||
using BITKit.Entities.Player;
|
||||
using BITKit.Events;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Feel
|
||||
{
|
||||
public class PlayerGraphics : MonoBehaviour
|
||||
{
|
||||
[SerializeReference, SubclassSelector] private IPlayerService playerService;
|
||||
|
||||
[SerializeField] private UnityEvent _unityEvent;
|
||||
[SerializeField] private UnityEvent playerDeathEvent;
|
||||
[Inject]
|
||||
private IKnockdown _knockdown;
|
||||
[Inject]
|
||||
private IHealth _health;
|
||||
private void Start()
|
||||
{
|
||||
playerService.OnPlayerInitialized += OnPlayerInitialized;
|
||||
playerService.OnPlayerDisposed += OnPlayerDisposed;
|
||||
}
|
||||
|
||||
private void OnPlayerDisposed(Entity obj)
|
||||
{
|
||||
_unityEvent.Invoke(false);
|
||||
playerDeathEvent.Invoke(false);
|
||||
}
|
||||
|
||||
private void OnDestroy()
|
||||
{
|
||||
playerService.OnPlayerInitialized -= OnPlayerInitialized;
|
||||
playerService.OnPlayerDisposed -= OnPlayerDisposed;
|
||||
}
|
||||
|
||||
private void OnPlayerInitialized(Entity obj)
|
||||
{
|
||||
obj.Inject(this);
|
||||
|
||||
_knockdown.OnKnockdown += OnKnockdown;
|
||||
_knockdown.OnRevive += OnRevive;
|
||||
|
||||
_health.OnSetAlive += OnSetAlive;
|
||||
}
|
||||
|
||||
private void OnSetAlive(bool obj)
|
||||
{
|
||||
_unityEvent.Invoke(false);
|
||||
playerDeathEvent.Invoke(!obj);
|
||||
}
|
||||
|
||||
private void OnRevive()
|
||||
{
|
||||
_unityEvent.Invoke(false);
|
||||
}
|
||||
|
||||
private void OnKnockdown()
|
||||
{
|
||||
_unityEvent.Invoke(true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
44
Assets/Artists/Scripts/Feel/PlayerHandAnimations.cs
Normal file
44
Assets/Artists/Scripts/Feel/PlayerHandAnimations.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITFALL.Entities;
|
||||
using BITFALL.Player.Movement;
|
||||
using BITKit;
|
||||
using BITKit.Animations;
|
||||
using BITKit.Entities;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITFALL.Feel
|
||||
{
|
||||
public sealed class PlayerHandAnimations : EntityComponent
|
||||
{
|
||||
[SerializeField] private UnityAnimator animator;
|
||||
[SerializeField] private LocationAdditive locationAdditive;
|
||||
|
||||
[Inject]
|
||||
private IPlayerMovement _playerMovement;
|
||||
[Inject]
|
||||
private IKnockdown _knockdown;
|
||||
public override void OnStart()
|
||||
{
|
||||
_playerMovement.OnParachuteOpened += OnParachuteOpened;
|
||||
_playerMovement.OnParachuteClosed += OnParachuteClosed;
|
||||
|
||||
_knockdown.OnKnockdown += OnKnockdown;
|
||||
}
|
||||
|
||||
private void OnKnockdown()
|
||||
{
|
||||
animator.Play("OnKnockdown");
|
||||
}
|
||||
|
||||
private void OnParachuteClosed()
|
||||
{
|
||||
animator.Play("OnParachuteClosed");
|
||||
}
|
||||
private void OnParachuteOpened()
|
||||
{
|
||||
animator.Play("OnParachute");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
31
Assets/Artists/Scripts/Feel/PlayerHitMotion.cs
Normal file
31
Assets/Artists/Scripts/Feel/PlayerHitMotion.cs
Normal file
@@ -0,0 +1,31 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.FPS;
|
||||
using UnityEngine;
|
||||
|
||||
namespace BITKit.Entities.Player.Feel
|
||||
{
|
||||
public sealed class PlayerHitMotion : EntityComponent
|
||||
{
|
||||
[SerializeField] private Spring3 spring;
|
||||
[SerializeField] private LocationAdditive locationAdditive;
|
||||
[SerializeField] private AnimationCurve damageBasedMotion;
|
||||
public override void OnStart()
|
||||
{
|
||||
entity.AddListener<DamageMessage>(OnDamaged);
|
||||
}
|
||||
|
||||
private void OnDamaged(DamageMessage obj)
|
||||
{
|
||||
var damage = damageBasedMotion.Evaluate(obj.damage);
|
||||
spring.value = new Vector3(damage.Random(), damage.Random(), damage.Random());
|
||||
}
|
||||
|
||||
public override void OnUpdate(float deltaTime)
|
||||
{
|
||||
spring.Update(deltaTime,default);
|
||||
locationAdditive.AddEuler(spring.value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user