Exemple #1
0
    void SetupFightCtller()
    {
        //ResMgr.Instance.CreateGameObject("BG/BG01", gameObject);

        m_fc = new FightCtller();
        m_fc.Create();

        GameObject ctl = Util.NewGameObject("FCtller", RootSprite);
        m_fcv = ctl.AddComponent<FightCtllerView>();
        m_fcv.Create(m_fc);

        string[] keys = null;
        Int2D[] pts = null;

        keys = new string[] { "M01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01" };
        pts = new Int2D[] { new Int2D(0, 0), new Int2D(2, 0), new Int2D(3, 0), new Int2D(4, 0), new Int2D(0, 1), new Int2D(1, 1), new Int2D(2, 1), new Int2D(3, 1), new Int2D(4, 1), new Int2D(0, 2), new Int2D(1, 2), new Int2D(2, 2), new Int2D(3, 2), new Int2D(4, 2)};
        for (int p = 0; p < keys.Length; ++ p)
        {
            string k = keys[p];
            InfoCreature info = new InfoCreature(ProtoMgr.Instance.GetByKey<ProtoCreature>(k));

            Creature ac = new Creature();
            ac.Create(info);
            m_fc.FGrids[0].AddCreature(ac, pts[p]);
        }

        keys = new string[] { "M01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01", "N01" };
        pts = new Int2D[] { new Int2D(0, 0), new Int2D(2, 0), new Int2D(3, 0), new Int2D(4, 0), new Int2D(0, 1), new Int2D(1, 1), new Int2D(2, 1), new Int2D(3, 1), new Int2D(4, 1), new Int2D(0, 2), new Int2D(1, 2), new Int2D(2, 2), new Int2D(3, 2), new Int2D(4, 2) };
        for (int p = 0; p < keys.Length; ++p)
        {
            string k = keys[p];
            InfoCreature info = new InfoCreature(ProtoMgr.Instance.GetByKey<ProtoCreature>(k));
            //info.Guns = new InfoGun[info.Proto.Guns.Length];
            //for (int i = 0; i < info.Guns.Length; ++i)
            //{
            //    info.Guns[i] = new InfoGun(info.Proto.ProtoGuns[i]);
            //}

            Creature ac = new Creature();
            ac.Create(info);
            m_fc.FGrids[1].AddCreature(ac, pts[p]);
        }

        m_fc.Fight();
    }