first-roguelike-elements #3
1 changed files with 9 additions and 6 deletions
|
|
@ -1,10 +1,13 @@
|
||||||
// Assets/_Project/Scripts/Combat/TowerCombat.cs
|
// Assets/_Project/Scripts/Combat/TowerCombat.cs
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Unity.Netcode;
|
|
||||||
using UnityEngine;
|
|
||||||
using TD.Core;
|
using TD.Core;
|
||||||
using TD.Gameplay;
|
using TD.Gameplay;
|
||||||
using TD.Towers;
|
using TD.Towers;
|
||||||
|
using Unity.Netcode;
|
||||||
|
using UnityEngine;
|
||||||
|
using Object = UnityEngine.Object;
|
||||||
|
|
||||||
namespace TD.Combat
|
namespace TD.Combat
|
||||||
{
|
{
|
||||||
|
|
@ -75,17 +78,17 @@ namespace TD.Combat
|
||||||
/// fired in <see cref="OnNetworkSpawn"/> for late-joining clients so visual
|
/// fired in <see cref="OnNetworkSpawn"/> for late-joining clients so visual
|
||||||
/// consumers always initialise from the correct state.
|
/// consumers always initialise from the correct state.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event System.Action<NetworkObjectReference> OnTargetAcquired;
|
public event Action<NetworkObjectReference> OnTargetAcquired;
|
||||||
|
|
||||||
/// <summary>Fired locally on ALL peers when the tower loses its target.</summary>
|
/// <summary>Fired locally on ALL peers when the tower loses its target.</summary>
|
||||||
public event System.Action OnTargetLost;
|
public event Action OnTargetLost;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fired locally on ALL peers each time the tower attacks.
|
/// Fired locally on ALL peers each time the tower attacks.
|
||||||
/// Argument is the world-space position of the primary target at the moment
|
/// Argument is the world-space position of the primary target at the moment
|
||||||
/// of fire — use it to aim muzzle flash, spawn a tracer, etc.
|
/// of fire — use it to aim muzzle flash, spawn a tracer, etc.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event System.Action<Vector3> OnFire;
|
public event Action<Vector3> OnFire;
|
||||||
|
|
||||||
// ----- NGO lifecycle -----------------------------------------------
|
// ----- NGO lifecycle -----------------------------------------------
|
||||||
|
|
||||||
|
|
@ -143,7 +146,7 @@ namespace TD.Combat
|
||||||
if (currentTarget == null) return;
|
if (currentTarget == null) return;
|
||||||
|
|
||||||
bool dead = currentTarget.IsDead;
|
bool dead = currentTarget.IsDead;
|
||||||
bool destroyed = (currentTarget as UnityEngine.Object) == null;
|
bool destroyed = (currentTarget as Object) == null;
|
||||||
bool outOfRange = Vector3.Distance(
|
bool outOfRange = Vector3.Distance(
|
||||||
transform.position,
|
transform.position,
|
||||||
currentTarget.transform.position) > def.Range;
|
currentTarget.transform.position) > def.Range;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue