This commit is contained in:
CortexCore
2023-10-30 01:25:53 +08:00
parent add6d0cab3
commit 18f664a545
125 changed files with 3529 additions and 700 deletions

View File

@@ -10,7 +10,8 @@
"GUID:7efac18f239530141802fb139776f333",
"GUID:f51ebe6a0ceec4240a699833d6309b23",
"GUID:ea5474181b324dd49a5976cd68f44f18",
"GUID:bea3628e8b592ae47ade218cb9ec98db"
"GUID:bea3628e8b592ae47ade218cb9ec98db",
"GUID:8d74bfb2f67c5c14a810215b78383d40"
],
"includePlatforms": [],
"excludePlatforms": [],

View File

@@ -0,0 +1,44 @@
using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using BITKit.Entities;
using UnityEngine;
using Random = UnityEngine.Random;
namespace BITFALL.Props
{
public class Prop_Shield : MonoBehaviour,IDamagable
{
[SerializeField] private SpringEulerAngle spring=new();
[SerializeField] private Optional<int> maxSpring;
public IUnityEntity UnityEntity => null;
public Rigidbody Rigidbody => null;
private Vector3 initialEulerAngles;
private void Start()
{
initialEulerAngles = transform.localEulerAngles;
}
private void FixedUpdate()
{
spring.Update(Time.fixedDeltaTime,initialEulerAngles);
transform.localEulerAngles = spring.value;
}
public void GiveDamage(DamageMessage message)
{
var damage = message.Damage;
if (maxSpring.Allow)
{
damage = Mathf.Min(damage, maxSpring.Value);
}
spring.value =initialEulerAngles + new Vector3(
Random.Range(-damage, damage),
Random.Range(-damage, damage),
Random.Range(-damage, damage)
);
}
}
}

View File

@@ -26,7 +26,7 @@ namespace BITFALL.Props
{
damagable.GiveDamage(new DamageMessage()
{
Target = damagable.Entity,
Target = damagable.UnityEntity,
Damage = damage,
Location = new Location()
{