예제 #1
0
    //执行三角格上对应的脚本
    private void DoTriCellFunc(GameObject triCell)
    {
        string instantiateItem = "";

        if (triCell.tag == "RandomCell")
        {
            RandomCell randomCell = triCell.GetComponent <RandomCell>();
            instantiateItem = randomCell.GetRandom(this);

            //获得了点数
            int result;
            if (int.TryParse(instantiateItem, out result))
            {
                StartCoroutine(GetCellEffect(InitNormalCells.pointSpriteDic[result]));
            }
            //获得了普通道具
            else
            {
                StartCoroutine(GetCellEffect(InitPropsCells.propSpriteDic[instantiateItem]));
            }
        }
        else if (triCell.tag == "PropCell")
        {
            PropCell proCell = triCell.GetComponent <PropCell>();
            instantiateItem = proCell.GetProp(this);
            StartCoroutine(GetCellEffect(PropCell.propSpriteDic[instantiateItem]));
        }
        else if (triCell.tag == "EventCell")
        {
            EventCell eventCell = triCell.GetComponent <EventCell>();
            eventCell.ExecuteEvent();

            AudioSource audioSource = triCell.GetComponent <AudioSource>();
            if (audioSource != null)
            {
                audioSource.Play();
            }
        }
    }