Exemplo n.º 1
0
        public Effect Clone()
        {
            Effect eff=new Effect();

            eff.ID=ID;
            eff.name=name;
            eff.icon=icon;

            eff.showOnUI=showOnUI;

            eff.restoreHitPoint=restoreHitPoint;
            eff.restoreEnergy=restoreEnergy;

            eff.invincible=invincible;
            eff.stun=stun;
            eff.speedMul=speedMul;

            eff.damageMul=damageMul;

            eff.critChanceMul=critChanceMul;
            eff.critMultiplierMul=critMultiplierMul;

            eff.duration=duration;

            return eff;
        }
Exemplo n.º 2
0
        IEnumerator TemporaryWeaponTimer(Weapon weapon, float time)
        {
            Effect effect=new Effect();
            effect.ID=999;
            effect.duration=time;
            effect.icon=weapon.icon;
            ApplyEffect(effect);

            while(effect.duration>0 && weapon!=null) yield return null;

            effect.duration=-1;
            if(weapon!=null) RemoveWeapon();
        }
Exemplo n.º 3
0
 public override bool ApplyEffect(Effect effect)
 {
     if(!base.ApplyEffect(effect)) return false;
     TDS.GainEffect(effect);	//for UIBuffIcons
     return true;
 }
Exemplo n.º 4
0
        //refresh the stats in activeEffect
        public void UpdateActiveEffect()
        {
            activeEffect=new Effect();
            for(int i=0; i<effectList.Count; i++){
                activeEffect.restoreHitPoint+=effectList[i].restoreHitPoint;
                activeEffect.restoreEnergy+=effectList[i].restoreEnergy;

                activeEffect.invincible|=effectList[i].invincible;
                activeEffect.stun|=effectList[i].stun;
                activeEffect.speedMul*=effectList[i].speedMul;

                activeEffect.damageMul*=effectList[i].damageMul;

                activeEffect.critChanceMul*=effectList[i].critChanceMul;
                activeEffect.critMultiplierMul*=effectList[i].critMultiplierMul;
            }
        }
Exemplo n.º 5
0
        //function call to add new effect to the unit
        public virtual bool ApplyEffect(Effect effect)
        {
            if(effect==null || !effect.Applicable()) return false;

            //if the effect missed
            if(Random.value>effect.hitChance) return false;

            //add the effect to the list and update the active effect
            effectList.Add(effect);
            UpdateActiveEffect();

            //run the coroutine for the effect
            if(!effCoroutine) StartCoroutine(EffectRoutine());

            return true;
        }
Exemplo n.º 6
0
 public static void GainEffect(Effect effect)
 {
     if(onGainEffectE!=null) onGainEffectE(effect);
 }
Exemplo n.º 7
0
        int NewItem(int cloneID=-1)
        {
            Effect effect=null;
            if(cloneID==-1){
                effect=new Effect();
                effect.name="New Effect";
            }
            else{
                effect=effectDB.effectList[selectID].Clone();
            }
            effect.ID=GenerateNewID(effectIDList);
            effectIDList.Add(effect.ID);

            effectDB.effectList.Add(effect);

            UpdateLabel_Effect();

            return effectDB.effectList.Count-1;
        }
Exemplo n.º 8
0
        Vector2 DrawEffectConfigurator(float startX, float startY, Effect effect)
        {
            //float cachedX=startX;
            //float cachedY=startY;

            TDSEditorUtility.DrawSprite(new Rect(startX, startY, 60, 60), effect.icon);
            startX+=65;

            cont=new GUIContent("Name:", "The effect name to be displayed in game");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY/2, width, height), cont);
            effect.name=EditorGUI.TextField(new Rect(startX+spaceX-65, startY, width-5, height), effect.name);

            cont=new GUIContent("Icon:", "The effect icon to be displayed in game, must be a sprite");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.icon=(Sprite)EditorGUI.ObjectField(new Rect(startX+spaceX-65, startY, width-5, height), effect.icon, typeof(Sprite), false);

            startX-=65;
            startY+=10+spaceY;	//cachedY=startY;

            cont=new GUIContent("Show On UI:", "Check to show the effect icon on UI when it's applied on player\nOnly applies to default UI");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.showOnUI=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), effect.showOnUI);

            startY+=10;

            cont=new GUIContent("Hit Chance:", "The chance of the effect being applied successfully. Takes value from 0-1 with 0.7 being 70%");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.hitChance=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.hitChance);

            cont=new GUIContent("Duration:", "The active duration of the effect in seconds");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.duration=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.duration);

            startY+=10;

            cont=new GUIContent("Restore HitPoint:", "Amount of hit-point to be restored to the unit per seconds while the effect is active");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.restoreHitPoint=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.restoreHitPoint);

            cont=new GUIContent("Restore Energy:", "Amount of energy to be restored to the unit per seconds while the effect is active");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.restoreEnergy=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.restoreEnergy);

            startY+=10;

            cont=new GUIContent("Speed Multiplier:", "The speed multiplier to be applied to the unit's speed. Stacks with other effects.\n - 0.7 means 70% of the default speed\n - 1.5 means 150% of the default speed");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.speedMul=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.speedMul);

            cont=new GUIContent("Stun:", "Check if the effect stuns the target. Stunned unit cannot move or attack");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.stun=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), effect.stun);

            cont=new GUIContent("Invincible:", "Check if the effect makes the target invincible. Invincible unit are immuned to all damage and effect");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.invincible=EditorGUI.Toggle(new Rect(startX+spaceX, startY, 40, height), effect.invincible);

            startY+=10;

            cont=new GUIContent("Damage Multiplier:", "The damage multiplier to be applied to the unit's damage. Stacks with other effects.\n - 0.7 means 70% of the default deamge\n - 1.5 means 150% of the default damage");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.damageMul=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.damageMul);

            cont=new GUIContent("Crit Chance Mul.:", "The critical chance multiplier to be applied to the unit's critical chance. Stacks with other effects.\n - 0.7 means 70% of the default value\n - 1.5 means 150% of the default value");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.critChanceMul=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.critChanceMul);

            cont=new GUIContent("Crit Multiplier Mul.:", "The critical multiplier to be applied to the unit's critical multiplier. Stacks with other effects.\n - 0.7 means 70% of the default value\n - 1.5 means 150% of the default value");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, width, height), cont);
            effect.critMultiplierMul=EditorGUI.FloatField(new Rect(startX+spaceX, startY, 40, height), effect.critMultiplierMul);

            startY+=10;

            GUIStyle style=new GUIStyle("TextArea");
            style.wordWrap=true;
            cont=new GUIContent("Effect description (to be used in runtime): ", "");
            EditorGUI.LabelField(new Rect(startX, startY+=spaceY, 400, 20), cont);
            effect.desp=EditorGUI.TextArea(new Rect(startX, startY+spaceY-3, 270, 150), effect.desp, style);

            return new Vector2(startX, startY+200);
        }
Exemplo n.º 9
0
        void Awake()
        {
            gameObject.GetComponent<Collider>().isTrigger=true;
            gameObject.layer=TDS.GetLayerCollectible();

            if(type==_CollectType.Self){
                //initiate the weapon list to contain all weapon if the condition is checked
                if(gainWeapon && randomWeapon && enableAllWeapon) weaponList=new List<Weapon>( WeaponDB.Load() );

                //make sure none of the element in weaponList is null
                for(int i=0; i<weaponList.Count; i++){
                    if(weaponList[i]==null){ weaponList.RemoveAt(i); i-=1; }
                }
            }

            effect=EffectDB.CloneItem(effectID);

            if(triggerEffectObj!=null) ObjectPoolManager.New(triggerEffectObj, 1);
        }
Exemplo n.º 10
0
 public void Init()
 {
     //clone the effect so the original in DB wont get modified
     effect=EffectDB.CloneItem(effectID);
 }