コード例 #1
0
    private void AddChars()
    {
        List <Character> allChar = Fight.Inst.GetAllCharacter(attacker.camp);

        for (int num = 0; num < MaxNum && slots.Count > 0;)
        {
            int      id       = Buff;
            HeroData jsd_hero = DataMgr.GetHero(id);
            if (jsd_hero != null)
            {
                Monster monster = new Monster();
                monster.LV           = attacker.lv;
                monster.STRENGTHENID = attacker.strengthenid;
                monster.Data         = jsd_hero;

                int idx  = Fight.Rand(0, slots.Count);
                int slot = slots[idx];

                Character c = Character.Create(monster);
                c.isFenLie = true;
                c.SetCamp(attacker.camp);
                c.InitUI();
                c.slot   = slot;
                c.SrcPos = Fight.Inst.GetSlotPos(c.camp, slot);
                if (c.camp == CampType.Friend)
                {
                    c.SrcRotation = Quaternion.Euler(new Vector3(0, 90f, 0));
                    c.direction   = new Vector3(1f, 0f, 0f);
                }
                else
                {
                    c.SrcRotation = Quaternion.Euler(new Vector3(0, -90f, 0));
                    c.direction   = new Vector3(-1f, 0f, 0f);
                }
                c.position = attacker.position;
                c.ReqPassiveSkill();
                c.visible = false;

                addChars.Add(c);
                allChar.Add(c);

                slots.RemoveAt(idx);
                ++num;
            }
        }

        Fight.Inst.SortAllChar(attacker.camp);
    }