コード例 #1
0
ファイル: BattleDamageNum.cs プロジェクト: BuCai/Hit
        public BattleDamageNumUnit GetDamageUnit(BattleDamageNumGroup _group)
        {
            BattleDamageNumUnit unit = unitFreeVec[_group.drawIndex];

            unitFreeVec[_group.drawIndex] = unit.nextUnit;

            unit.SetGroup(_group.index);

            return(unit);
        }
コード例 #2
0
ファイル: BattleDamageNum.cs プロジェクト: hackerlank/XLand
        public void Update()
        {
            if (mrList != null)
            {
                for (int i = 0; i < damageDrawNum; i++)
                {
                    if (mrList[i] != null)
                    {
                        MeshRenderer tempMR = mrList[i];

                        for (int m = 0; m < damageUnitNum; m++)
                        {
                            BattleDamageNumUnit tempUnit = unitVec[i, m];

                            if (tempUnit.State == 1 || tempUnit.IsChange)
                            {
                                if (tempUnit.IsChange)
                                {
                                    tempUnit.IsChange = false;
                                }

                                tempUnit.GetFix(tempMR.material);
                                tempUnit.GetState(tempMR.material);

//	                            tempMR.material.SetVector("fix" + m.ToString(), tempUnit.GetFix());
//                                tempMR.material.SetVector("state" + m.ToString(), tempUnit.GetState());
                            }
                        }

                        for (int n = 0; n < damageGroupNum; n++)
                        {
                            BattleDamageNumGroup tempGroup = groupVec[i, n];

                            if (tempGroup.State == 1 || tempGroup.IsChange)
                            {
                                if (tempGroup.IsChange)
                                {
                                    tempGroup.IsChange = false;
                                }

                                tempGroup.GetPositionsVec(tempMR.material);
                                tempGroup.GetScaleFix(tempMR.material);

//	                            tempMR.material.SetVector("positions" + n.ToString(), tempGroup.GetPositionsVec());
//                                tempMR.material.SetVector("scaleFix" + n.ToString(), tempGroup.GetScaleFix());
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
ファイル: BattleDamageNum.cs プロジェクト: BuCai/Hit
        public void Init(GameObject con)
        {
            container = con;

            if (damageGO)
            {
                damageGO.SetActive(true);
                return;
            }

            unitVec = new BattleDamageNumUnit[damageDrawNum, damageUnitNum];

            unitFreeVec = new BattleDamageNumUnit[damageDrawNum];

            groupVec = new BattleDamageNumGroup[damageDrawNum, damageGroupNum];

            groupFreeVec = new BattleDamageNumGroup[damageDrawNum];

            groupUseVec = new BattleDamageNumGroup[damageDrawNum];

            int i, m;

            for (i = 0; i < damageDrawNum; i++)
            {
                for (m = 0; m < damageUnitNum; m++)
                {
                    unitVec[i, m] = new BattleDamageNumUnit();

                    if (m > 0)
                    {
                        unitVec[i, m - 1].nextUnit = unitVec[i, m];
                    }
                }

                unitFreeVec[i] = unitVec[i, 0];

                for (m = 0; m < damageGroupNum; m++)
                {
                    groupVec[i, m]     = new BattleDamageNumGroup(i, m);
                    groupVec[i, m].bdm = this;

                    if (m > 0)
                    {
                        groupVec[i, m - 1].nextGroup = groupVec[i, m];
                    }
                }

                groupFreeVec[i] = groupVec[i, 0];
            }

            mrList = new MeshRenderer[damageDrawNum];

            Action <GameObject> loadGameObject = delegate(GameObject _go)
            {
                damageGO = _go;

                damageGO.transform.SetParent(container.transform, false);

                mrList[0] = _go.GetComponent <MeshRenderer>();
            };

            GameObjectFactory.Instance.GetGameObject("Assets/Arts/battle/BattleTool/DamageNum.prefab", loadGameObject, true);
        }