Exemplo n.º 1
0
    public void Clear(int i, Tool tool)
    {
        gameObject.SetActive(false);
        isActive = false;
        if (createEffect)
        {
            GameObject prefab = GetPrefab(i);
            GameObject g      = Instantiate(prefab);
            g.transform.position = transform.position;
            if (g == null)
            {
                Debug.Log(tag + "prefab is null");
                return;
            }

            HexEffect hexEffect = g.GetComponent <HexEffect>();
            if (tool == null)
            {
                //Debug.Log(TAG + "tool is null");
                hexEffect.SetUp(tool, this);
            }
            else
            {
                //Debug.Log(TAG + "tool is not null");
                GameObject target = tool.GetTarget();
                hexEffect.SetUp(tool, this);
            }
            //TODO check for null target

            //TODO change for particle effect
            //ParticleSystem p =g.GetComponentInChildren<ParticleSystem>();
            //var main = p.main;


            //main.startColor = color;
            val = 0;
        }
        gridManager.CheckIfComplete();
    }
Exemplo n.º 2
0
    public void CreateAbsorb()
    {
        if (val == 0)
        {
            Clear(1, activeTool);
            return;
        }
        else
        {
            SetWillMix(0.0f);
        }
        GameObject g = Instantiate(GetPrefab(ABSORB_PREFAB));

        g.transform.position = transform.position;
        HexEffect  hexEffect = g.GetComponent <HexEffect>();
        GameObject target    = activeTool.GetTarget();

        hexEffect.SetUp(activeTool, this);
    }