public void AddDirectionIndicator(LocatableItem target)
    {
        GameObject direction = Instantiate(DirectionPrefab);

        direction.transform.SetParent(ArrowPanel.transform, false);
        direction.GetComponent <ArrowDirectionIndicator>().Init(target, LocatorArrowDuration);
    }
示例#2
0
        public IEnumerator TestItemColor()
        {
            yield return(null);

            LocatableItem item = go.AddComponent <LocatableItem>();

            item.Thumbnail = Texture2D.whiteTexture;

            Assert.AreEqual(Color.white, item.Color);
        }
示例#3
0
    public void Init(LocatableItem target, float duration = 15f)
    {
        Target = target;

        ArrowColor.color = target.Color;

        MenuUtility.LerpFromTransparent(ArrowBase, 1 / 4f, 0f);
        MenuUtility.LerpFromTransparent(ArrowColor, 1 / 2f, 0.3f);

        MenuUtility.LerpInFillAmount(ArrowColor, 1 / 2f, 0f);

        Path.Init(Target, duration, 0.4f);

        StartCoroutine(End(duration));
    }
    public void Init(LocatableItem target, Vector3 offset)
    {
        Target = target;

        transform.position += offset;

        Thumbnail.texture = target.Thumbnail;
        Border.color      = target.Color;

        MenuUtility.LerpFromTransparent(Background, 0.5f, 0f);
        MenuUtility.LerpFromTransparent(Thumbnail, 0.5f, 0.2f);
        MenuUtility.LerpFromTransparent(OuterBorder, 0.125f, 0f);
        MenuUtility.LerpFromTransparent(Border, 0.125f, 0.2f);
        MenuUtility.LerpOutFillAmount(OuterBorder, 0.333f, 0.2f);

        StartCoroutine(End());

        AddDirectionIndicator(target);
    }
示例#5
0
    // Simplified method
    public IEnumerator AssignThumbnail(LocatableItem item)
    {
        if (!item)
        {
            yield break;
        }

        while (busy)
        {
            yield return(null);
        }

        busy = true;

        Stage         stage         = Instantiate(StagePrefab).GetComponent <Stage>();
        RenderTexture renderTexture = stage.GetThumbnailRenderTexture();

        GameObject copy = CreateCopyOfGameObject(item.gameObject);

        PositionCopyOnStage(copy);

        renderTexture.Create();

        yield return(new WaitForEndOfFrame());

        RenderTexture.active = renderTexture;

        Texture2D tex = new Texture2D(2, 2);

        tex.LoadImage(GetTextureBytes(renderTexture));

        item.Thumbnail = tex;

        renderTexture.Release();

        Destroy(stage.gameObject);
        Destroy(copy);

        busy = false;
    }
示例#6
0
    public void Init(LocatableItem target, float duration, float delay)
    {
        Target = target;

        CreatePathToObject(Target.gameObject, duration, delay);
    }
示例#7
0
 public void ItemAddedEvent(LocatableItem item)
 {
     StartCoroutine(AssignThumbnail(item));
 }