Exemplo n.º 1
0
    public void OnPointerClick()
    {
        switch (selectableType)
        {
        case SelectableType.Background:
            foreach (Background background in loadAssets.lstBackgrounds)
            {
                if (background.obj == gameObject)
                {
                    loadAssets.rendBackground.material.mainTexture = background.texture;
                }
            }
            if (loadAssets.IsBackgroundHidden)
            {
                GetSelectable(SelectableType.BackgroundHider).OnPointerClick();
            }
            break;

        case SelectableType.NPC:
            foreach (NPC npc in loadAssets.lstNPCs)
            {
                if (npc.obj == gameObject)
                {
                    loadAssets.textureHandlerNPC.SetNPC(npc);
                }
            }
            if (loadAssets.IsNPCHidden)
            {
                GetSelectable(SelectableType.Hider).OnPointerClick();
            }
            break;

        case SelectableType.Hider:
            loadAssets.IsNPCHidden = !loadAssets.IsNPCHidden;
            rawImage.color         = new Color(1, 1, 1, loadAssets.IsNPCHidden ? 0.5f : 1);
            break;

        case SelectableType.Focus:
            loadAssets.IsFocus = !loadAssets.IsFocus;
            rawImage.color     = new Color(1, 1, 1, loadAssets.IsFocus ? 0.5f : 1);
            break;

        case SelectableType.Dark:
            loadAssets.IsDark = !loadAssets.IsDark;
            rawImage.color    = new Color(1, 1, 1, loadAssets.IsDark ? 1 : 0.5f);
            break;

        case SelectableType.Muter:
            loadAssets.IsMuted = !loadAssets.IsMuted;
            rawImage.color     = new Color(1, 1, 1, loadAssets.IsMuted ? 0.5f : 1);
            break;

        case SelectableType.BackgroundHider:
            loadAssets.IsBackgroundHidden = !loadAssets.IsBackgroundHidden;
            rawImage.color = new Color(1, 1, 1, loadAssets.IsBackgroundHidden ? 0.5f : 1);
            break;

        case SelectableType.Attack:
            loadAssets.textureHandlerNPC.transform.localScale = Vector3.one * 1.25f;
            rawImage.color = new Color(1, 1, 1, loadAssets.IsBackgroundHidden ? 0.5f : 1);
            loadAssets.rendFlash.material.color = Color.white;
            break;

        case SelectableType.Damage:
            loadAssets.textureHandlerNPC.transform.localScale = Vector3.one * 0.9f;
            loadAssets.textureHandlerNPC.transform.position  += new Vector3(0, -0.1f, 0);
            loadAssets.rendFlash.material.color = Color.red;
            rawImage.color = new Color(1, 1, 1, loadAssets.IsBackgroundHidden ? 0.5f : 1);
            break;

        case SelectableType.Refresh:
            loadAssets.LoadBackgrounds();
            loadAssets.LoadNPCs();
            break;
        }
    }