예제 #1
0
 private void FinishMergeGroup(MergeGroup group)
 {
     if (group.mergingUnit == null)
     {
         CmdEndMerge(group.ownerUnit.gameObject, null);
     }
     else
     {
         CmdEndMerge(group.ownerUnit.gameObject, group.mergingUnit.gameObject);
     }
 }
예제 #2
0
        private void UpdateMergeGroups()
        {
            //This follows the same code design pattern used in Split Manager. It's a very stable way of cleaning/updating the lists
            //this manager manages.
            if (this.mergeList.Count > 0)
            {
                for (int i = 0; i < this.mergeList.Count; i++)
                {
                    MergeGroup group = this.mergeList[i];
                    if (group.elapsedTime > 1f)
                    {
                        group.Resume();
                        if (!this.removeList.Contains(group))
                        {
                            FinishMergeGroup(group);
                            this.removeList.Add(group);

                            GameMetricLogger.Increment(GameMetricOptions.Merges);
                        }
                    }
                    else
                    {
                        group.Update(this.scalingValue);
                        group.elapsedTime += Time.deltaTime / group.mergeSpeedFactor;
                        this.mergeList[i]  = group;
                    }
                }
            }

            if (this.removeList.Count > 0)
            {
                foreach (MergeGroup group in this.removeList)
                {
                    if (this.mergeList.Contains(group))
                    {
                        this.mergeList.Remove(group);
                    }
                }
                this.removeList.Clear();
            }
        }
예제 #3
0
        //NOTE(Thompson): This is not used at the moment.
        private void UpdateGroup(MergeGroup group)
        {
            if (group.ownerUnit.level > this.unitAttributes.healthPrefabList.Count)
            {
                return;
            }
            int level = group.ownerUnit.level;

            //This is where we modify the unit attributes when the merge is happening.
            //However, this should really be placed in a function call at the end of the merge, meaning
            //this should be run only once.
            group.ownerUnit.attackCooldown = this.unitAttributes.attackCooldownPrefabList[level];
            group.ownerUnit.maxHealth      = Mathf.FloorToInt(this.unitAttributes.healthPrefabList[level]);
            group.ownerUnit.attackPower    = this.unitAttributes.attackPrefabList[level];

            NavMeshAgent agent = group.ownerUnit.GetComponent <NavMeshAgent>();

            if (agent != null)
            {
                agent.speed = this.unitAttributes.speedPrefabList[level];
            }
        }
예제 #4
0
        //NOTE(Thompson): This is not used at the moment.
        private void UpdateGroup(MergeGroup group)
        {
            if (group.ownerUnit.level > this.unitAttributes.healthPrefabList.Count) {
                return;
            }
            int level = group.ownerUnit.level;

            //This is where we modify the unit attributes when the merge is happening.
            //However, this should really be placed in a function call at the end of the merge, meaning
            //this should be run only once.
            group.ownerUnit.attackCooldown = this.unitAttributes.attackCooldownPrefabList[level];
            group.ownerUnit.maxHealth = Mathf.FloorToInt(this.unitAttributes.healthPrefabList[level]);
            group.ownerUnit.attackPower = this.unitAttributes.attackPrefabList[level];

            NavMeshAgent agent = group.ownerUnit.GetComponent<NavMeshAgent>();
            if (agent != null) {
                agent.speed = this.unitAttributes.speedPrefabList[level];
            }
        }
예제 #5
0
 private void FinishMergeGroup(MergeGroup group)
 {
     if (group.mergingUnit == null) {
         CmdEndMerge(group.ownerUnit.gameObject, null);
     }
     else {
         CmdEndMerge(group.ownerUnit.gameObject, group.mergingUnit.gameObject);
     }
 }