public void ConvertToManualCoverPoints() { foreach (CoverPoint coverPoint in this.CoverPoints) { ManualCoverPoint position = (new GameObject("MCP")).AddComponent <ManualCoverPoint>(); position.transform.localPosition = Vector3.zero; position.transform.position = coverPoint.Position; position.Normal = coverPoint.Normal; position.NormalCoverType = coverPoint.NormalCoverType; position.Volume = this; } }
private void Awake() { NavMeshHit navMeshHit; AiLocationManager.Managers.Add(this); if (this.SnapCoverPointsToGround) { ManualCoverPoint[] componentsInChildren = this.CoverPointGroup.GetComponentsInChildren <ManualCoverPoint>(); for (int i = 0; i < (int)componentsInChildren.Length; i++) { ManualCoverPoint manualCoverPoint = componentsInChildren[i]; if (NavMesh.SamplePosition(manualCoverPoint.Position, out navMeshHit, 4f, -1)) { manualCoverPoint.transform.position = navMeshHit.position; } } } }