public bool TryMoveForward() { LaneSection[] laneSections = lane.LaneSections; if (laneSectionIndex < laneSections.Length - 1) { if (laneSectionIndex >= 0) { LaneSection curSection = laneSections[laneSectionIndex]; if (!curSection.IsAllowedToPass()) { return(false); } curSection.RemoveAi(); } laneSectionIndex++; LaneSection newSection = laneSections[laneSectionIndex]; newSection.AddAi(); Vector3 destPos = newSection.GetAiPosition(); if (!SetDestination(destPos)) { Warp(destPos); } return(true); } return(false); }
public void Remove() { gameObject.SetActive(false); if (lane == null) { return; } lane.RemoveAiController(this); if (laneSectionIndex < 0) { return; } LaneSection curSection = lane.LaneSections[laneSectionIndex]; curSection.RemoveAi(); }