예제 #1
0
    /// <summary>
    /// 切换地图
    /// </summary>
    /// <returns>The map.</returns>
    IEnumerator ChangeMap()
    {
        //隐藏大招按钮
        GameObject.Find("btnOD").SetActive(false);
//		GameObject.Find ("btnLE").SetActive (false);
//		GameObject.Find ("btnRR").SetActive (false);


        for (int i = 0; i < enemyList.Count; i++)
        {
            enemyList [i].IsReady = false;
            enemyList [i].BaseSoldier.OnIdle();
        }

        for (int i = 0; i < soldierList.Count; i++)
        {
            soldierList [i].IsReady = false;
            soldierList [i].BaseSoldier.OnIdle();
        }

//		soldierList [0].IsReady = false;
//		soldierList [1].IsReady = false;
//		soldierList [4].IsReady = false;

        //阿莫说话
        GameObject parent      = StageManager.SharedInstance.EffectLayer;
        GameObject popo2Prefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [24].Prefab);
        GameObject popo2       = StageManager.SharedInstance.AddToStage(parent, popo2Prefab);
        Popo       txt2        = popo2.AddComponent <Popo> ();

        txt2.transform.position = MapUtil.GetInstance.MapToWorld(enemyList [2].MapPos.x, enemyList [2].MapPos.y);
        txt2.SetText("小的们顶住!我妈妈喊我回家吃饭!");

        yield return(new WaitForSeconds(2.0f));

        Destroy(popo2);

        //am上天
        BattleAgent amAgent = enemyList [2];

        amAgent.BaseSprite.AddBlackDownEffect();
        amAgent.BaseSprite.gameObject.SetActive(false);
        AudioManager.SharedInstance.PlayOneShot("fly", 1.0f);
        yield return(new WaitForSeconds(1.0f));

        //mx  hm一起上天
        BattleAgent hmAgent = soldierList [2];

        hmAgent.BaseSprite.AddDownEffect();
        hmAgent.BaseSprite.gameObject.SetActive(false);



        BattleAgent mxAgent = soldierList [1];

        mxAgent.BaseSprite.AddDownEffect();
        mxAgent.BaseSprite.gameObject.SetActive(false);

        AudioManager.SharedInstance.PlayOneShot("fly", 1.0f);

        //yield return new WaitForSeconds (0.5f);

        //AudioManager.SharedInstance.PlaySound ("Bgmusic_02", 1.0f);



        //变换背景
        GameObject slashLayer  = StageManager.SharedInstance.SlashLayer;
        GameObject whitePrefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [26].Prefab);
        GameObject white       = StageManager.SharedInstance.AddToStage(slashLayer, whitePrefab);
        Image      img         = white.GetComponent <Image> ();
        Color      c           = new Color(img.color.r, img.color.g, img.color.b, 0);

        img.color = c;

        Hashtable args2 = new Hashtable();

        args2.Add("time", 0.5f);
        args2.Add("alpha", 1.0f);
        iTween.FadeTo(white, args2);

        yield return(new WaitForSeconds(0.5f));

        mxAgent.BaseSprite.gameObject.SetActive(true);
        hmAgent.BaseSprite.gameObject.SetActive(true);
        amAgent.BaseSprite.gameObject.SetActive(true);


        mxAgent.ClearTarget();
        mxAgent.AddTarget(amAgent);
        hmAgent.ClearTarget();
        hmAgent.AddTarget(amAgent);
        amAgent.ClearTarget();
        amAgent.AddTarget(hmAgent);


        //重新设定新位置
        mxAgent.BaseSprite.SetMapPosition(3, 2);
        hmAgent.BaseSprite.SetMapPosition(10, 8);
        amAgent.BaseSprite.SetMapPosition(6, 6);


        mxAgent.BaseSprite.gameObject.SetActive(false);
        hmAgent.BaseSprite.gameObject.SetActive(false);
        amAgent.BaseSprite.gameObject.SetActive(false);


        //移除不要的角色

        List <BattleAgent> list1 = new List <BattleAgent> ();

        for (int i = 0; i < enemyList.Count; i++)
        {
            if (enemyList [i] == amAgent)
            {
                continue;
            }
            list1.Add(enemyList [i]);
        }

        for (int i = 0; i < list1.Count; i++)
        {
            RemoveEnemy(list1 [i]);
        }


        List <BattleAgent> list2 = new List <BattleAgent> ();

        for (int i = 0; i < soldierList.Count; i++)
        {
            if (soldierList [i] == hmAgent)
            {
                continue;
            }

            if (soldierList [i] == mxAgent)
            {
                continue;
            }
            list2.Add(soldierList [i]);
        }

        for (int i = 0; i < list2.Count; i++)
        {
            RemoveSoldier(list2 [i]);
        }


        yield return(new WaitForSeconds(1f));

        GameObject bg2 = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [28].Prefab);

        StageManager.SharedInstance.ChangeBg(bg2);

        Hashtable args3 = new Hashtable();

        args3.Add("time", 1f);
        args3.Add("alpha", 0);
        iTween.FadeTo(white, args3);

        yield return(new WaitForSeconds(0.5f));

        Destroy(white);



        //重新落位
        mxAgent.BaseSprite.AddDownEffect();
        mxAgent.BaseSprite.gameObject.SetActive(true);
        AudioManager.SharedInstance.PlayOneShot("fly", 1.0f);
        yield return(new WaitForSeconds(0.1f));

        hmAgent.BaseSprite.AddDownEffect();
        hmAgent.BaseSprite.gameObject.SetActive(true);
        AudioManager.SharedInstance.PlayOneShot("fly", 1.0f);
        yield return(new WaitForSeconds(0.1f));

        amAgent.BaseSprite.AddBlackDownEffect();
        amAgent.BaseSprite.gameObject.SetActive(true);
        AudioManager.SharedInstance.PlayOneShot("fly", 1.0f);


        mxAgent.IsReady = true;
        hmAgent.IsReady = true;
        amAgent.IsReady = true;
    }
예제 #2
0
파일: Board.cs 프로젝트: Harrimaga/LD48
        public Event RandomEvent(Vector2 position, bool front)
        {
            Event c  = null;
            int   rn = Globals.r.Next(16);

            switch (rn)
            {
            case 0:
                c = new BankError(position, front);
                break;

            case 1:
                c = new Birthday(position, front);
                break;

            case 2:
                c = new CarCrash(position, front);
                break;

            case 3:
                c = new Cinema(position, front);
                break;

            case 4:
                c = new Concert(position, front);
                break;

            case 5:
                c = new Fired(position, front);
                break;

            case 6:
                c = new GoToStart(position, front);
                break;

            case 7:
                c = new Holiday(position, front);
                break;

            case 8:
                c = new Kleptomania(position, front);
                break;

            case 9:
                c = new Party(position, front);
                break;

            case 10:
                c = new PokerEvent(position, front);
                break;

            case 11:
                c = new Popo(position, front);
                break;

            case 12:
                c = new Pyromania(position, front);
                break;

            case 13:
                c = new Shanked(position, front);
                break;

            case 14:
                c = new Stonks(position, front);
                break;

            case 15:
                c = new TaxManCommeth(position, front);
                break;
            }
            return(c);
        }
예제 #3
0
    /// <summary>
    /// 落阵动画
    /// 对白
    /// </summary>
    IEnumerator Step1()
    {
        GameObject parent = StageManager.SharedInstance.EffectLayer;

        yield return(new WaitForSeconds(0.2f));

        for (int i = 0; i < soldierPos.Length; i++)
        {
            GameObject bulletPrefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [21].Prefab);

            GameObject bullet = StageManager.SharedInstance.AddToStage(parent, bulletPrefab);
            BaseBullet pos    = bullet.AddComponent <BaseBullet> ();
            pos.transform.position = MapUtil.GetInstance.MapToWorld(soldierPos [i].x, soldierPos [i].y);
        }

        yield return(new WaitForSeconds(0.2f));

        //英雄落位
        AddHero();

        //感叹号
        for (int i = 0; i < enemyList.Count - 1; i++)
        {
            enemyList [i].dispatchEvent(SoldierEvent.SURPRISE, null);
        }


        yield return(new WaitForSeconds(0.5f));

        //奥丁说话
        GameObject popoPrefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [24].Prefab);
        GameObject popo       = StageManager.SharedInstance.AddToStage(parent, popoPrefab);
        Popo       txt        = popo.AddComponent <Popo> ();

        txt.transform.position = MapUtil.GetInstance.MapToWorld(soldierPos [0].x, soldierPos [0].y);
        txt.SetText("大家就位,做好战斗准备!");

        yield return(new WaitForSeconds(2.0f));

        Destroy(popo);


        //朱雀阵型
        GameObject zhuquePrefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [22].Prefab);

        GameObject zhuque       = StageManager.SharedInstance.AddToStage(parent, zhuquePrefab);
        BaseEffect zhuqueEffect = zhuque.AddComponent <BaseEffect> ();

        zhuqueEffect.transform.position = MapUtil.GetInstance.MapToWorld(8, 6);


        Hashtable args1 = new Hashtable();

        args1.Add("time", 1.5f);
        args1.Add("alpha", 0f);
        iTween.FadeTo(zhuque, args1);

        yield return(new WaitForSeconds(2.0f));

        Destroy(zhuque);

        //阿莫说话
        GameObject popo2Prefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [24].Prefab);
        GameObject popo2       = StageManager.SharedInstance.AddToStage(parent, popo2Prefab);
        Popo       txt2        = popo2.AddComponent <Popo> ();

        txt2.transform.position = MapUtil.GetInstance.MapToWorld(enemyPos [2].x, enemyPos [2].y);
        txt2.SetText("小的们,野狗阵型走起!");

        yield return(new WaitForSeconds(2.0f));

        Destroy(popo2);

        //白虎阵型
        GameObject baihuPrefab = ResourceManager.GetInstance.LoadPrefab(TestData.charDB [23].Prefab);

        GameObject baihu       = StageManager.SharedInstance.AddToStage(parent, baihuPrefab);
        BaseEffect baihuEffect = baihu.AddComponent <BaseEffect> ();

        baihuEffect.transform.position = MapUtil.GetInstance.MapToWorld(8, 6);


        Hashtable args2 = new Hashtable();

        args2.Add("time", 1.5f);
        args2.Add("alpha", 0f);
        iTween.FadeTo(baihu, args2);


        yield return(new WaitForSeconds(2.0f));

        Destroy(baihu);


//		enemyList [3].IsReady = true;
//		soldierList [2].IsReady = true;

        for (int i = 0; i < soldierList.Count; i++)
        {
            soldierList [i].IsReady = true;
        }

        for (int i = 0; i < enemyList.Count; i++)
        {
            enemyList [i].IsReady = true;
        }
    }