Example #1
0
        /// <summary>
        /// 在战斗行上显示人物头像
        /// </summary>
        /// <param name="CombatRole">战斗行上的角色顺序</param>
        /// <param name="RoundEndIndex">大回合上的结束点标志</param>
        public void ShowRoleInLine(CombatRound round)
        {
            List <Role> CombatList = round.CombatList;

            if (LineRoles == null)
            {
                LineRoles = new List <CombatLineRole>();
                int positionCountX = 0;
                for (int i = 0; i < CombatList.Count; i++)
                {
                    if (i >= MaxShouw)
                    {
                        break;
                    }

                    CombatLineRole RoleBox = Instantiate(roleIconePrefab);

                    RoleBox.RoleID = CombatList[i].ID;

                    LineRoles.Add(RoleBox);
                    RoleBox.IsActionRole = (i == 0);
                    RoleBox.transform.SetParent(RoleBuilder);

                    //设置位置
                    Vector3 postition = Vector3.zero;
                    if (i == 1)
                    {
                        positionCountX += 95;
                    }
                    else if (i > 1)
                    {
                        positionCountX += 65;
                    }
                    postition.x = positionCountX;
                    postition.y = -9;
                    RoleBox.transform.localPosition = postition;

                    //判断并添加大回合末尾标志
                    if (round.isRoundLast(i) == true)
                    {
                        RectTransform RoundFalg = Instantiate(RoundFalgPrefab);
                        RoundFalg.SetParent(RoleBox.transform);
                        postition               = Vector3.zero;
                        postition.x             = i == 0 ? 80f : 65f;
                        RoundFalg.localPosition = postition;
                    }
                }
            }
        }
Example #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        private void Init()
        {
            CombatPosition = GameObject.Find("Combat Position").GetComponent <Canvas>();
            CombatUI       = GameObject.Find("Combat UI").GetComponent <Canvas>();

            CombatRoles   = new List <Role>();
            roleImageList = new List <RoleImage>();

            CombatLine  = GameObject.Find("Combat Line").GetComponent <CombatLine>();
            CombatRound = new CombatRound(CombatRoles);
#if DebugMode
            Skill basicSkill = new Skill("斩击", 10, 1, 2);
            Skill EndTurn    = new Skill("回合结束", 0, 0, 0,
                                         new List <string>()
            {
                "EndTurn"
            });

            Role R1 = new Role("张", "三", roleType: RoleType.player);
            Role R2 = new Role("李", "四", roleType: RoleType.enemy);
            Role R3 = new Role("王", "五", roleType: RoleType.ally);
            Role R4 = new Role("金", "杰", roleType: RoleType.ally);
            Role R5 = new Role("赵", "六", roleType: RoleType.ally);
            Role R6 = new Role("田", "七", roleType: RoleType.ally);

            CombatRoles.Add(R1);
            CombatRoles.Add(R2);
            CombatRoles.Add(R3);
            CombatRoles.Add(R4);
            CombatRoles.Add(R5);
            CombatRoles.Add(R6);

            foreach (var item in CombatRoles)
            {
                item.CombatInit();
                item.Skills = new List <Skill>()
                {
                    basicSkill, EndTurn
                };
            }
#endif
        }