コード例 #1
0
ファイル: SceneObjectsProvider.cs プロジェクト: naburangi/AMS
        private SearchItem MatchGOD(SearchContext context, SearchProvider provider, GOD god, int index, bool useFuzzySearch, string fuzzyMatchQuery, List <int> FuzzyMatches)
        {
            long score = -1;

            if (useFuzzySearch)
            {
                if (!FuzzySearch.FuzzyMatch(fuzzyMatchQuery, god.name, ref score, FuzzyMatches))
                {
                    return(null);
                }
            }
            else
            {
                if (!MatchSearchGroups(context, god.name, true))
                {
                    return(null);
                }
            }

            var item = provider.CreateItem(god.id, ~(int)score, null,
                                           null,
                                           //$"MatchGOD[{useFuzzySearch}]:{~(int)score} -> {String.Join(";", SceneSearchIndexer.SplitComponents(god.rawname))}",
                                           null, index);

            item.descriptionFormat = SearchItemDescriptionFormat.Ellipsis | SearchItemDescriptionFormat.RightToLeft;
            if (useFuzzySearch)
            {
                item.descriptionFormat |= SearchItemDescriptionFormat.FuzzyHighlight;
            }
            else
            {
                item.descriptionFormat |= SearchItemDescriptionFormat.Highlight;
            }
            return(item);
        }
コード例 #2
0
ファイル: DragonAIScript.cs プロジェクト: loserboi23/Pacify
    IEnumerator DragonMovement(int random, Vector3 target_offset, DirectionScript.GameObjectDirection new_dir)
    {
        for (int r = 0; r < random; r++)
        {
            UpdatePositionList(target_offset);
            DirectionScript GOD;

            for (int i = 0; i < dragonlist.Count; i++)
            {
                dragonlist[i].transform.position = Vector3.MoveTowards(dragonlist[i].transform.position, newpositions[i], 1f);

                yield return(null);

                if (r == 0)
                {
                    GOD = dragonlist[i].GetComponent <DirectionScript>();
                    //turn the dragonhead and make a curve

                    if (i == 0)
                    {
                        UpdateCloneList();
                        GOD.DragonSingleDirection(Sprite_dragon_head, new_dir);
                    }
                    else if (i == 1)
                    {
                        GOD.DragonCurveDirection(Sprite_dragoncurve, Sprite_dragoncurve_1, new_dir);
                    }
                    else if (i == dragonlist.Count - 1)
                    {
                        GOD.InheritDirectionandRotation(Sprite_dragontail, scaleclone[i - 1], eulerclone[i - 1], directionclone[i - 1]);
                    }
                    else
                    {
                        GOD.InheritDirectionandRotation(spriteclone[i - 1], scaleclone[i - 1], eulerclone[i - 1], directionclone[i - 1]);
                    }
                }
                else
                {
                    GOD = dragonlist[i].GetComponent <DirectionScript>();
                    if (i == 0)
                    {
                        GOD.DragonSingleDirection(Sprite_dragon_head, new_dir);
                    }
                    else if (i == 1)
                    {
                        UpdateCloneList();
                        GOD.DragonSingleDirection(Sprite_dragonbody, new_dir);
                    }
                    else if (i == dragonlist.Count - 1)
                    {
                        GOD.DragonSingleDirection(Sprite_dragontail, directionclone[i - 1]);
                    }
                    else
                    {
                        GOD.InheritDirectionandRotation(spriteclone[i - 1], scaleclone[i - 1], eulerclone[i - 1], directionclone[i - 1]);
                    }
                }
            }
        }
    }
コード例 #3
0
ファイル: NeuronLine.cs プロジェクト: mwebi/AxonClone
    //is only called for child branches
    public void setupNewBranch(GameObject ourGOD, Vector3 currentPos, Vector3 parentLineCurrentDirection, Vector3 parentLineLastDirection, Vector3 LastNodePos ,int depthOfParent, float lineStartWidth, float lineEndWidth, int maxBranches)
    {
        branchDepth = depthOfParent + 1;
        MaxBranchNumber = maxBranches;
        spawnedBranch = false;
        Speed = BranchSpeed;
        CurveSpeed = BranchCurveSpeed;

        GODObject = ourGOD;
        ohmyGOD = GODObject.GetComponent<GOD>();

        GetComponent<LineRenderer>().SetWidth(lineStartWidth, lineEndWidth);

        transform.position = currentPos;
        lastPosition = currentPos;

        Vector3 randomDirection = new Vector3 ( Random.Range (-1.2f, 1.2f), Random.Range (0.3f, 0.8f), 0);

        positionToReach = currentPos + randomDirection;
        lastPositionToReach = lastPosition;

        lastDirection = directionDirectFromLastNodeToNextNode;
        directionDirectFromLastNodeToNextNode = positionToReach - lastPositionToReach;
        currentDirectionOfLine=parentLineCurrentDirection;
    }
コード例 #4
0
ファイル: Blessings.cs プロジェクト: hengtek/Hades3310
    private void ApplyBlessing(GOD blessing)
    {
        if (blessing == GOD.ZEUS)
        {
            dialog.SetText("Zeus grants you power! +5 Max health");
            Stats.temporaryMaxHealth += 5;
        }
        else if (blessing == GOD.ARES)
        {
            dialog.SetText("Ares grants you strength! +1 Power");
            Stats.currentPower += 1;
        }
        else if (blessing == GOD.APHRODITE)
        {
            dialog.SetText("Aphrodite healed your wounds! +6 Health");
            Stats.CurrentHealth = Mathf.Min(Stats.CurrentHealth + 6, Stats.temporaryMaxHealth);
        }
        else if (blessing == GOD.DIONYSUS)
        {
            dialog.SetText("Dionysus grants you riches! Money (+10) ");
            Stats.Money += 10;
        }

        dialog.Open();
    }
コード例 #5
0
        private SearchItem MatchGOD(SearchContext context, SearchProvider provider, GOD god, int index, bool useFuzzySearch, string fuzzyMatchQuery, List <int> FuzzyMatches)
        {
            long score = -1;

            if (useFuzzySearch)
            {
                if (!FuzzySearch.FuzzyMatch(fuzzyMatchQuery, god.tokens, ref score, FuzzyMatches))
                {
                    return(null);
                }
            }
            else
            {
                if (!MatchSearchGroups(context, god.tokens, true))
                {
                    return(null);
                }
            }

            var item = provider.CreateItem(god.id, ~(int)score, null, null, null, index);

            item.descriptionFormat = SearchItemDescriptionFormat.Ellipsis | SearchItemDescriptionFormat.RightToLeft;
            if (useFuzzySearch)
            {
                item.descriptionFormat |= SearchItemDescriptionFormat.FuzzyHighlight;
            }
            else
            {
                item.descriptionFormat |= SearchItemDescriptionFormat.Highlight;
            }
            return(item);
        }
コード例 #6
0
ファイル: Node.cs プロジェクト: mwebi/AxonClone
    // Use this for initialization
    void Start()
    {
        ohmyGOD = GODObject.GetComponent<GOD>();

        if(isStartNode){
            renderer.material = ClickedMaterial;
            isClickable= false;
        }else
            isClickable= true;
    }
コード例 #7
0
ファイル: FollowCamera.cs プロジェクト: mwebi/AxonClone
    // Use this for initialization
    void Start()
    {
        ohmyGOD = GODObject.GetComponent<GOD>();

        transform.position = new Vector3(ohmyGOD.NodeGenerationScript.currentNode.transform.position.x,
                                         ohmyGOD.NodeGenerationScript.currentNode.transform.position.y,
                                         transform.position.z);
        YOffsetVector = new Vector3(0, YOffset, 0);

        currentSpeed = new Vector3();
    }
コード例 #8
0
        GOD GetGOD(GameObject go)
        {
            var instanceId = go.GetInstanceID();

            if (!m_GODS.TryGetValue(instanceId, out var god))
            {
                god = new GOD();
                m_GODS[instanceId] = god;
            }
            return(god);
        }
コード例 #9
0
ファイル: RangeCircle.cs プロジェクト: mwebi/AxonClone
    // Use this for initialization
    void Start()
    {
        ohmyGOD = GODObject.GetComponent<GOD>();

        decreaseVector = new Vector3();
        lastestMaxScale = transform.localScale;
        RangeDecreaseSpeedVector = new Vector3(RangeDecreaseSpeed,RangeDecreaseSpeed,RangeDecreaseSpeed);
        RangeBoostForClickVector = new Vector3(RangeBoostForClick,RangeBoostForClick,RangeBoostForClick);

        originalZValue = transform.position.z;
        setPositionToCurrentNode ();
    }
コード例 #10
0
        protected string BuildKeywordComponents(GOD descriptor, GameObject[] objects)
        {
            if (gods.Length > k_LODDetail2)
            {
                return(descriptor.gameObject.name);
            }
            if (gods.Length > k_LODDetail1)
            {
                return(GetTransformPath(descriptor.gameObject.transform));
            }

            return(BuildComponents(descriptor.gameObject));
        }
コード例 #11
0
        static void Main(string[] args)
        {
            Console.WriteLine("---Hello World!---");

            GOD.SeedUniverse();

            Task.Run(() =>
            {
                GOD.StartUniverse();
            });


            using (var window = new Window(GOD.Universe))
            {
                window.Run(60);
            }

            Console.ReadKey();
        }
コード例 #12
0
        private IEnumerator <SearchItem> BuildGODS(SearchContext context, SearchProvider provider)
        {
            var matches        = new List <int>();
            var objects        = fetchGameObjects();
            var filter         = CleanString(context.searchQuery);
            var useFuzzySearch = objects.Length < k_LODDetail2 && context.categories.Any(c => c.name.id == "fuzzy" && c.isEnabled);

            gods = new GOD[objects.Length];
            for (int i = 0; i < objects.Length; ++i)
            {
                var id = objects[i].GetInstanceID();
                gods[i] = new GOD {
                    id = id.ToString(), gameObject = objects[i]
                };
                if (!componentsById.TryGetValue(id, out gods[i].tokens))
                {
                    gods[i].keywords   = buildKeywordComponents(gods[i], objects);
                    componentsById[id] = gods[i].tokens = CleanString(gods[i].keywords);
                }
                yield return(MatchGOD(context, provider, gods[i], i, useFuzzySearch, filter, matches));
            }
        }
コード例 #13
0
ファイル: GOD.cs プロジェクト: gallobonts/portfolio
    public delegate void voidDelegate();//used for the timer function



    void Awake()
    {
        if (nullify)
        {
            return;
        }

        if (myGOD != null && myGOD != this)
        {
            Destroy(this.gameObject);
            nullify = true;
        }

        DontDestroyOnLoad(this.gameObject);
        myGOD = this;


        Load();

        //we reset it on level change

        OnLevelWasLoaded(Application.loadedLevel);
    }
コード例 #14
0
        public SceneObjectsProvider(string providerId, string displayName = null)
            : base(providerId, displayName)
        {
            priority = 50;
            filterId = "h:";

            subCategories = new List <NameId>
            {
                new NameId("fuzzy", "fuzzy"),
                new NameId("limit", $"limit to {k_LimitMatches} matches")
            };

            isEnabledForContextualSearch = () =>
                                           QuickSearchTool.IsFocusedWindowTypeName("SceneView") ||
                                           QuickSearchTool.IsFocusedWindowTypeName("SceneHierarchyWindow");

            EditorApplication.hierarchyChanged += () => componentsById.Clear();

            onEnable = () =>
            {
                //using (new DebugTimer("Building Scene Object Description"))
                {
                    var objects     = new GameObject[0];
                    var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
                    if (prefabStage != null)
                    {
                        objects = SceneModeUtility.GetObjects(new[] { prefabStage.prefabContentsRoot }, true);
                    }
                    else
                    {
                        var goRoots = new List <UnityEngine.Object>();
                        for (int i = 0; i < UnityEngine.SceneManagement.SceneManager.sceneCount; ++i)
                        {
                            goRoots.AddRange(UnityEngine.SceneManagement.SceneManager.GetSceneAt(i).GetRootGameObjects());
                        }
                        objects = SceneModeUtility.GetObjects(goRoots.ToArray(), true);
                    }

                    //using (new DebugTimer($"Fetching {gods.Length} Scene Objects Components"))
                    {
                        gods = new GOD[objects.Length];
                        for (int i = 0; i < objects.Length; ++i)
                        {
                            gods[i].gameObject = objects[i];
                            var id = gods[i].gameObject.GetInstanceID();
                            if (!componentsById.TryGetValue(id, out gods[i].name))
                            {
                                if (gods.Length > k_LODDetail2)
                                {
                                    gods[i].name = CleanString(gods[i].gameObject.name);
                                }
                                else if (gods.Length > k_LODDetail1)
                                {
                                    gods[i].name = CleanString(GetTransformPath(gods[i].gameObject.transform));
                                }
                                else
                                {
                                    gods[i].name = BuildComponents(gods[i].gameObject);
                                }
                                componentsById[id] = gods[i].name;
                            }
                        }

                        indexer = new SceneSearchIndexer(SceneManager.GetActiveScene().name, gods);
                        indexer.Build();
                    }
                }
            };

            onDisable = () =>
            {
                indexer = null;
                gods    = new GOD[0];
            };

            fetchItems = (context, items, provider) =>
            {
                if (gods == null)
                {
                    return;
                }

                if (indexer != null && indexer.IsReady())
                {
                    var results = indexer.Search(context.searchQuery).Take(201);
                    items.AddRange(results.Select(r =>
                    {
                        if (r.index < 0 || r.index >= gods.Length)
                        {
                            return(provider.CreateItem("invalid"));
                        }

                        var gameObjectId   = gods[r.index].gameObject.GetInstanceID().ToString();
                        var gameObjectName = gods[r.index].gameObject.name;
                        var itemScore      = r.score - 1000;
                        if (gameObjectName.Equals(context.searchQuery, StringComparison.InvariantCultureIgnoreCase))
                        {
                            itemScore *= 2;
                        }
                        var item = provider.CreateItem(gameObjectId, itemScore, null, null, null, r.index);
                        item.descriptionFormat = SearchItemDescriptionFormat.Ellipsis |
                                                 SearchItemDescriptionFormat.RightToLeft |
                                                 SearchItemDescriptionFormat.Highlight;
                        return(item);
                    }));
                }

                SearchGODs(context, provider, items);
            };

            fetchLabel = (item, context) =>
            {
                if (item.label != null)
                {
                    return(item.label);
                }

                var go = ObjectFromItem(item);
                if (!go)
                {
                    return(item.id);
                }

                var transformPath = GetTransformPath(go.transform);
                var components    = go.GetComponents <Component>();
                if (components.Length > 2 && components[1] && components[components.Length - 1])
                {
                    item.label = $"{transformPath} ({components[1].GetType().Name}..{components[components.Length-1].GetType().Name})";
                }
                else if (components.Length > 1 && components[1])
                {
                    item.label = $"{transformPath} ({components[1].GetType().Name})";
                }
                else
                {
                    item.label = $"{transformPath} ({item.id})";
                }

                long       score   = 1;
                List <int> matches = new List <int>();
                var        sq      = CleanString(context.searchQuery);
                if (FuzzySearch.FuzzyMatch(sq, CleanString(item.label), ref score, matches))
                {
                    item.label = RichTextFormatter.FormatSuggestionTitle(item.label, matches);
                }

                return(item.label);
            };

            fetchDescription = (item, context) =>
            {
                #if QUICKSEARCH_DEBUG
                item.description = gods[(int)item.data].name + " * " + item.score;
                #else
                var go = ObjectFromItem(item);
                item.description = GetHierarchyPath(go);
                #endif
                return(item.description);
            };

            fetchThumbnail = (item, context) =>
            {
                if (item.thumbnail)
                {
                    return(item.thumbnail);
                }

                var obj = ObjectFromItem(item);
                if (obj != null)
                {
                    if (SearchSettings.fetchPreview)
                    {
                        var assetPath = GetHierarchyAssetPath(obj, true);
                        if (!String.IsNullOrEmpty(assetPath))
                        {
                            item.thumbnail = AssetPreview.GetAssetPreview(obj);
                            if (item.thumbnail)
                            {
                                return(item.thumbnail);
                            }
                            item.thumbnail = Utils.GetAssetThumbnailFromPath(assetPath, true);
                            if (item.thumbnail)
                            {
                                return(item.thumbnail);
                            }
                        }
                    }

                    item.thumbnail = PrefabUtility.GetIconForGameObject(obj);
                    if (item.thumbnail)
                    {
                        return(item.thumbnail);
                    }
                    item.thumbnail = EditorGUIUtility.ObjectContent(obj, obj.GetType()).image as Texture2D;
                }

                return(item.thumbnail);
            };

            startDrag = (item, context) =>
            {
                var obj = ObjectFromItem(item);
                if (obj != null)
                {
                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.objectReferences = new[] { obj };
                    DragAndDrop.StartDrag("Drag scene object");
                }
            };

            trackSelection = (item, context) => PingItem(item);
        }
コード例 #15
0
ファイル: StartButton.cs プロジェクト: mwebi/AxonClone
 // Use this for initialization
 void Start()
 {
     ohmyGOD = GODObject.GetComponent<GOD>();
 }
コード例 #16
0
ファイル: NodeGeneration.cs プロジェクト: mwebi/AxonClone
    // Use this for initialization
    void Start()
    {
        currentNode  = LineStartNode;
        lastGeneratedNode = lastGeneratedOriginNode = GeneratorStartNode;

        ohmyGOD = GODObject.GetComponent<GOD>();
        tempPos = new Vector3();

        canGenerateNewNodes = true;
        firstTimeNodeGeneration = true;
    }
コード例 #17
0
    //private Vector2 scrollPos = new Vector2(Screen.width / 2, Screen.height / 2);
    // Use this for initialization
    void Start()
    {
        god = (GOD)FindObjectOfType(typeof(GOD));
        server = gameObject.AddComponent<Servers>();

        refreshHostList();

        resolutions = new Resolution[20];

        resolutions[0].width = 640;
        resolutions[0].height = 480;

        resolutions[1].width = 720;
        resolutions[1].height = 576;

        resolutions[2].width = 800;
        resolutions[2].height = 600;

        resolutions[3].width = 1024;
        resolutions[3].height = 768;

        resolutions[4].width = 1152;
        resolutions[4].height = 648;

        resolutions[5].width = 1152;
        resolutions[5].height = 864;

        resolutions[6].width = 1280;
        resolutions[6].height = 720;

        resolutions[7].width = 1280;
        resolutions[7].height = 800;

        resolutions[8].width = 1280;
        resolutions[8].height = 960;

        resolutions[9].width = 1280;
        resolutions[9].height = 1024;

        resolutions[10].width = 1360;
        resolutions[10].height = 768;

        resolutions[11].width = 1360;
        resolutions[11].height = 1024;

        resolutions[12].width = 1366;
        resolutions[12].height = 768;

        resolutions[13].width = 1400;
        resolutions[13].height = 1050;

        resolutions[14].width = 1440;
        resolutions[14].height = 900;

        resolutions[15].width = 1600;
        resolutions[15].height = 900;

        resolutions[16].width = 1600;
        resolutions[16].height = 1200;

        resolutions[17].width = 1680;
        resolutions[17].height = 1050;

        resolutions[18].width = 1776;
        resolutions[18].height = 1000;

        resolutions[19].width = 1920;
        resolutions[19].height = 1080;
    }
コード例 #18
0
ファイル: SceneObjectsProvider.cs プロジェクト: naburangi/AMS
        private IEnumerator <SearchItem> BuildGODS(SearchContext context, SearchProvider provider)
        {
            //using (new DebugTimer("BuildGODS"))
            {
                var objects     = new GameObject[0];
                var prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
                if (prefabStage != null)
                {
                    objects = SceneModeUtility.GetObjects(new[] { prefabStage.prefabContentsRoot }, true);
                    yield return(null);
                }
                else
                {
                    var goRoots = new List <UnityEngine.Object>();
                    for (int i = 0; i < SceneManager.sceneCount; ++i)
                    {
                        var scene = SceneManager.GetSceneAt(i);
                        if (!scene.IsValid() || !scene.isLoaded)
                        {
                            continue;
                        }

                        var sceneRootObjects = scene.GetRootGameObjects();
                        if (sceneRootObjects != null && sceneRootObjects.Length > 0)
                        {
                            goRoots.AddRange(sceneRootObjects);
                        }
                        yield return(null);
                    }

                    objects = SceneModeUtility.GetObjects(goRoots.ToArray(), true);
                    yield return(null);
                }

                //using (new DebugTimer($"Fetching Scene Objects Components"))
                {
                    List <int> matches        = new List <int>();
                    var        useFuzzySearch = objects.Length < k_LODDetail2 && context.categories.Any(c => c.name.id == "fuzzy" && c.isEnabled);

                    gods = new GOD[objects.Length];
                    for (int i = 0; i < objects.Length; ++i)
                    {
                        gods[i].gameObject = objects[i];
                        var id = gods[i].gameObject.GetInstanceID();
                        if (!componentsById.TryGetValue(id, out gods[i].name))
                        {
                            if (gods.Length > k_LODDetail2)
                            {
                                gods[i].rawname = gods[i].gameObject.name;
                            }
                            else if (gods.Length > k_LODDetail1)
                            {
                                gods[i].rawname = GetTransformPath(gods[i].gameObject.transform);
                            }
                            else
                            {
                                gods[i].rawname = BuildComponents(gods[i].gameObject);
                            }
                            gods[i].name       = CleanString(gods[i].rawname);
                            componentsById[id] = gods[i].name;
                        }
                        gods[i].id = id.ToString();

                        yield return(MatchGOD(context, provider, gods[i], i, useFuzzySearch, CleanString(context.searchQuery), matches));
                    }
                }
            }
        }
コード例 #19
0
ファイル: ScoreCounter.cs プロジェクト: mwebi/AxonClone
 // Use this for initialization
 void Start()
 {
     ohmyGOD = GODObject.GetComponent<GOD>();
     currentScore = 0;
     ScoreCounterText = GetComponent<GUIText>();
 }
コード例 #20
0
ファイル: NeuronLine.cs プロジェクト: mwebi/AxonClone
    // Use this for initialization
    void Start()
    {
        NeuronLineRenderer = GetComponent<LineRenderer>();
        ohmyGOD = GODObject.GetComponent<GOD>();
        segments=0;

        spawnedBranch = false;
        if(branchDepth == 0){
            positionToReach = lastPosition;
            lastPosition = transform.position;
            lastPositionToReach = lastPosition;

            currentLineStartWidth = MotherStartWidth;
        }
        setStartPositionAsFirstSegment();
    }