浏览代码

Merge branch 'main' into pr-bash

/UI
Ciro Continisio 4 年前
当前提交
57258669
共有 5 个文件被更改,包括 10 次插入9 次删除
  1. 4
      UOP1_Project/Assets/Scripts/Characters/Attack.cs
  2. 2
      UOP1_Project/Assets/Scripts/Characters/Critter.cs
  3. 3
      UOP1_Project/Assets/Scripts/Characters/Damageable.cs
  4. 2
      UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTargetDeadConditionSO.cs
  5. 8
      UOP1_Project/Assets/Scripts/Interaction/InteractionManager.cs

4
UOP1_Project/Assets/Scripts/Characters/Attack.cs


public class Attack : MonoBehaviour
{
[SerializeField] private AttackConfigSO _attackConfigSO;
public AttackConfigSO AttackConfig => _attackConfigSO;
private void Awake()

// Avoid friendly fire!
if (!other.CompareTag(gameObject.tag))
{
if(other.TryGetComponent(out Damageable damageableComp))
if (other.TryGetComponent(out Damageable damageableComp))
{
if (!damageableComp.GetHit)
damageableComp.ReceiveAnAttack(_attackConfigSO.AttackStrength);

2
UOP1_Project/Assets/Scripts/Characters/Critter.cs


{
isPlayerInAlertZone = entered;
if(entered && who.TryGetComponent(out Damageable d))
if (entered && who.TryGetComponent(out Damageable d))
{
currentTarget = d;
currentTarget.OnDie += OnTargetDead;

3
UOP1_Project/Assets/Scripts/Characters/Damageable.cs


if (_currentHealth <= 0)
{
IsDead = true;
if(OnDie != null) OnDie.Invoke();
if (OnDie != null)
OnDie.Invoke();
}
}
}

2
UOP1_Project/Assets/Scripts/Characters/StateMachine/Conditions/IsTargetDeadConditionSO.cs


{
_critterScript = stateMachine.GetComponent<Critter>();
}
protected override bool Statement()
{
return _critterScript.currentTarget == null || _critterScript.currentTarget.IsDead;

8
UOP1_Project/Assets/Scripts/Interaction/InteractionManager.cs


}
break;
//No need to do anything for Pickup type, the StateMachine will transition to the state
//and then the AnimationClip will call Collect()
//No need to do anything for Pickup type, the StateMachine will transition to the state
//and then the AnimationClip will call Collect()
}
}

private void RequestUpdateUI(bool visible)
{
if(visible)
if (visible)
_toggleInteractionUI.RaiseEvent(true, _potentialInteractions.First.Value.type);
else
_toggleInteractionUI.RaiseEvent(false, InteractionType.None);

RequestUpdateUI(true);
break;
}
_inputReader.EnableGameplayInput();
}
}
正在加载...
取消
保存