public static ComboFlyObj Create(Vector3[] ps)
    {
        if (ps.Length < 4)
        {
            return(null);
        }
        GameObject go      = Resources.Load("Prefabs/MapObj/ComboFlyObj") as GameObject;
        GameObject tempObj = (GameObject)Instantiate(go);

        tempObj.transform.position = ps[0];
        ComboFlyObj cf = tempObj.transform.GetComponent <ComboFlyObj>();

        cf.Init(ps);


        return(cf);
    }
Exemple #2
0
    void KillObj()
    {
        List <InGameBaseObj> objlist = InGameManager.GetInstance().inGameLevelManager.objList;

        int  killcount = 0;
        bool iscombo   = false;

        for (int i = 0; i < objlist.Count; i++)
        {
            InGameBaseObj obj = objlist[i];
            if (obj.myObjType == InGameBaseObj.ObjType.role)
            {
                continue;
            }
            float dis = Mathf.Abs(transform.position.y - obj.transform.position.y);
            if (dis < obj.transform.localScale.x / 2)
            {
                if (obj.GetMyState() != GetMyState())
                {
                    InGameManager.GetInstance().GameOver();
                    return;
                }

                obj.SetDie();
                killcount++;
                bool c = dis < 0.2f;
                AddScores(1, c, obj);

                if (c)
                {
                    (new EventCreateEffect(60010014, null, obj.transform.position, 1)).Send();

                    //combo fly obj
                    Vector3[] ps =
                    {
                        obj.transform.position,
                        new Vector3(0,         obj.transform.position.y + obj.transform.position.x /*Random.Range(8f,15f)*/,0),
                        InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos -
                        new Vector3(0,         Random.Range(8f,                                                      15f),0),
                        InGameManager.GetInstance().inGameUIManager.gamePadManager.comboLabelPos
                    };
                    Debug.Log(ps[0]);
                    Debug.Log(ps[1]);
                    Debug.Log(ps[2]);
                    Debug.Log(ps[3]);
                    ComboFlyObj.Create(ps);
                }

                iscombo = iscombo | c;
            }
        }
        if (killcount == 0)
        {
            InGameManager.GetInstance().GameOver();
        }

        float effectscale = 2f;

        if (iscombo)
        {
            effectscale = 6;
        }

        if (GetMyState() == GameObjState.black)
        {
            (new EventCreateEffect(60010010, null, transform.position, effectscale)).Send();
        }
        else if (GetMyState() == GameObjState.white)
        {
            (new EventCreateEffect(60010011, null, transform.position, effectscale)).Send();
        }
    }