浏览代码

fix: Fix typo in NavigationSystemTag :)

/main
Luke Stampfli 4 年前
当前提交
bf7da168
共有 3 个文件被更改,包括 8 次插入8 次删除
  1. 6
      Assets/BossRoom/Scripts/Server/Navigation/DynamicNavObstacle.cs
  2. 4
      Assets/BossRoom/Scripts/Server/Navigation/NavigationSystem.cs
  3. 6
      Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs

6
Assets/BossRoom/Scripts/Server/Navigation/DynamicNavObstacle.cs


private void Awake()
{
m_NavigationSystem = GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSytemTag).GetComponent<NavigationSystem>();
m_NavigationSystem = GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag).GetComponent<NavigationSystem>();
}
private void OnValidate()

Assert.NotNull(
GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSytemTag)?.GetComponent<NavigationSystem>(),
$"NavigationSystem not found. Is there a NavigationSystem Behaviour in the Scene and does its GameObject have the {NavigationSystem.NavigationSytemTag} tag?"
GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag)?.GetComponent<NavigationSystem>(),
$"NavigationSystem not found. Is there a NavigationSystem Behaviour in the Scene and does its GameObject have the {NavigationSystem.NavigationSystemTag} tag?"
);
}
}

4
Assets/BossRoom/Scripts/Server/Navigation/NavigationSystem.cs


/// </summary>
public class NavigationSystem : MonoBehaviour
{
public const string NavigationSytemTag = "NavigationSystem";
public const string NavigationSystemTag = "NavigationSystem";
/// <summary>
/// Event that gets invoked when the navigation mesh changed. This happens when dynamic obstacles move or get active

private void OnValidate()
{
Assert.AreEqual(NavigationSytemTag, tag, $"The GameObject of the {nameof(NavigationSystem)} component has to use the {NavigationSystem.NavigationSytemTag} tag!");
Assert.AreEqual(NavigationSystemTag, tag, $"The GameObject of the {nameof(NavigationSystem)} component has to use the {NavigationSystem.NavigationSystemTag} tag!");
}
}
}

6
Assets/BossRoom/Scripts/Server/ServerCharacterMovement.cs


m_CharLogic = GetComponent<ServerCharacter>();
m_Rigidbody = GetComponent<Rigidbody>();
m_NavigationSystem = GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSytemTag).GetComponent<NavigationSystem>();
m_NavigationSystem = GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag).GetComponent<NavigationSystem>();
}
public override void NetworkStart()

if (gameObject.scene.rootCount > 1) // Hacky way for checking if this is a scene object or a prefab instance and not a prefab definition.
{
Assert.IsTrue(
GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSytemTag)?.GetComponent<NavigationSystem>() != null,
$"NavigationSystem not found. Is there a NavigationSystem Behaviour in the Scene and does its GameObject have the {NavigationSystem.NavigationSytemTag} tag? {gameObject.scene.name}"
GameObject.FindGameObjectWithTag(NavigationSystem.NavigationSystemTag)?.GetComponent<NavigationSystem>() != null,
$"NavigationSystem not found. Is there a NavigationSystem Behaviour in the Scene and does its GameObject have the {NavigationSystem.NavigationSystemTag} tag? {gameObject.scene.name}"
);
}
}

正在加载...
取消
保存