Example #1
0
        public UnitStat Clone()
        {
            UnitStat stat = new UnitStat();

            stat.damageMin       = damageMin;
            stat.damageMax       = damageMax;
            stat.clipSize        = clipSize;
            stat.reloadDuration  = reloadDuration;
            stat.range           = range;
            stat.aoeRadius       = aoeRadius;
            stat.crit            = crit.Clone();
            stat.stun            = stun.Clone();
            stat.slow            = slow.Clone();
            stat.dot             = dot.Clone();
            stat.buff            = buff.Clone();
            stat.buildDuration   = buildDuration;
            stat.unBuildDuration = unBuildDuration;
            stat.shootObjectT    = shootObjectT;
            stat.desp            = desp;

            stat.electricityMaxStored        = electricityMaxStored;
            stat.electricityRegenerationRate = electricityRegenerationRate;
            stat.electricityReceiveRate      = electricityReceiveRate;
            stat.electricityNeedForShoot     = electricityNeedForShoot;

            for (int i = 0; i < rscGain.Count; i++)
            {
                stat.rscGain.Add(rscGain[i]);
            }
            for (int i = 0; i < cost.Count; i++)
            {
                stat.cost.Add(cost[i]);
            }
            return(stat);
        }
		public UnitStat Clone(){
			UnitStat stat=new UnitStat();
			stat.damageMin=damageMin;
			stat.damageMax=damageMax;
			stat.clipSize=clipSize;
			stat.reloadDuration=reloadDuration;
			stat.minRange=minRange;
			stat.range=range;
			stat.aoeRadius=aoeRadius;
			stat.hit=hit;
			stat.dodge=dodge;
			stat.shieldBreak=shieldBreak;
			stat.shieldPierce=shieldPierce;
			stat.damageShieldOnly=damageShieldOnly;
			stat.crit=crit.Clone();
			stat.stun=stun.Clone();
			stat.slow=slow.Clone();
			stat.dot=dot.Clone();
			stat.instantKill=instantKill.Clone();
			stat.buff=buff.Clone();
			stat.buildDuration=buildDuration;
			stat.unBuildDuration=unBuildDuration;
			stat.shootObjectT=shootObjectT;
			stat.desp=desp;
			//stat.despGeneral=despGeneral;
			//for(int i=0; i<rscGain.Count; i++) stat.rscGain.Add(rscGain[i]);
			//for(int i=0; i<cost.Count; i++) stat.cost.Add(cost[i]);
			
			stat.rscGain=new List<int>(rscGain);
			stat.cost=new List<int>(cost);
			
			return stat;
		}
Example #3
0
        private void ModifyUnitStats(UnitStat tgtStats, UnitStat srcStats)
        {
            tgtStats.damageMin      += srcStats.damageMin;
            tgtStats.cooldown       += srcStats.cooldown;
            tgtStats.clipSize       += srcStats.clipSize;
            tgtStats.reloadDuration += srcStats.reloadDuration;
            tgtStats.range          += srcStats.range;
            tgtStats.aoeRadius      += srcStats.aoeRadius;
            tgtStats.hit            += srcStats.hit;
            //tgtStats.dodge+=srcStats.dodge;
            tgtStats.shieldBreak  += srcStats.shieldBreak;
            tgtStats.shieldPierce += srcStats.shieldPierce;

            tgtStats.crit.chance        += srcStats.crit.chance;
            tgtStats.crit.dmgMultiplier += srcStats.crit.dmgMultiplier;

            tgtStats.stun.chance   += srcStats.stun.chance;
            tgtStats.stun.duration += srcStats.stun.duration;

            tgtStats.slow.duration       += srcStats.slow.duration;
            tgtStats.slow.slowMultiplier += srcStats.slow.slowMultiplier;

            tgtStats.dot.duration += srcStats.dot.duration;
            tgtStats.dot.interval += srcStats.dot.interval;
            tgtStats.dot.value    += srcStats.dot.value;

            tgtStats.instantKill.chance      += srcStats.instantKill.chance;
            tgtStats.instantKill.HPThreshold += srcStats.instantKill.HPThreshold;
        }
Example #4
0
        public UnitStat Clone()
        {
            UnitStat stat = new UnitStat();

            stat.damageMin        = damageMin;
            stat.damageMax        = damageMax;
            stat.clipSize         = clipSize;
            stat.reloadDuration   = reloadDuration;
            stat.minRange         = minRange;
            stat.range            = range;
            stat.aoeRadius        = aoeRadius;
            stat.hit              = hit;
            stat.dodge            = dodge;
            stat.shieldBreak      = shieldBreak;
            stat.shieldPierce     = shieldPierce;
            stat.damageShieldOnly = damageShieldOnly;
            stat.crit             = crit.Clone();
            stat.stun             = stun.Clone();
            stat.slow             = slow.Clone();
            stat.dot              = dot.Clone();
            stat.instantKill      = instantKill.Clone();
            stat.buff             = buff.Clone();
            stat.buildDuration    = buildDuration;
            stat.unBuildDuration  = unBuildDuration;
            stat.shootObjectT     = shootObjectT;
            stat.desp             = desp;
            //stat.despGeneral=despGeneral;
            //for(int i=0; i<rscGain.Count; i++) stat.rscGain.Add(rscGain[i]);
            //for(int i=0; i<cost.Count; i++) stat.cost.Add(cost[i]);

            stat.rscGain = new List <int>(rscGain);
            stat.cost    = new List <int>(cost);

            return(stat);
        }
Example #5
0
        protected float DrawShootEffectObject(float startX, float startY, UnitStat stat, Unit unit, bool isTower = true)
        {
            bool showShootObj = false;

            if (isTower)
            {
                UnitTower tower = isTower ? unit.gameObject.GetComponent <UnitTower>() : null;
                if (tower.type == _TowerType.Turret)
                {
                    showShootObj = true;
                }
            }
            else
            {
                UnitCreep creep = !isTower?unit.gameObject.GetComponent <UnitCreep>() : null;

                if (creep.type == _CreepType.Offense)
                {
                    showShootObj = true;
                }
            }

            if (showShootObj)
            {
                cont = new GUIContent("ShootObject:", "The shoot-object used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObject = (ShootObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 3 * widthS + 15, height), stat.shootObject, typeof(ShootObject), false);
            }
            else
            {
                cont = new GUIContent("EffectObject:", "The effect-object used by the unit.\nSpawned on shoot-point at every cooldown");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.effectObject = (GameObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 3 * widthS + 15, height), stat.effectObject, typeof(GameObject), false);

                cont = new GUIContent(" - AutoDestroy:", "Check if the effect object needs to be removed from the game");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                if (stat.effectObject != null)
                {
                    stat.autoDestroyEffect = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), stat.autoDestroyEffect);
                }
                else
                {
                    EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), new GUIContent("-", ""));
                }

                cont = new GUIContent(" - EffectDuration:", "The delay in seconds before the effect object is destroyed");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                if (stat.effectObject != null && stat.autoDestroyEffect)
                {
                    stat.effectDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.effectDuration);
                }
                else
                {
                    EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), new GUIContent("-", ""));
                }
            }

            return(startY + 5);
        }
Example #6
0
        protected float DrawUnitStatsResource(float startX, float startY, UnitStat stat, Unit unit, bool isTower = true)
        {
            GUI.Box(new Rect(startX, startY, spaceX + 2 * widthS + 10, statContentHeight), "");

            float cachedY = startY;

            startX += 5;      startY += 8;              spaceX += 8;      widthS -= 5;          //width-=10;

            if (isTower)
            {
                startY = DrawUnitStatsTower(startX, startY, stat) + 8;
            }

            startY = DrawShootEffectObject(startX, startY + 5, stat, unit, isTower);

            startY += 5;

            cont = new GUIContent("Cooldown:", "Duration between each attack");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.cooldown);

            startY += 5;

            if (stat.rscGain.Count != rscDB.rscList.Count)
            {
                while (stat.rscGain.Count > rscDB.rscList.Count)
                {
                    stat.rscGain.RemoveAt(stat.rscGain.Count - 1);
                }
                while (stat.rscGain.Count < rscDB.rscList.Count)
                {
                    stat.rscGain.Add(0);
                }
            }

            cont = new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            int count = 0;    startY += spaceY;         float cachedX = startX;

            for (int i = 0; i < rscDB.rscList.Count; i++)
            {
                TDEditor.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscDB.rscList[i].icon);
                stat.rscGain[i] = EditorGUI.IntField(new Rect(startX + 30, startY, widthS, height), stat.rscGain[i]);
                count          += 1;       startX += 65;
                if (count == 3)
                {
                    startY += spaceY; startX = cachedX;
                }
            }
            startX = cachedX; startY += 5;

            startX           -= 5;      startY += 5;      spaceX -= 8;      widthS += 5;//width+=10;
            statContentHeight = startY + spaceY - cachedY;

            return(startY + spaceY);
        }
Example #7
0
        private static void RefreshRsc()
        {
            for (int i = 0; i < towerList.Count; i++)
            {
                UnitTower tower = towerList[i];
                for (int n = 0; n < tower.stats.Count; n++)
                {
                    UnitStat stat = tower.stats[n];

                    while (stat.cost.Count < rscList.Count)
                    {
                        stat.cost.Add(0);
                    }
                    while (stat.cost.Count > rscList.Count)
                    {
                        stat.cost.RemoveAt(stat.cost.Count - 1);
                    }

                    while (stat.rscGain.Count < rscList.Count)
                    {
                        stat.rscGain.Add(0);
                    }
                    while (stat.rscGain.Count > rscList.Count)
                    {
                        stat.rscGain.RemoveAt(stat.rscGain.Count - 1);
                    }
                }
            }

            for (int i = 0; i < creepList.Count; i++)
            {
                UnitCreep creep = creepList[i];

                while (creep.valueRscMin.Count < rscList.Count)
                {
                    creep.valueRscMin.Add(0);
                }
                while (creep.valueRscMin.Count > rscList.Count)
                {
                    creep.valueRscMin.RemoveAt(creep.valueRscMin.Count - 1);
                }

                while (creep.valueRscMax.Count < rscList.Count)
                {
                    creep.valueRscMax.Add(0);
                }
                while (creep.valueRscMax.Count > rscList.Count)
                {
                    creep.valueRscMax.RemoveAt(creep.valueRscMax.Count - 1);
                }
            }
        }
Example #8
0
        public void InitTower(int ID)
        {
            Init();

            instanceID = ID;

            value = stats[currentActiveStat].cost;

            int rscCount = ResourceManager.GetResourceCount();

            for (int i = 0; i < stats.Count; i++)
            {
                UnitStat stat = stats[i];
                stat.slow.effectID = instanceID;
                stat.dot.effectID  = instanceID;
                stat.buff.effectID = instanceID;
                if (stat.rscGain.Count != rscCount)
                {
                    while (stat.rscGain.Count < rscCount)
                    {
                        stat.rscGain.Add(0);
                    }
                    while (stat.rscGain.Count > rscCount)
                    {
                        stat.rscGain.RemoveAt(stat.rscGain.Count - 1);
                    }
                }
            }

            if (type == _TowerType.Turret)
            {
                StartCoroutine(ScanForTargetRoutine());
                StartCoroutine(TurretRoutine());
            }
            if (type == _TowerType.AOE)
            {
                StartCoroutine(AOETowerRoutine());
            }
            if (type == _TowerType.Support)
            {
                StartCoroutine(SupportRoutine());
            }
            if (type == _TowerType.Resource)
            {
                StartCoroutine(ResourceTowerRoutine());
            }
            if (type == _TowerType.Mine)
            {
                StartCoroutine(MineRoutine());
            }
        }
Example #9
0
        private static void RefreshRsc()
        {
            for (int i = 0; i < towerList.Count; i++)
            {
                UnitTower tower = towerList[i];
                for (int n = 0; n < tower.stats.Count; n++)
                {
                    UnitStat stat = tower.stats[n];
                }
            }

            for (int i = 0; i < creepList.Count; i++)
            {
                UnitCreep creep = creepList[i];
            }
        }
Example #10
0
        protected float DrawUnitStatsTower(float startX, float startY, UnitStat stat)
        {
            cont = new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)");
            EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
            stat.buildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buildDuration);

            cont = new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.unBuildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.unBuildDuration);

            startY += 5;

            if (stat.cost.Count != rscDB.rscList.Count)
            {
                while (stat.cost.Count > rscDB.rscList.Count)
                {
                    stat.cost.RemoveAt(stat.cost.Count - 1);
                }
                while (stat.cost.Count < rscDB.rscList.Count)
                {
                    stat.cost.Add(0);
                }
            }

            cont = new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            int count = 0;    startY += spaceY;         float cachedX = startX;

            for (int i = 0; i < rscDB.rscList.Count; i++)
            {
                TDEditor.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscDB.rscList[i].icon);
                stat.cost[i] = EditorGUI.IntField(new Rect(startX + 30, startY, widthS, height), stat.cost[i]);
                count       += 1;       startX += 65;
                if (count == 3)
                {
                    startY += spaceY + 3; startX = cachedX;
                }
            }
            //startX=cachedX;

            return(startY + spaceY);
        }
Example #11
0
        private void ModifyUnitStats(UnitStat tgtStats, UnitStat srcStats)
        {
            tgtStats.damageMin += srcStats.damageMin;
            tgtStats.cooldown  += srcStats.cooldown;
            tgtStats.range     += srcStats.range;
            tgtStats.aoeRadius += srcStats.aoeRadius;

            tgtStats.crit.chance        += srcStats.crit.chance;
            tgtStats.crit.dmgMultiplier += srcStats.crit.dmgMultiplier;

            tgtStats.stun.chance   += srcStats.stun.chance;
            tgtStats.stun.duration += srcStats.stun.duration;

            tgtStats.slow.duration       += srcStats.slow.duration;
            tgtStats.slow.slowMultiplier += srcStats.slow.slowMultiplier;

            tgtStats.dot.duration += srcStats.dot.duration;
            tgtStats.dot.interval += srcStats.dot.interval;
            tgtStats.dot.value    += srcStats.dot.value;
        }
		public UnitStat Clone(){
			UnitStat stat=new UnitStat();
			stat.damageMin=damageMin;
			stat.damageMax=damageMax;
			stat.clipSize=clipSize;
			stat.reloadDuration=reloadDuration;
			stat.range=range;
			stat.aoeRadius=aoeRadius;
			stat.crit=crit.Clone();
			stat.stun=stun.Clone();
			stat.slow=slow.Clone();
			stat.dot=dot.Clone();
			stat.buff=buff.Clone();
			stat.buildDuration=buildDuration;
			stat.unBuildDuration=unBuildDuration;
			stat.shootObjectT=shootObjectT;
			stat.desp=desp;
			
			for(int i=0; i<rscGain.Count; i++) stat.rscGain.Add(rscGain[i]);
			for(int i=0; i<cost.Count; i++) stat.cost.Add(cost[i]);
			return stat;
		}
        public UnitStat Clone()
        {
            UnitStat stat = new UnitStat();

            stat.damageMin       = damageMin;
            stat.damageMax       = damageMax;
            stat.cooldown        = cooldown;
            stat.range           = range;
            stat.aoeRadius       = aoeRadius;
            stat.crit            = crit.Clone();
            stat.stun            = stun.Clone();
            stat.slow            = slow.Clone();
            stat.dot             = dot.Clone();
            stat.buff            = buff.Clone();
            stat.buildDuration   = buildDuration;
            stat.unBuildDuration = unBuildDuration;
            stat.shootObjectT    = shootObjectT;
            stat.desp            = desp;
            stat.rscGain         = rscGain;
            stat.cost            = cost;

            return(stat);
        }
Example #14
0
        public void InitTower(int ID)
        {
            Init();

            instanceID = ID;
            value      = stats[currentActiveStat].cost;

            for (int i = 0; i < stats.Count; i++)
            {
                UnitStat stat = stats[i];
                stat.slow.effectID = instanceID;
                stat.dot.effectID  = instanceID;
                stat.buff.effectID = instanceID;
            }

            if (type == _TowerType.Turret)
            {
                StartCoroutine(ScanForTargetRoutine());
                StartCoroutine(TurretRoutine());
            }
            if (type == _TowerType.AOE)
            {
                StartCoroutine(AOETowerRoutine());
            }
            if (type == _TowerType.Support)
            {
                StartCoroutine(SupportRoutine());
            }
            if (type == _TowerType.Resource)
            {
                StartCoroutine(ResourceTowerRoutine());
            }
            if (type == _TowerType.Mine)
            {
                StartCoroutine(MineRoutine());
            }
        }
Example #15
0
 public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitCreep creep)
 {
     return(DrawStat(stat, startX, startY, statContentHeight, null, creep));
 }
Example #16
0
 public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower)
 {
     return(DrawStat(stat, startX, startY, statContentHeight, tower, null));
 }
        public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower, UnitCreep creep)
        {
            List <Rsc> rscList = EditorDBManager.GetRscList();

            float width  = 150;
            float fWidth = 35;
            float spaceX = 130;
            float height = 18;
            float spaceY = height + 2;

            //startY-=spaceY;

            GUI.Box(new Rect(startX, startY, 220, statContentHeight - startY), "");

            startX += 10;     startY += 10;

            if (tower != null)
            {
                cont = new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.buildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buildDuration);

                cont = new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.unBuildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.unBuildDuration);


                if (stat.cost.Count != rscList.Count)
                {
                    while (stat.cost.Count > rscList.Count)
                    {
                        stat.cost.RemoveAt(stat.cost.Count - 1);
                    }
                    while (stat.cost.Count < rscList.Count)
                    {
                        stat.cost.Add(0);
                    }
                }
                cont = new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                int count = 0;    startY += spaceY;         float cachedX = startX;
                for (int i = 0; i < rscList.Count; i++)
                {
                    EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscList[i].icon);
                    stat.cost[i] = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stat.cost[i]);
                    count       += 1;       startX += 65;
                    if (count == 3)
                    {
                        startY += spaceY; startX = cachedX;
                    }
                }
                startX = cachedX; startY += 5;

                startY += spaceY + 5;
            }



            if ((tower && TowerUseShootObject(tower)) || (creep && creep.type == _CreepType.Offense))
            {
                cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObject = (ShootObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObject, typeof(ShootObject), false);
                startY          += 5;
            }

            if (tower && TowerUseShootObjectT(tower))
            {
                cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObjectT = (Transform)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObjectT, typeof(Transform), false);
                startY           += 5;
            }

            if ((tower && TowerDealDamage(tower)) || (creep && creep.type == _CreepType.Offense))
            {
                cont = new GUIContent("Damage(Min/Max):", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.damageMin);
                stat.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + fWidth, startY, fWidth, height), stat.damageMax);

                cont = new GUIContent("Cooldown:", "Duration between each attack");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.cooldown);


                cont = new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.range);

                //~ cont=new GUIContent("Range(Min/Max):", "");
                //~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                //~ stat.minRange=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.minRange);
                //~ stat.range=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.range);

                cont = new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.aoeRadius);



                cont = new GUIContent("Hit Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's dodgeChance. Assume two targets with 0 dodgeChance and .2 dodgeChance and the hitChance set to 1, the unit will always hits the target and have 20% chance to miss the second target.");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.hit = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.hit);

                if (!creep)
                {
                    cont = new GUIContent("Dodge Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's hitChance. Assume two attackers with 1 hitChance and .8 hitChance and the dodgeChance set to .2, the chances to dodge attack from each attacker are 20% and 40% respectively.");
                    EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                    stat.dodge = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dodge);
                }


                cont = new GUIContent("Stun", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.chance);

                cont = new GUIContent("        - Duration:", "The stun duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.duration);



                cont = new GUIContent("Critical", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.chance);

                cont = new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);



                cont = new GUIContent("Slow", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("         - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.duration);

                cont = new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.slowMultiplier);



                cont = new GUIContent("Dot", "Damage over time");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.duration);

                cont = new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.interval);

                cont = new GUIContent("        - Damage:", "Damage applied at each tick");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.value);



                cont = new GUIContent("InstantKill", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("                - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.instantKill.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.chance);

                cont = new GUIContent("        - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.instantKill.HPThreshold = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.HPThreshold);


                cont = new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.damageShieldOnly = EditorGUI.Toggle(new Rect(startX + spaceX, startY, fWidth, height), stat.damageShieldOnly);

                cont = new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.shieldBreak = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldBreak);

                cont = new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.shieldPierce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldPierce);
            }



            if ((tower && tower.type == _TowerType.Support) || (creep && creep.type == _CreepType.Support))
            {
                cont = new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.range);
                startY    += 5;

                cont = new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.damageBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.damageBuff);

                cont = new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.cooldownBuff);

                cont = new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.rangeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.rangeBuff);

                cont = new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.criticalBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.criticalBuff);

                cont = new GUIContent("        - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.hitBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.hitBuff);

                cont = new GUIContent("        - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.dodgeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.dodgeBuff);

                cont = new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.regenHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.regenHP);
            }


            if (tower && tower.type == _TowerType.Resource)
            {
                if (stat.rscGain.Count != rscList.Count)
                {
                    while (stat.rscGain.Count > rscList.Count)
                    {
                        stat.rscGain.RemoveAt(stat.rscGain.Count - 1);
                    }
                    while (stat.rscGain.Count < rscList.Count)
                    {
                        stat.rscGain.Add(0);
                    }
                }
                cont = new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                int count = 0;    startY += spaceY;         float cachedX = startX;
                for (int i = 0; i < rscList.Count; i++)
                {
                    EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscList[i].icon);
                    stat.rscGain[i] = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stat.rscGain[i]);
                    count          += 1;       startX += 65;
                    if (count == 3)
                    {
                        startY += spaceY; startX = cachedX;
                    }
                }
                startX = cachedX; startY += 5;
            }


            if (tower)
            {
                startY += 10;
                cont    = new GUIContent("Custom Description:", "Check to use use custom description. If not, the default one (generated based on the effect) will be used");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.useCustomDesp = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), stat.useCustomDesp);
                if (stat.useCustomDesp)
                {
                    GUIStyle style = new GUIStyle("TextArea");
                    style.wordWrap = true;
                    stat.desp      = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 200, 90), stat.desp, style);
                    startY        += 90;
                }
            }



            statContentHeight = startY + spaceY + 5;

            return(new Vector3(startX + 220, startY, statContentHeight));
        }
Example #18
0
		private void ModifyUnitStats(UnitStat tgtStats, UnitStat srcStats){
			tgtStats.damageMin+=srcStats.damageMin;
			tgtStats.cooldown+=srcStats.cooldown;
			tgtStats.clipSize+=srcStats.clipSize;
			tgtStats.reloadDuration+=srcStats.reloadDuration;
			tgtStats.range+=srcStats.range;
			tgtStats.aoeRadius+=srcStats.aoeRadius;
			tgtStats.hit+=srcStats.hit;
			tgtStats.dodge+=srcStats.dodge;
			tgtStats.shieldBreak+=srcStats.shieldBreak;
			tgtStats.shieldPierce+=srcStats.shieldPierce;
			
			tgtStats.crit.chance+=srcStats.crit.chance;
			tgtStats.crit.dmgMultiplier+=srcStats.crit.dmgMultiplier;
			
			tgtStats.stun.chance+=srcStats.stun.chance;
			tgtStats.stun.duration+=srcStats.stun.duration;
			
			tgtStats.slow.duration+=srcStats.slow.duration;
			tgtStats.slow.slowMultiplier+=srcStats.slow.slowMultiplier;
			
			tgtStats.dot.duration+=srcStats.dot.duration;
			tgtStats.dot.interval+=srcStats.dot.interval;
			tgtStats.dot.value+=srcStats.dot.value;
			
			tgtStats.instantKill.chance+=srcStats.instantKill.chance;
			tgtStats.instantKill.HPThreshold+=srcStats.instantKill.HPThreshold;
		}
Example #19
0
        Vector2 DrawUnitStat(float startX, float startY, UnitStat stats, bool isWeapon)
        {
            float fWidth = 40;

            if (!isWeapon)
            {
                foldOffenseParameter = EditorGUI.Foldout(new Rect(startX, startY += spaceY, width, height), foldOffenseParameter, "Show Offensive Stats");
            }
            if (isWeapon || foldOffenseParameter)
            {
                startX += 15;

                cont = new GUIContent("Damage:", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.damageMin);

                cont = new GUIContent("Cooldown:", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.cooldown);

                if (!isWeapon)
                {
                    cont = new GUIContent("Range:", "");
                    EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                    stats.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.range);
                }

                cont = new GUIContent("AOE Radius:", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.aoeRadius);

                cont = new GUIContent("Stun", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY;

                cont = new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.stun.chance);

                cont = new GUIContent("        - Duration:", "The stun duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.stun.duration);

                cont = new GUIContent("Critical", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY;

                cont = new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.crit.chance);

                cont = new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.crit.dmgMultiplier);


                cont = new GUIContent("Slow", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY;

                cont = new GUIContent("         - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.slow.duration);

                cont = new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.slow.slowMultiplier);



                cont = new GUIContent("Dot", "Damage over time");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY;

                cont = new GUIContent("        - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.dot.duration);

                cont = new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.dot.interval);

                cont = new GUIContent("        - Damage:", "Damage applied at each tick");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.dot.value);

                startX -= 15;
            }

            if (!isWeapon)
            {
                foldSupportParameter = EditorGUI.Foldout(new Rect(startX, startY += spaceY, width, height), foldSupportParameter, "Show Support Stats");
            }
            if (!isWeapon && foldSupportParameter)
            {
                startX += 15;

                cont = new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont); startY -= spaceY;

                cont = new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.buff.damageBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.buff.damageBuff);

                cont = new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.buff.cooldownBuff);

                cont = new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.buff.rangeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.buff.rangeBuff);

                cont = new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.buff.criticalBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.buff.criticalBuff);

                cont = new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stats.buff.regenHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stats.buff.regenHP);

                startX -= 15;
            }

            if (!isWeapon)
            {
                foldRscParameter = EditorGUI.Foldout(new Rect(startX, startY += spaceY, width, height), foldRscParameter, "Show RscGain");
            }
            if (!isWeapon && foldRscParameter)
            {
                startX += 15;

                cont = new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                startY += spaceY;

                EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), EditorDBManager.iconRsc);
                stats.rscGain = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stats.rscGain);

                startX -= 15;
            }

            return(new Vector2(startX, startY));
        }
Example #20
0
        public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower, UnitCreep creep)
        {
            List<Rsc> rscList=EditorDBManager.GetRscList();

            float width=150;
            float fWidth=35;
            float spaceX=130;
            float height=18;
            float spaceY=height+2;

            //startY-=spaceY;

            GUI.Box(new Rect(startX, startY, 220, statContentHeight-startY), "");

            startX+=10;	startY+=10;

            if(tower!=null){

                cont=new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.buildDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buildDuration);

                cont=new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.unBuildDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.unBuildDuration);

                if(stat.cost.Count!=rscList.Count){
                    while(stat.cost.Count>rscList.Count) stat.cost.RemoveAt(stat.cost.Count-1);
                    while(stat.cost.Count<rscList.Count) stat.cost.Add(0);
                }
                cont=new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                int count=0;	startY+=spaceY; 	float cachedX=startX;
                for(int i=0; i<rscList.Count; i++){
                    EditorUtilities.DrawSprite(new Rect(startX+10, startY-1, 20, 20), rscList[i].icon);
                    stat.cost[i]=EditorGUI.IntField(new Rect(startX+30, startY, fWidth, height), stat.cost[i]);
                    count+=1; 	startX+=65;
                    if(count==3){ startY+=spaceY; startX=cachedX; }
                }
                startX=cachedX;	startY+=5;

                startY+=spaceY+5;
            }

            if((tower && TowerUseShootObject(tower))){
                cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObject=(ShootObject)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-20, height), stat.shootObject, typeof(ShootObject), false);
                startY+=5;
            }

            if(tower && TowerUseShootObjectT(tower)){
                cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObjectT=(Transform)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-20, height), stat.shootObjectT, typeof(Transform), false);
                startY+=5;
            }

            if((tower && TowerDealDamage(tower))){
                cont=new GUIContent("Damage(Min/Max):", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.damageMin=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.damageMin);
                stat.damageMax=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.damageMax);

                cont=new GUIContent("Cooldown:", "Duration between each attack");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.cooldown=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.cooldown);

            cont = new GUIContent("Electricity needed:", "The amount of enery consumed for one shot");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.electricityNeedForShoot = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.electricityNeedForShoot);

            /*
                cont=new GUIContent("Clip Size:", "The amount of attack the unit can do before the unit needs to reload\nWhen set to <0 the unit will never need any reload");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.clipSize=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.clipSize);
                stat.clipSize=Mathf.Round(stat.clipSize);

                cont=new GUIContent("Reload Duration:", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.reloadDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.reloadDuration);
                */

            cont =new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.range=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.range);

                cont=new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.aoeRadius=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.aoeRadius);

                cont=new GUIContent("Stun", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.stun.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.chance);

                cont=new GUIContent("        - Duration:", "The stun duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.stun.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.duration);

                cont=new GUIContent("Critical", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.crit.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.chance);

                cont=new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.crit.dmgMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);

                cont=new GUIContent("Slow", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("         - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.slow.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.duration);

                cont=new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.slow.slowMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.slowMultiplier);

                cont=new GUIContent("Dot", "Damage over time");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.duration);

                cont=new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.interval=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.interval);

                cont=new GUIContent("        - Damage:", "Damage applied at each tick");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.value=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.value);

            }

            if((tower && tower.type==_TowerType.Support)){
                cont=new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.range=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.range);
                startY+=5;

                cont=new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.damageBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.damageBuff);

                cont=new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.cooldownBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.cooldownBuff);

                cont=new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.rangeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.rangeBuff);

                cont=new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.criticalBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.criticalBuff);

                cont=new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.regenHP=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.regenHP);
            }

              if ((tower && tower.type == _TowerType.Electric))
              {
            cont = new GUIContent("Range:", "Effect range of the unit");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.range);

            cont = new GUIContent("Max Electricity:", "Maximal energy capacity of the electric facility.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.electricityMaxStored = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.electricityMaxStored);

            cont = new GUIContent("Elec. Regeneration:", "The electricity generated by this tower.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.electricityRegenerationRate = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.electricityRegenerationRate);

            cont = new GUIContent("Elec. Receive Rate:", "The electricity received with every drone.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.electricityReceiveRate = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.electricityReceiveRate);
              }

              if (tower){
                startY+=10;
                cont=new GUIContent("Custom Description:", "Check to use use custom description. If not, the default one (generated based on the effect) will be used");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.useCustomDesp=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), stat.useCustomDesp);
                if(stat.useCustomDesp){
                    GUIStyle style=new GUIStyle("TextArea");
                    style.wordWrap=true;
                    //~ cont=new GUIContent("Description(to be used in runtime): ", "");
                    //~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, 200, 20), cont);
                    stat.desp=EditorGUI.TextArea(new Rect(startX, startY+spaceY-3, 200, 90), stat.desp, style);
                    startY+=90;
                }
            }

            statContentHeight=startY+spaceY+5;

            return new Vector3(startX+220, startY, statContentHeight);
        }
Example #21
0
        private float DrawWeaponStat(UnitStat stat, float startX, float startY)
        {
            float width  = 150;
            float fWidth = 35;
            float spaceX = 130;
            float height = 18;
            float spaceY = height + 2;

            //startY-=spaceY;

            GUI.Box(new Rect(startX, startY, 230, statContentHeight - startY), "");

            startX += 10;     startY += 10;

            //~ cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
            //~ EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
            //~ stat.shootObject=(ShootObject)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-10, height), stat.shootObject, typeof(ShootObject), false);


            //~ startY+=10;


            cont = new GUIContent("Damage(Min/Max):", "");
            EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
            stat.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.damageMin);
            stat.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + fWidth + 2, startY, fWidth, height), stat.damageMax);

            cont = new GUIContent("Cooldown:", "Duration between each attack");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.cooldown);


            cont = new GUIContent("Clip Size:", "The amount of attack the unit can do before the unit needs to reload\nWhen set to -1 the unit will never need any reload");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.clipSize = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.clipSize);
            stat.clipSize = Mathf.Round(stat.clipSize);

            cont = new GUIContent("Reload Duration:", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.reloadDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.reloadDuration);


            startY += 10;


            cont = new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.aoeRadius);



            cont = new GUIContent("Stun", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.chance);

            cont = new GUIContent("        - Duration:", "The stun duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.duration);



            cont = new GUIContent("Critical", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.chance);

            cont = new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);



            cont = new GUIContent("Slow", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("         - Duration:", "The effect duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.duration);

            cont = new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.slowMultiplier);



            cont = new GUIContent("Dot", "Damage over time");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("        - Duration:", "The effect duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.duration);

            cont = new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.interval);

            cont = new GUIContent("        - Damage:", "Damage applied at each tick");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.value);



            cont = new GUIContent("InstantKill", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("                - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.instantKill.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.chance);

            cont = new GUIContent("        - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.instantKill.HPThreshold = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.instantKill.HPThreshold);


            startY += 10;


            cont = new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.damageShieldOnly = EditorGUI.Toggle(new Rect(startX + spaceX, startY, fWidth, height), stat.damageShieldOnly);

            cont = new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.shieldBreak = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldBreak);

            cont = new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.shieldPierce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.shieldPierce);


            statContentHeight = startY + spaceY + 5;

            return(startY);
        }
Example #22
0
        protected float DrawUnitStatsSupport(float startX, float startY, UnitStat stat, Unit unit, bool isTower = true)
        {
            GUI.Box(new Rect(startX, startY, spaceX + 2 * widthS + 10, statContentHeight), "");

            float cachedY = startY;

            startX += 5;      startY += 8;              spaceX += 8;      widthS -= 5;

            if (isTower)
            {
                startY = DrawUnitStatsTower(startX, startY, stat) + 13;
            }

            startY = DrawShootEffectObject(startX, startY, stat, unit, isTower);

            //startY+=5;

            cont = new GUIContent(" - Effect Cooldown:", "Duration between each effect-object spawn");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY - 5, width, height), cont);
            if (stat.effectObject != null)
            {
                stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.cooldown);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            startY += 8;

            cont = new GUIContent("Range:", "Effect range of the unit");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.range);

            startY += 5;

            cont = new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.damageBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.damageBuff);

            cont = new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.cooldownBuff);

            cont = new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.rangeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.rangeBuff);

            cont = new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.criticalBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.criticalBuff);

            cont = new GUIContent("        - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.hitBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.hitBuff);

            cont = new GUIContent("        - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.dodgeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.dodgeBuff);

            cont = new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.buff.regenHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.buff.regenHP);

            startX           -= 5;      startY += 5;      spaceX -= 8;      widthS += 5;//width+=10;
            statContentHeight = startY + spaceY - cachedY;

            return(startY + spaceY);
        }
Example #23
0
        public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower, UnitCreep creep)
        {
            List <Rsc> rscList = EditorDBManager.GetRscList();

            float width  = 150;
            float fWidth = 35;
            float spaceX = 130;
            float height = 18;
            float spaceY = height + 2;

            //startY-=spaceY;

            GUI.Box(new Rect(startX, startY, 220, statContentHeight - startY), "");

            startX += 10;     startY += 10;

            if (tower != null)
            {
                cont = new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.buildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buildDuration);

                cont = new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.unBuildDuration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.unBuildDuration);


                if (stat.cost.Count != rscList.Count)
                {
                    while (stat.cost.Count > rscList.Count)
                    {
                        stat.cost.RemoveAt(stat.cost.Count - 1);
                    }
                    while (stat.cost.Count < rscList.Count)
                    {
                        stat.cost.Add(0);
                    }
                }
                cont = new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                int count = 0;    startY += spaceY;         float cachedX = startX;
                for (int i = 0; i < rscList.Count; i++)
                {
                    EditorUtilities.DrawSprite(new Rect(startX + 10, startY - 1, 20, 20), rscList[i].icon);
                    stat.cost[i] = EditorGUI.IntField(new Rect(startX + 30, startY, fWidth, height), stat.cost[i]);
                    count       += 1;       startX += 65;
                    if (count == 3)
                    {
                        startY += spaceY; startX = cachedX;
                    }
                }
                startX = cachedX; startY += 5;

                startY += spaceY + 5;
            }



            if ((tower && TowerUseShootObject(tower)))
            {
                cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObject = (ShootObject)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObject, typeof(ShootObject), false);
                startY          += 5;
            }

            if (tower && TowerUseShootObjectT(tower))
            {
                cont = new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObjectT = (Transform)EditorGUI.ObjectField(new Rect(startX + spaceX - 50, startY, 4 * fWidth - 20, height), stat.shootObjectT, typeof(Transform), false);
                startY           += 5;
            }

            if ((tower && TowerDealDamage(tower)))
            {
                cont = new GUIContent("Damage(Min/Max):", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.damageMin);
                stat.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + fWidth, startY, fWidth, height), stat.damageMax);

                cont = new GUIContent("Cooldown:", "Duration between each attack");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.cooldown);

                /*
                 * cont=new GUIContent("Clip Size:", "The amount of attack the unit can do before the unit needs to reload\nWhen set to <0 the unit will never need any reload");
                 * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                 * stat.clipSize=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.clipSize);
                 * stat.clipSize=Mathf.Round(stat.clipSize);
                 *
                 *
                 * cont=new GUIContent("Reload Duration:", "");
                 * EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                 * stat.reloadDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.reloadDuration);
                 */


                cont = new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.range);

                cont = new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.aoeRadius);



                cont = new GUIContent("Stun", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.chance);

                cont = new GUIContent("        - Duration:", "The stun duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.stun.duration);



                cont = new GUIContent("Critical", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.chance);

                cont = new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);



                cont = new GUIContent("Slow", "");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("         - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.duration);

                cont = new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.slow.slowMultiplier);



                cont = new GUIContent("Dot", "Damage over time");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.duration);

                cont = new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.interval);

                cont = new GUIContent("        - Damage:", "Damage applied at each tick");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.dot.value);
            }



            if ((tower && tower.type == _TowerType.Support))
            {
                cont = new GUIContent("Range:", "Effect range of the unit");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.range);
                startY    += 5;

                cont = new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

                cont = new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.damageBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.damageBuff);

                cont = new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.cooldownBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.cooldownBuff);

                cont = new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.rangeBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.rangeBuff);

                cont = new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.criticalBuff = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.criticalBuff);

                cont = new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.buff.regenHP = EditorGUI.FloatField(new Rect(startX + spaceX, startY, fWidth, height), stat.buff.regenHP);
            }



            if (tower)
            {
                startY += 10;
                cont    = new GUIContent("Custom Description:", "Check to use use custom description. If not, the default one (generated based on the effect) will be used");
                EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
                stat.useCustomDesp = EditorGUI.Toggle(new Rect(startX + spaceX, startY, 40, height), stat.useCustomDesp);
                if (stat.useCustomDesp)
                {
                    GUIStyle style = new GUIStyle("TextArea");
                    style.wordWrap = true;
                    //~ cont=new GUIContent("Description(to be used in runtime): ", "");
                    //~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, 200, 20), cont);
                    stat.desp = EditorGUI.TextArea(new Rect(startX, startY + spaceY - 3, 200, 90), stat.desp, style);
                    startY   += 90;
                }
            }



            statContentHeight = startY + spaceY + 5;

            return(new Vector3(startX + 220, startY, statContentHeight));
        }
Example #24
0
        protected float DrawUnitStats(float startX, float startY, UnitStat stat, Unit unit, bool isTower = true)
        {
            GUI.Box(new Rect(startX, startY, spaceX + 2 * widthS + 10, statContentHeight), "");

            float cachedY = startY;

            startX += 5;      startY += 8;              spaceX += 8;      widthS -= 5;          //width-=10;

            if (isTower)
            {
                startY = DrawUnitStatsTower(startX, startY, stat) + 13;
                if (unit.gameObject.GetComponent <UnitTower>().type == _TowerType.Block)
                {
                    startX           -= 5;      startY += 5;      spaceX -= 8;      widthS += 5;        //width+=10;
                    statContentHeight = startY - cachedY;
                    return(startY);
                }
            }

            startY = DrawShootEffectObject(startX, startY, stat, unit, isTower);

            startY += 5;

            cont = new GUIContent("Damage(Min/Max):", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.damageMin = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.damageMin);
            stat.damageMax = EditorGUI.FloatField(new Rect(startX + spaceX + widthS + 2, startY, widthS, height), stat.damageMax);

            cont = new GUIContent("Cooldown:", "Duration between each attack");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.cooldown = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.cooldown);

            cont = new GUIContent("Hit Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's dodgeChance. Assume two targets with 0 dodgeChance and .2 dodgeChance and the hitChance set to 1, the unit will always hits the target and have 20% chance to miss the second target.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.hit = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.hit);

            startY += 5;

            cont = new GUIContent("Range:", "Effect range of the unit");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.range = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.range);

            cont = new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.aoeRadius = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.aoeRadius);

            startY += 5;

            cont = new GUIContent("Stun", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.stun.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.stun.chance);

            cont = new GUIContent("        - Duration:", "The stun duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.stun.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.stun.duration);

            startY += 5;

            cont = new GUIContent("Critical", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.crit.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.crit.chance);

            cont = new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (stat.crit.chance > 0)
            {
                stat.crit.dmgMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.crit.dmgMultiplier);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            startY += 5;

            cont = new GUIContent("Slow", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("         - Duration:", "The effect duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.slow.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.slow.duration);

            cont = new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (stat.slow.duration > 0)
            {
                stat.slow.slowMultiplier = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.slow.slowMultiplier);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            startY += 5;

            cont = new GUIContent("Dot", "Damage over time");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("        - Duration:", "The effect duration in second");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.dot.duration = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.dot.duration);

            cont = new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (stat.dot.duration > 0)
            {
                stat.dot.interval = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.dot.interval);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            stat.dot.interval = Mathf.Clamp(stat.dot.interval, 0, stat.dot.duration);

            cont = new GUIContent("        - Damage:", "Damage applied at each tick");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (stat.dot.duration > 0)
            {
                stat.dot.value = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.dot.value);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            startY += 5;

            cont = new GUIContent("InstantKill", "");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);    startY -= spaceY;

            cont = new GUIContent("                - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.instantKill.chance = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.instantKill.chance);

            cont = new GUIContent("        - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            if (stat.instantKill.chance > 0)
            {
                stat.instantKill.HPThreshold = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.instantKill.HPThreshold);
            }
            else
            {
                EditorGUI.LabelField(new Rect(startX + spaceX, startY, widthS, height), "-");
            }

            startY += 5;

            cont = new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.damageShieldOnly = EditorGUI.Toggle(new Rect(startX + spaceX, startY, widthS, height), stat.damageShieldOnly);

            cont = new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.shieldBreak = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.shieldBreak);

            cont = new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
            EditorGUI.LabelField(new Rect(startX, startY += spaceY, width, height), cont);
            stat.shieldPierce = EditorGUI.FloatField(new Rect(startX + spaceX, startY, widthS, height), stat.shieldPierce);


            startX           -= 5;      startY += 5;      spaceX -= 8;      widthS += 5;
            statContentHeight = startY + spaceY - cachedY;

            return(startY + spaceY);
        }
		public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower){
			return DrawStat(stat, startX, startY, statContentHeight, tower, null);
		}
		public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight,  UnitCreep creep){
			return DrawStat(stat, startX, startY, statContentHeight, null, creep);
		}
		public static Vector3 DrawStat(UnitStat stat, float startX, float startY, float statContentHeight, UnitTower tower, UnitCreep creep){
			
			List<Rsc> rscList=EditorDBManager.GetRscList();
			
			float width=150;
			float fWidth=35;
			float spaceX=130;
			float height=18;
			float spaceY=height+2;
			
			//startY-=spaceY;
			
			GUI.Box(new Rect(startX, startY, 220, statContentHeight-startY), "");
			
			startX+=10;	startY+=10;
			
			if(tower!=null){
				
				cont=new GUIContent("Construct Duration:", "The time in second it takes to construct (if this is the first level)/upgrade (if this is not the first level)");
				EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
				stat.buildDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buildDuration);
				
				cont=new GUIContent("Deconstruct Duration:", "The time in second it takes to deconstruct if the unit is in this level");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.unBuildDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.unBuildDuration);
			
				
				if(stat.cost.Count!=rscList.Count){
					while(stat.cost.Count>rscList.Count) stat.cost.RemoveAt(stat.cost.Count-1);
					while(stat.cost.Count<rscList.Count) stat.cost.Add(0);
				}
				cont=new GUIContent("Build/Upgrade Cost:", "The resource required to build/upgrade to this level");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				int count=0;	startY+=spaceY; 	float cachedX=startX;
				for(int i=0; i<rscList.Count; i++){
					EditorUtilities.DrawSprite(new Rect(startX+10, startY-1, 20, 20), rscList[i].icon);
					stat.cost[i]=EditorGUI.IntField(new Rect(startX+30, startY, fWidth, height), stat.cost[i]);
					count+=1; 	startX+=65;
					if(count==3){ startY+=spaceY; startX=cachedX; }
				}
				startX=cachedX;	startY+=5;
				
				startY+=spaceY+5;
			}
			
			
			
			if((tower && TowerUseShootObject(tower)) || (creep && creep.type==_CreepType.Offense)){
				cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
				EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
				stat.shootObject=(ShootObject)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-20, height), stat.shootObject, typeof(ShootObject), false);
				startY+=5;
			}
			
			if(tower && TowerUseShootObjectT(tower)){
				cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
				EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
				stat.shootObjectT=(Transform)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-20, height), stat.shootObjectT, typeof(Transform), false);
				startY+=5;
			}
				
			if((tower &&  TowerDealDamage(tower)) || (creep && creep.type==_CreepType.Offense)){
				cont=new GUIContent("Damage(Min/Max):", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.damageMin=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.damageMin);
				stat.damageMax=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.damageMax);
				
				cont=new GUIContent("Cooldown:", "Duration between each attack");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.cooldown=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.cooldown);
				
				
				cont=new GUIContent("Range:", "Effect range of the unit");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.range=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.range);
				
				//~ cont=new GUIContent("Range(Min/Max):", "");
				//~ EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				//~ stat.minRange=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.minRange);
				//~ stat.range=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.range);
				
				cont=new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.aoeRadius=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.aoeRadius);
				
				
				
				cont=new GUIContent("Hit Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's dodgeChance. Assume two targets with 0 dodgeChance and .2 dodgeChance and the hitChance set to 1, the unit will always hits the target and have 20% chance to miss the second target.");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.hit=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.hit);
				
				if(!creep){	
					cont=new GUIContent("Dodge Chance:", "Take value from 0-1. 0 being 0% and 1 being 100%. Final value are subject to target's hitChance. Assume two attackers with 1 hitChance and .8 hitChance and the dodgeChance set to .2, the chances to dodge attack from each attacker are 20% and 40% respectively.");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stat.dodge=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dodge);
				}
				
				
				cont=new GUIContent("Stun", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.stun.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.chance);
				
				cont=new GUIContent("        - Duration:", "The stun duration in second");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.stun.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.duration);
				
				
				
				cont=new GUIContent("Critical", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.crit.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.chance);
				
				cont=new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.crit.dmgMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);
				
				
				
				cont=new GUIContent("Slow", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("         - Duration:", "The effect duration in second");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.slow.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.duration);
				
				cont=new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.slow.slowMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.slowMultiplier);
				
				
				
				cont=new GUIContent("Dot", "Damage over time");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("        - Duration:", "The effect duration in second");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.dot.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.duration);
				
				cont=new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.dot.interval=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.interval);
				
				cont=new GUIContent("        - Damage:", "Damage applied at each tick");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.dot.value=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.value);
				
				
				
				cont=new GUIContent("InstantKill", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("                - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.instantKill.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.instantKill.chance);
				
				cont=new GUIContent("        - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.instantKill.HPThreshold=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.instantKill.HPThreshold);
				
				
				cont=new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.damageShieldOnly=EditorGUI.Toggle(new Rect(startX+spaceX, startY, fWidth, height), stat.damageShieldOnly);
				
				cont=new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.shieldBreak=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.shieldBreak);
				
				cont=new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.shieldPierce=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.shieldPierce);
			}
			
			
			
			if((tower && tower.type==_TowerType.Support) || (creep && creep.type==_CreepType.Support)){
				cont=new GUIContent("Range:", "Effect range of the unit");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.range=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.range);
				startY+=5;
				
				cont=new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.damageBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.damageBuff);
				
				cont=new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.cooldownBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.cooldownBuff);
				
				cont=new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.rangeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.rangeBuff);
				
				cont=new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.criticalBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.criticalBuff);
				
				cont=new GUIContent("        - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.hitBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.hitBuff);
				
				cont=new GUIContent("        - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.dodgeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.dodgeBuff);
				
				cont=new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.buff.regenHP=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.regenHP);
			}
			
			
			if(tower && tower.type==_TowerType.Resource){
				if(stat.rscGain.Count!=rscList.Count){
					while(stat.rscGain.Count>rscList.Count) stat.rscGain.RemoveAt(stat.rscGain.Count-1);
					while(stat.rscGain.Count<rscList.Count) stat.rscGain.Add(0);
				}
				cont=new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				int count=0;	startY+=spaceY; 	float cachedX=startX;
				for(int i=0; i<rscList.Count; i++){
					EditorUtilities.DrawSprite(new Rect(startX+10, startY-1, 20, 20), rscList[i].icon);
					stat.rscGain[i]=EditorGUI.IntField(new Rect(startX+30, startY, fWidth, height), stat.rscGain[i]);
					count+=1; 	startX+=65;
					if(count==3){ startY+=spaceY; startX=cachedX; }
				}
				startX=cachedX;	startY+=5;
			}
			
			
			if(tower){
				startY+=10;
				cont=new GUIContent("Custom Description:", "Check to use use custom description. If not, the default one (generated based on the effect) will be used");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stat.useCustomDesp=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), stat.useCustomDesp);
				if(stat.useCustomDesp){
					GUIStyle style=new GUIStyle("TextArea");
					style.wordWrap=true;
					stat.desp=EditorGUI.TextArea(new Rect(startX, startY+spaceY-3, 200, 90), stat.desp, style);
					startY+=90;
				}
			}
			
			
			
			
			statContentHeight=startY+spaceY+5;
			
			return new Vector3(startX+220, startY, statContentHeight);
		}
        public static Vector3 DrawWeaponStat(UnitStat stat, float startX, float startY, float statContentHeight)
        {
            float width=150;
            float fWidth=35;
            float spaceX=130;
            float height=18;
            float spaceY=height+2;

            //startY-=spaceY;

            GUI.Box(new Rect(startX, startY, 220, statContentHeight-startY), "");

            startX+=10;	startY+=10;

                cont=new GUIContent("ShootObject:", "The shootObject used by the unit.\nUnit that intended to shoot at the target will not function correctly if this is left unassigned.");
                EditorGUI.LabelField(new Rect(startX, startY, width, height), cont);
                stat.shootObject=(ShootObject)EditorGUI.ObjectField(new Rect(startX+spaceX-50, startY, 4*fWidth-20, height), stat.shootObject, typeof(ShootObject), false);
                startY+=10;

                cont=new GUIContent("Damage(Min/Max):", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.damageMin=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.damageMin);
                stat.damageMax=EditorGUI.FloatField(new Rect(startX+spaceX+fWidth, startY, fWidth, height), stat.damageMax);

                cont=new GUIContent("Cooldown:", "Duration between each attack");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.cooldown=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.cooldown);

                cont=new GUIContent("Clip Size:", "The amount of attack the unit can do before the unit needs to reload\nWhen set to -1 the unit will never need any reload");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.clipSize=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.clipSize);
                stat.clipSize=Mathf.Round(stat.clipSize);

                cont=new GUIContent("Reload Duration:", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.reloadDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.reloadDuration);

                startY+=10;

                cont=new GUIContent("AOE Radius:", "Area-of-Effective radius. When the shootObject hits it's target, any other hostile unit within the area from the impact position will suffer the same target as the target.\nSet value to >0 to enable. ");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.aoeRadius=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.aoeRadius);

                cont=new GUIContent("Stun", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.stun.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.chance);

                cont=new GUIContent("        - Duration:", "The stun duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.stun.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.stun.duration);

                cont=new GUIContent("Critical", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.crit.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.chance);

                cont=new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.crit.dmgMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.crit.dmgMultiplier);

                cont=new GUIContent("Slow", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("         - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.slow.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.duration);

                cont=new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.slow.slowMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.slow.slowMultiplier);

                cont=new GUIContent("Dot", "Damage over time");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Duration:", "The effect duration in second");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.duration);

                cont=new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.interval=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.interval);

                cont=new GUIContent("        - Damage:", "Damage applied at each tick");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.dot.value=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.dot.value);

                cont=new GUIContent("InstantKill", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("                - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.instantKill.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.instantKill.chance);

                cont=new GUIContent("        - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.instantKill.HPThreshold=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.instantKill.HPThreshold);

                startY+=10;

                cont=new GUIContent("Damage Shield Only:", "When checked, unit will only inflict shield damage");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.damageShieldOnly=EditorGUI.Toggle(new Rect(startX+spaceX, startY, fWidth, height), stat.damageShieldOnly);

                cont=new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.shieldBreak=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.shieldBreak);

                cont=new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.shieldPierce=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.shieldPierce);

            /*
                cont=new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;

                cont=new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.damageBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.damageBuff);

                cont=new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.cooldownBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.cooldownBuff);

                cont=new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.rangeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.rangeBuff);

                cont=new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.criticalBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.criticalBuff);

                cont=new GUIContent("        - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.hitBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.hitBuff);

                cont=new GUIContent("        - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.dodgeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.dodgeBuff);

                cont=new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
                stat.buff.regenHP=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stat.buff.regenHP);
            */

                startY+=10;
                GUIStyle style=new GUIStyle("TextArea");
                style.wordWrap=true;
                cont=new GUIContent("Description(to be used in runtime): ", "");
                EditorGUI.LabelField(new Rect(startX, startY+=spaceY, 200, 20), cont);
                stat.desp=EditorGUI.TextArea(new Rect(startX, startY+spaceY-3, 200, 90), stat.desp, style);

                startY+=90;

            statContentHeight=startY+spaceY+5;

            return new Vector3(startX+220, startY, statContentHeight);
        }
		Vector2 DrawUnitStat(float startX, float startY, UnitStat stats, bool isWeapon){
			float fWidth=40;
			
			if(!isWeapon) foldOffenseParameter=EditorGUI.Foldout(new Rect(startX, startY+=spaceY, width, height), foldOffenseParameter, "Show Offensive Stats");
			if(isWeapon || foldOffenseParameter){
				startX+=15;
				
				cont=new GUIContent("Damage:", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.damageMin=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.damageMin);
				
				cont=new GUIContent("Cooldown:", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.cooldown=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.cooldown);
				
				if(isWeapon){
					cont=new GUIContent("Clip Size:", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.clipSize=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.clipSize);
					
					cont=new GUIContent("Reload Duration:", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.reloadDuration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.reloadDuration);
				}
					
				if(!isWeapon){
					cont=new GUIContent("Range:", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.range=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.range);
				}
				
				cont=new GUIContent("AOE Radius:", "");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.aoeRadius=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.aoeRadius);
				
				if(!isWeapon){
					cont=new GUIContent("Hit Modifier:", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.hit=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.hit);
					
					cont=new GUIContent("Dodge Modifier:", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.dodge=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.dodge);
				}
				
				cont=new GUIContent("Stun", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
					
					cont=new GUIContent("        - Chance:", "Chance to stun the target in each successful attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.stun.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.stun.chance);
					
					cont=new GUIContent("        - Duration:", "The stun duration in second");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.stun.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.stun.duration);
				
				cont=new GUIContent("Critical", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
					
					cont=new GUIContent("            - Chance:", "Chance to score critical hit in attack. Takes value from 0-1 with 0 being 0% and 1 being 100%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.crit.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.crit.chance);
					
					cont=new GUIContent("            - Multiplier:", "Damage multiplier for successful critical hit. Takes value from 0 and above with with 0.5 being 50% of normal damage as bonus");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.crit.dmgMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.crit.dmgMultiplier);
				
				
				cont=new GUIContent("Slow", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
					
					cont=new GUIContent("         - Duration:", "The effect duration in second");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.slow.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.slow.duration);
					
					cont=new GUIContent("         - Multiplier:", "Move speed multiplier. Takes value from 0-1 with with 0.7 being decrese default speed by 30%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.slow.slowMultiplier=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.slow.slowMultiplier);
					
					
					
				cont=new GUIContent("Dot", "Damage over time");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
					
					cont=new GUIContent("        - Duration:", "The effect duration in second");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.dot.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.dot.duration);
					
					cont=new GUIContent("        - Interval:", "Duration between each tick. Damage is applied at each tick.");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.dot.interval=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.dot.interval);
					
					cont=new GUIContent("        - Damage:", "Damage applied at each tick");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.dot.value=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.dot.value);
					
					
					
				cont=new GUIContent("InstantKill", "");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
					
					cont=new GUIContent("               - Chance:", "The chance to instant kill the target. Takes value from 0-1 with 0 being 0% and 1 being 100%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.instantKill.chance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.instantKill.chance);
					
					cont=new GUIContent("       - HP Threshold:", "The HP threshold of the target in order for the instantKill to become valid. Take value from 0-1 with 0.3 being 30% of the fullHP.");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.instantKill.HPThreshold=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.instantKill.HPThreshold);
					
					
					cont=new GUIContent("Shield Break:", "The chance of the unit's attack to damage target's shield and disable shield regen permenantly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.shieldBreak=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.shieldBreak);
					
					cont=new GUIContent("Shield Pierce:", "The chance of the unit's attack to bypass target's shield and damage HP directly\nTakes value from 0-1 with 0 being 0% and 1 being 100%");
					EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
					stats.shieldPierce=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.shieldPierce);
					
				startX-=15;
			}
			
			if(!isWeapon) foldSupportParameter=EditorGUI.Foldout(new Rect(startX, startY+=spaceY, width, height), foldSupportParameter, "Show Support Stats");
			if(!isWeapon && foldSupportParameter){
				startX+=15;
				
				cont=new GUIContent("Buff:", "Note: Buffs from multple tower doesnt stack, however when there's difference in the buff strength, the stronger buff applies. A tower can gain maximum dmage buff from one source and maximum range buff from another");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);	startY-=spaceY;
				
				cont=new GUIContent("        - Damage:", "Damage buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in damage");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.damageBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.damageBuff);
				
				cont=new GUIContent("        - Cooldown:", "Dooldown buff multiplier. Takes value from 0-1 with 0.2 being reduce cooldown by 20%");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.cooldownBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.cooldownBuff);
				
				cont=new GUIContent("        - Range:", "Range buff multiplier. Takes value from 0 and above with 0.5 being 50% increase in range");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.rangeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.rangeBuff);
				
				cont=new GUIContent("        - Critical:", "Critical hit chance buff modifier. Takes value from 0 and above with 0.25 being 25% increase in critical hit chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.criticalBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.criticalBuff);
				
				cont=new GUIContent("        - Hit:", "Hit chance buff modifier. Takes value from 0 and above with .2 being 20% increase in hit chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.hitBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.hitBuff);
				
				cont=new GUIContent("        - Dodge:", "Dodge chance buff modifier. Takes value from 0 and above with 0.15 being 15% increase in dodge chance");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.dodgeBuff=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.dodgeBuff);
				
				cont=new GUIContent("        - HP Regen:", "HP Regeneration Buff. Takes value from 0 and above with 2 being gain 2HP second ");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				stats.buff.regenHP=EditorGUI.FloatField(new Rect(startX+spaceX, startY, fWidth, height), stats.buff.regenHP);
				
				startX-=15;
			}
			
			
			if(!isWeapon) foldRscParameter=EditorGUI.Foldout(new Rect(startX, startY+=spaceY, width, height), foldRscParameter, "Show RscGain");
			if(!isWeapon && foldRscParameter){
				startX+=15;
				
				List<Rsc> rscList=EditorDBManager.GetRscList();
				if(stats.rscGain.Count!=rscList.Count){
					while(stats.rscGain.Count>rscList.Count) stats.rscGain.RemoveAt(stats.rscGain.Count-1);
					while(stats.rscGain.Count<rscList.Count) stats.rscGain.Add(0);
				}
				cont=new GUIContent("Resource Gain:", "The resource gain by unit at each cooldown interval\nOnly applicable to ResourceTower");
				EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
				int count=0;	startY+=spaceY; 	float cachedX=startX;
				for(int i=0; i<rscList.Count; i++){
					EditorUtilities.DrawSprite(new Rect(startX+10, startY-1, 20, 20), rscList[i].icon);
					stats.rscGain[i]=EditorGUI.IntField(new Rect(startX+30, startY, fWidth, height), stats.rscGain[i]);
					count+=1; 	startX+=65;
					if(count==3){ startY+=spaceY; startX=cachedX; }
				}
				
				startX-=15;
			}
			
			return new Vector2(startX, startY);
		}