public void RemovePoint(int index)
 {
     if (wayPointVerticies.Count > index && index > -1)
     {
         wayPointVerticies[index].DestroyWayPoint();
         wayPointVerticies.RemoveAt(index);
         OnPathUpdate?.Invoke();
     }
     else
     {
         Debug.LogError($"Error: WayPoint with index {index} doesnt exist.");
     }
 }
        public bool TryAddPoint(Vector3 position)
        {
            var intersects = IntersectsAnyPoint(position);

            if (intersects)
            {
                return(false);
            }
            var wayPointGameObject = Instantiate(pathEntityConfig.WayPointPrefab, position, pathEntityConfig.WayPointPrefab.transform.rotation);

            wayPointVerticies.Add(wayPointGameObject.GetComponent <IWayPointEntity>());
            OnPathUpdate?.Invoke();
            return(true);
        }
示例#3
0
 protected void Start()
 {
     BgCurve = BgCurve ?? GetComponent <BGCurve>();
     OnPathUpdate?.Invoke();
 }