Example #1
0
    public void setUp(List <GameObject> _boids)
    {
        boids    = _boids;
        boidTree = new List <FormationInfo>();

        for (int i = 0; i < boids.Count; i++)
        {
            if (boidTree.Count == 0)
            {
                FormationInfo info = new FormationInfo();
                info.parent   = -1;
                info.children = new List <int>();
                boids[i].GetComponent <Character>().staticInfo.position = boids[i].transform.position;
                boidTree.Add(info);
            }
            else
            {
                for (int j = 0; j < i; j++)
                {
                    if (boidTree[j].children.Count < 2)
                    {
                        FormationInfo info = new FormationInfo();
                        info.parent   = j;
                        info.children = new List <int>();
                        boidTree[j].children.Add(i);
                        boids[i].GetComponent <CharacterManager>().setUp(boids[j].transform.position);
                        boids[i].GetComponent <CharacterManager>().target       = boids[j].transform.position;
                        boids[i].GetComponent <Character>().staticInfo.position = boids[i].transform.position;
                        boids[i].GetComponent <CharacterManager>().mode         = "arrive";
                        boidTree.Add(info);
                    }
                }
            }
        }
    }
Example #2
0
        //private Dictionary<BuffType, string> _immnueBuffIcon = new Dictionary<BuffType, string>();

        public void Clear()
        {
            fightPlayerInfo = null;
            if (fightHeroInfoList != null)
            {
                fightHeroInfoList.Clear();
            }
            fightHeroInfoList    = null;
            enemyFightPlayerInfo = null;
            if (enemyFightHeroInfoList != null)
            {
                enemyFightHeroInfoList.Clear();
            }
            enemyFightHeroInfoList = null;
            if (consortiaFightDatas != null)
            {
                consortiaFightDatas.Clear();
            }
            consortiaFightDatas = null;
            dropItems           = null;
            ourFormation        = null;
            enemyFormation      = null;
            fightResultStar     = 3;
            randomSeed          = 0;
            fightId             = 0;
            isHome = false;
            _buffIcons.Clear();
            //_immnueBuffIcon.Clear();
        }
Example #3
0
    override public void Read(BinaryHelper helper)
    {
        x = helper.ReadInt();
        z = helper.ReadInt();
        int arryListCount = helper.ReadInt();

        if (dataList == null)
        {
            dataList = new List <FormationInfo>();
        }

        dataList.Clear();

        Debug.Log("阵型.x:" + x + "z:" + z + ",arryListCount:" + arryListCount);

        for (int j = 0; j < arryListCount; j++)
        {
            FormationInfo info = new FormationInfo();
            info.id     = helper.ReadInt();
            info.weight = helper.ReadInt();

            info.list = new Dictionary <int, List <MonsterInfo> >();

            int formationcount = helper.ReadInt();

            Debug.Log("阵型item id:" + info.id + "weight:" + info.weight + ",formationcount:" + formationcount);

            for (int m = 0; m < formationcount; m++)
            {
                List <MonsterInfo> item = new List <MonsterInfo>();
                int tag          = helper.ReadInt();
                int mosterCounts = helper.ReadInt();

                Debug.Log("怪物 tag:" + tag + ",mosterCounts:" + mosterCounts);
                for (int n = 0; n < mosterCounts; n++)
                {
                    MonsterInfo monsterInfo = new MonsterInfo();
                    monsterInfo.id     = helper.ReadInt();
                    monsterInfo.weight = helper.ReadInt();
                    int showBegin = helper.ReadInt();
                    Debug.Log("monsterId.id:" + monsterInfo.id + ",monsterWeight:" + monsterInfo.weight + ",showBegin:" + showBegin);
                    item.Add(monsterInfo);
                }

                info.list.Add(tag, item);
                int monsterSerNo = helper.ReadInt();
                Debug.Log("monsterSerNo:" + monsterSerNo);
            }

            dataList.Add(info);
        }
    }
Example #4
0
        public void SetData(TeamFightProtoData myProtoData, TeamFightProtoData enemyProtoData, List <DropItem> dropItems = null)
        {
            //my
            if (myProtoData.player != null)
            {
                PlayerInfo playerInfo = GameProxy.instance.PlayerInfo;                //new PlayerInfo((uint)myProtoData.player.id, (uint)myProtoData.player.modelId, (uint)myProtoData.player.hairCutId, (uint)myProtoData.player.hairColorId, (uint)myProtoData.player.faceId, myProtoData.player.skinId, string.Empty);
                fightPlayerInfo = new FightPlayerInfo(playerInfo, myProtoData.player);
            }
            fightHeroInfoList = new List <FightHeroInfo>();
            HeroFightProtoData data;
            int count = myProtoData.heros.Count;

            for (int i = 0; i < count; i++)
            {
                data = myProtoData.heros[i];
                HeroInfo heroInfo = HeroProxy.instance.GetHeroInfo((uint)data.id);
                fightHeroInfoList.Add(new FightHeroInfo(heroInfo, data));
            }
            ourFormation = FormationProxy.instance.GetFormationInfo(myProtoData.lineup.no);
            //enemy
            PlayerFightProtoData opponentPlayerData = enemyProtoData.player;
            PlayerInfo           enemyPlayer        = opponentPlayerData == null ? null : new PlayerInfo((uint)opponentPlayerData.id, (uint)opponentPlayerData.modelId, (uint)opponentPlayerData.hairCutId, (uint)opponentPlayerData.hairColorId, (uint)opponentPlayerData.faceId, opponentPlayerData.skinId, string.Empty);

            if (enemyPlayer != null)
            {
                enemyPlayer.UpdateSkillTalentByProtocol(opponentPlayerData.talnets, opponentPlayerData.selectedTalnet);
                enemyFightPlayerInfo = new FightPlayerInfo(enemyPlayer, opponentPlayerData);
            }

            enemyFightHeroInfoList = new List <FightHeroInfo>();
            count = enemyProtoData.heros.Count;
            for (int i = 0; i < count; i++)
            {
                data = enemyProtoData.heros[i];
                HeroInfo enemyHero = new HeroInfo((uint)data.id, data.modelId, 1, 0, data.star, 1);
                enemyFightHeroInfoList.Add(new FightHeroInfo(enemyHero, data));
            }
            enemyFormation = new FormationInfo(enemyProtoData.lineup.no, enemyProtoData.lineup.lv);
            enemyFormation.isActiveAdditionAttr = enemyProtoData.lineup.attrIsActive;
            //drop
            if (dropItems != null)
            {
                this.dropItems = new List <DropItem>(dropItems);
            }
            Logic.UI.FightResult.Model.FightResultProxy.instance.SaveLastTeamData();
        }
Example #5
0
        //public string GetImmnueIconPath(BuffType buffType)
        //{
        //    if (_immnueBuffIcon.ContainsKey(buffType))
        //    {
        //        return _immnueBuffIcon[buffType];
        //    }
        //    return string.Empty;
        //}

        public void SetData(TeamFightProtoData myProtoData, List <DropItem> dropItems = null)
        {
            if (myProtoData.player != null)
            {
                fightPlayerInfo = new FightPlayerInfo(GameProxy.instance.PlayerInfo, myProtoData.player);
            }
            fightHeroInfoList = new List <FightHeroInfo>();
            HeroFightProtoData data;

            for (int i = 0, count = myProtoData.heros.Count; i < count; i++)
            {
                data = myProtoData.heros[i];
                fightHeroInfoList.Add(new FightHeroInfo(HeroProxy.instance.GetHeroInfo((uint)data.id), data));
            }
            ourFormation = FormationProxy.instance.GetFormationInfo(myProtoData.lineup.no);
            if (dropItems != null)
            {
                this.dropItems = new List <DropItem>(dropItems);
            }
            Logic.UI.FightResult.Model.FightResultProxy.instance.SaveLastTeamData();
        }
Example #6
0
    // Constructor
    public EnemyFormation(FormationInfo formationInfo, int formationSize)
    {
        //

        this.formationInfo = formationInfo;

        //this.formationType = formationInfo.formationType;
        positions = new Vector3[formationSize];
        //this.distanceBetweenMembers = formationInfo.distanceBetweenMembers;
        formationMembers = new List <EnemyBaseBodyBehaviour>(formationSize);
        //this.maxMembersPerRow = formationInfo.maxMembersPerRow;
        StablishPositions();

        //
        if (formationInfo.weaponData)
        {
            Bullet bulletInfo     = formationInfo.weaponData.weapon.proyectilePrefab.GetComponent <Bullet>();
            float  bulletLifeTime = bulletInfo.lifeTime;
            BulletPool.instance.RegisterBullets(formationInfo.weaponData.weapon.proyectilePrefab,
                                                formationInfo.weaponData.weapon.rateOfFire, bulletLifeTime);
        }
    }
Example #7
0
 public void SetInfo(FormationInfo formationInfo, FormationState state)
 {
     _formationInfo = formationInfo;
     _state         = state;
     Refresh();
 }