//创建数据块
        public SoldierDataBlock CreateDataBlock(int dataCount)
        {
            SoldierDataBlock soldierDataBlock = new SoldierDataBlock();

            soldierDataBlock.animationAsset = this;
            soldierDataBlock.Reset(dataCount);
            return(soldierDataBlock);
        }
Ejemplo n.º 2
0
 public SoldierRandomItem(SoldierDataBlock soldierDataBlock, int idx, float atkLen, float deathLen)
 {
     this.soldierDataBlock = soldierDataBlock;
     this.idx         = idx;
     this.moveSpeed   = Random.Range(0f, 1f);
     this.randomTimer = Random.Range(-3f, 0f);
     this.attackLen   = atkLen;
     this.deathLen    = deathLen;
     this.isAttack    = false;
     this.isDeath     = false;
 }
Ejemplo n.º 3
0
        private void Start()
        {
            if (animationAsset == null)
            {
                Debug.LogError("Asset is null!");
                return;
            }

            soldierDataBlock = animationAsset.CreateDataBlock(rows * columns);
            randomSoldiers   = new SoldierRandomItem[rows * columns];

            GenerateSoldiers();
        }
Ejemplo n.º 4
0
        private void Awake()
        {
            soldierDataBlock = animationAsset?.CreateDataBlock(1);

            if (soldierDataBlock == null)
            {
                Debug.LogErrorFormat("Awake animation control demo faile. Asset is null");
            }
            soldierDataBlock.Reset(1);

            soldierDataBlock.atkAnimLength   = animationAsset.attackAnimLength;
            soldierDataBlock.deathAnimLength = animationAsset.deathAnimLength;

            soldierDataBlock.matrixs[0] = transform.localToWorldMatrix;
        }