Esempio n. 1
0
    void Awake()
    {
        light = GetComponent <Light> ();
        if (!ignoreChildren)
        {
            images    = GetComponentsInChildren <Image> ();
            txt       = GetComponentsInChildren <TextMeshProUGUI> ();
            uitxt     = GetComponentsInChildren <Text> ();
            craptxt   = GetComponentsInChildren <TextMesh> ();
            sprites   = GetComponentsInChildren <SpriteRenderer> ();
            renderers = GetComponentsInChildren <MeshRenderer> ();
        }
        else
        {
            images    = GetComponents <Image> ();
            txt       = GetComponents <TextMeshProUGUI> ();
            uitxt     = GetComponents <Text> ();
            craptxt   = GetComponents <TextMesh> ();
            sprites   = GetComponents <SpriteRenderer> ();
            renderers = GetComponents <MeshRenderer> ();
        }


        manager = RecolorManager.Get();

        if (manager == null)
        {
            manager = FindObjectOfType <RecolorManager> ();
        }
        SelfRegister();
    }
    // Use this for initialization
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (instance != this)
        {
            Destroy(gameObject);
            Debug.LogWarning("An instance of RecolorManager already exists");
        }

        charStore = FindObjectOfType <CharacterStorage>();
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        rec      = RecolorManager.Get();
        reclist  = transform.parent.GetComponent <RecolorListener> ();
        txts     = buttonTop.GetComponentsInChildren <TMPro.TextMeshProUGUI> ();
        src      = gameObject.AddComponent <AudioSource> ();
        src.clip = sound;
        input    = FindObjectOfType <InputManager> ();
        button   = GetComponentInChildren <Button> ();

        camControl = FindObjectOfType <CameraController>();


        Vector3 targetOffset = new Vector3(223, 234, 0);

        if ((float)Screen.width / Screen.height < 0.5f)
        {
            UnityEngine.UI.CanvasScaler cnv = positionRef.root.GetComponent <UnityEngine.UI.CanvasScaler> ();
            float canvasRatio = Mathf.Lerp(cnv.referenceResolution.x, cnv.referenceResolution.y, cnv.matchWidthOrHeight);
            float screenRatio = Mathf.Lerp(Screen.width, Screen.height, cnv.matchWidthOrHeight);
            scaleRatio = canvasRatio / screenRatio;
            //Debug.Log (Screen.width/Screen.height);
            targetOffset = new Vector3(150, 110, 0);
        }


        Vector3 b = buttonTop.rectTransform.TransformPoint(targetOffset);


        Vector2 screenPoint = camControl.WorldToUI(b);

        pos = screenPoint * scaleRatio;


        Debug.LogWarning("Bomb pos is " + pos);

        anchorPos = toShake.anchoredPosition;

        _charges = Persistence.bombs;
        Toggle(_charges > 0);

        UpdateUI();
    }
Esempio n. 4
0
    public void SpawnChar(int id)
    {
        Spine.TrackEntry trc        = null;
        string           curAnim    = "idle";
        float            normalTime = 0;
        bool             initiated  = anim != null;

        if (initiated)
        {
            trc        = anim.skeleton.state.GetCurrent(0);
            curAnim    = trc.Animation.name;
            normalTime = trc.TrackTime / trc.Animation.duration;

            Destroy(anim.gameObject);
        }

        curChar = charStorage.GetCharacter(id);
        GameObject go = Instantiate(curChar.prefab, transform.position, curChar.prefab.transform.rotation);

        go.transform.parent = transform;
        Init(go);
        anim.skeleton.state.SetAnimation(0, curAnim, curAnim == "idle");

        if (initiated)
        {
            trc = anim.skeleton.state.GetCurrent(0);


            trc.TrackTime   = normalTime * trc.Animation.duration;
            trc.mixDuration = 0;
        }
        root = anim.skeleton.skeleton.FindBone("body");

        //Recolor!
        RecolorManager rc = RecolorManager.Get();

        if (rc != null)
        {
            rc.Recolor(id);
        }
    }
 void Start()
 {
     charStorage = FindObjectOfType <CharacterStorage>();
     recolor     = RecolorManager.Get();//FindObjectOfType<RecolorManager>();
     SpawnCurrent();
 }