Exemplo n.º 1
0
        public void GoOnRandomPath(PathArray randomPath)
        {
            if (status == creatureMode.random)
            {
                if (randomIndexLast >= randomPath.targetsOnPath.Count || randomIndexLast == 0)
                {
                    temporalIndexes = new List <int>();
                    temporalIndexes = indexes.OrderBy(x => Random.Range(0, randomPath.targetsOnPath.Count - 1)).ToList();
                    randomIndexLast = 0;
                    Debug.Log("INDEX NOW IS: " + indexes.Count + "index value is: " + temporalIndexes[randomIndexLast]);
                }



                nextPathIndex = temporalIndexes[randomIndexLast];

                agent.SetDestination(randomPath.targetsOnPath[nextPathIndex]);
                startPosForAgent = transform.position;
                randomIndexLast++;
                StartCoroutine(WaitForDestination(randomPath, status));
            }
            else
            {
                Debug.Log("CREATURE STOPPED RANDOM MODE");
            }
        }
Exemplo n.º 2
0
 void Awake()
 {
     if (!permanentScriptableObjects)
     {
         pathArray = Instantiate(pathArray);
         selectionIndicatorPath = Instantiate(selectionIndicatorPath);
     }
 }
Exemplo n.º 3
0
        // アクティビティが値を返す場合は、CodeActivity<TResult> から派生して、
        // Execute メソッドから値を返します。
        protected override void Execute(CodeActivityContext context)
        {
            var paths   = PathArray.Get(context);
            var combine = System.IO.Path
                          .Combine(paths)
                          .Replace("/", "\\");

            // ユーザが "/" にしたときもバックスラッシュで返す
            Result.Set(context, combine);
        }
Exemplo n.º 4
0
        private static Shell32.IContextMenu GetContextMenuObject(params string[] PathArray)
        {
            if (PathArray.Count() > 1)
            {
                ShellItem[]   Items         = PathArray.Select((Path) => new ShellItem(Path)).ToArray();
                ShellFolder[] ParentFolders = Items.Select((Item) => Item.Parent).ToArray();

                try
                {
                    if (ParentFolders.Skip(1).All((Folder) => Folder == ParentFolders[0]))
                    {
                        return(ParentFolders[0].GetChildrenUIObjects <Shell32.IContextMenu>(null, Items));
                    }
                    else
                    {
                        throw new ArgumentException("All items must have the same parent");
                    }
                }
                finally
                {
                    Array.ForEach(Items, (It) => It.Dispose());
                    Array.ForEach(ParentFolders, (It) => It.Dispose());
                }
            }
            else
            {
                using (ShellItem Item = new ShellItem(PathArray.First()))
                {
                    if (Item is ShellFolder Folder)
                    {
                        return(Folder.IShellFolder.CreateViewObject <Shell32.IContextMenu>(HWND.NULL));
                    }
                    else
                    {
                        if (Item.Parent is ShellFolder ParentFolder)
                        {
                            try
                            {
                                return(ParentFolder.GetChildrenUIObjects <Shell32.IContextMenu>(null, Item));
                            }
                            finally
                            {
                                ParentFolder?.Dispose();
                            }
                        }
                        else
                        {
                            return(Item.GetHandler <Shell32.IContextMenu>(Shell32.BHID.BHID_SFUIObject));
                        }
                    }
                }
            }
        }
        private void buildFullQuantityPath()
        {
            if (Simulation == null)
            {
                return;
            }

            var pathArray = PathArray.ToList();

            pathArray.Insert(0, Simulation.Name);

            _fullQuantityPath = pathArray.ToPathString();
        }
Exemplo n.º 6
0
 public void GoOnSpecificPath(PathArray specificPath)
 {
     if (status == creatureMode.pathSpecific)
     {
         nextPathIndex = nextPathIndex == specificPath.targetsOnPath.Count ? 0 : nextPathIndex;
         agent.SetDestination(specificPath.targetsOnPath[nextPathIndex]);
         Debug.Log("GOING TO TARGET NUMBER: " + nextPathIndex + " WITH INDEX: " + nextPathIndex);
         StartCoroutine(WaitForDestination(specificPath, status));
         //ActivateHeightVariation();
     }
     else
     {
         Debug.Log("CREATURE STOPPED PATH MODE");
     }
 }
Exemplo n.º 7
0
 public void ExecuteCurrentMode(PathArray requiredPath = null, creatureActions requiredAction = creatureActions.idle)
 {
     nextPathIndex = 0;
     lastAction    = creatureActions.idle;
     if (status == creatureMode.random)
     {
         GoOnRandomPath(requiredPath);
     }
     else if (status == creatureMode.playerReact)
     {
         GoOnPlayerReact();
     }
     else if (status == creatureMode.pathSpecific)
     {
         GoOnSpecificPath(requiredPath);
     }
 }
Exemplo n.º 8
0
        private IEnumerator WaitForDestination(PathArray path, creatureMode mode)
        {
            curDirection = UpdateDirection();
            ActivateHeightVariation();
            yield return(new WaitForSeconds(2f));

            yield return(new WaitUntil(() => NearToTarget() && agent.remainingDistance > 0));

            if (mode == creatureMode.random)
            {
                GoOnRandomPath(path);
            }
            else
            {
                nextPathIndex++;
                GoOnSpecificPath(path);
            }
            yield return(null);
        }
Exemplo n.º 9
0
        public static List <FileSystemStorageItemBase> GetStorageItems(params string[] PathArray)
        {
            if (PathArray.Length == 0 || PathArray.Any((Item) => string.IsNullOrWhiteSpace(Item)))
            {
                throw new ArgumentException("Argument could not be empty", nameof(PathArray));
            }

            if (PathArray.Any((Item) => Path.GetPathRoot(Item) == Item))
            {
                throw new ArgumentException("Unsupport for root directory", nameof(PathArray));
            }

            try
            {
                List <FileSystemStorageItemBase> Result = new List <FileSystemStorageItemBase>(PathArray.Length);

                foreach (string Path in PathArray)
                {
                    IntPtr Ptr = FindFirstFileExFromApp(Path, FINDEX_INFO_LEVELS.FindExInfoBasic, out WIN32_FIND_DATA Data, FINDEX_SEARCH_OPS.FindExSearchNameMatch, IntPtr.Zero, FIND_FIRST_EX_LARGE_FETCH);

                    try
                    {
                        if (Ptr.ToInt64() != -1)
                        {
                            FileAttributes Attribute = (FileAttributes)Data.dwFileAttributes;

                            if (Attribute.HasFlag(FileAttributes.Directory))
                            {
                                if (Data.cFileName != "." && Data.cFileName != "..")
                                {
                                    FileTimeToSystemTime(ref Data.ftLastWriteTime, out SYSTEMTIME ModTime);
                                    DateTime ModifiedTime = new DateTime(ModTime.Year, ModTime.Month, ModTime.Day, ModTime.Hour, ModTime.Minute, ModTime.Second, ModTime.Milliseconds, DateTimeKind.Utc);

                                    if (Attribute.HasFlag(FileAttributes.Hidden))
                                    {
                                        Result.Add(new HiddenStorageItem(Data, StorageItemTypes.Folder, Path, ModifiedTime));
                                    }
                                    else
                                    {
                                        Result.Add(new FileSystemStorageItemBase(Data, StorageItemTypes.Folder, Path, ModifiedTime));
                                    }
                                }
                            }
                            else
                            {
                                FileTimeToSystemTime(ref Data.ftLastWriteTime, out SYSTEMTIME ModTime);
                                DateTime ModifiedTime = new DateTime(ModTime.Year, ModTime.Month, ModTime.Day, ModTime.Hour, ModTime.Minute, ModTime.Second, ModTime.Milliseconds, DateTimeKind.Utc);

                                if (Attribute.HasFlag(FileAttributes.Hidden))
                                {
                                    Result.Add(new HiddenStorageItem(Data, StorageItemTypes.File, Path, ModifiedTime));
                                }
                                else
                                {
                                    if (!Data.cFileName.EndsWith(".url", StringComparison.OrdinalIgnoreCase))
                                    {
                                        if (Data.cFileName.EndsWith(".lnk", StringComparison.OrdinalIgnoreCase))
                                        {
                                            Result.Add(new HyperlinkStorageItem(Data, Path, ModifiedTime));
                                        }
                                        else
                                        {
                                            Result.Add(new FileSystemStorageItemBase(Data, StorageItemTypes.File, Path, ModifiedTime));
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            LogTracer.Log(new Win32Exception(Marshal.GetLastWin32Error()));
                        }
                    }
                    finally
                    {
                        FindClose(Ptr);
                    }
                }

                return(Result);
            }
            catch
            {
                return(new List <FileSystemStorageItemBase>());
            }
        }
Exemplo n.º 10
0
 public new IMultiLineString ToCommon()
 {
     return(new NetTopologySuite.Geometries.MultiLineString(PathArray.Select(o => o.ToCommon()).ToArray()));
 }
Exemplo n.º 11
0
 void Start()
 {
     //copy the outline so changes can be made
     destinationPathArray = Instantiate(myPath);
 }