Пример #1
0
    void Awake()
    {
        Auras = new Dictionary<string, Aura>();

        Auras["test"] = new AuraTemplate("test");
        Auras["heal"] = new Heal("heal");
        Auras["Corruption"] = new Corruption("Corruption");
        Auras["BlessingOfMight"] = new BlessingOfMight("Blessing of Might");

        Auras["shadowStun"] = new Shadowstun("shadowStun");
        Auras["root"] = new Root("root");
        Auras["slow"] = new Slow("slow");
        Auras["dervishslow"] = new DervishSlow("dervishslow");
        Auras["chaosbarrage"] = new chaosbarrage("chaosbarrage");
        Auras["fireballbarrage"] = new fireballbarrage("fireballbarrage");
    }
Пример #2
0
    public void ApplySlow(Slow slow)
    {
        bool immuned=false;

        if(subClass==_UnitSubClass.Creep){ immuned=unitC.immuneToSlow; }
        else if(subClass==_UnitSubClass.Tower){ immuned=unitT.immuneToSlow; }

        if(!immuned){
            slow.SetTimeEnd(Time.time+slow.duration);
            slowEffect.Add(slow);
            if(!slowRoutine) StartCoroutine(SlowRoutine());
        }
    }
Пример #3
0
 /// <summary>
 /// Slows the <see cref="EnemyBase"/> by a percentage.
 /// </summary>
 /// <param name="percentage">Percent to slow.</param>
 /// <param name="duration">Duration of effect.</param>
 /// <remarks>Percentage is 0-1 not 0-100</remarks>
 public void Slow(float percentage, float duration)
 {
     IBuff buff = new Slow (this, duration, percentage);
     this.debuffs.Add (buff);
 }
Пример #4
0
    private void UpgradeStat()
    {
        int levelM=level-1;

        if(type==_TowerType.TurretTower || type==_TowerType.DirectionalAOETower || type==_TowerType.AOETower){
            damage=upgradeStat[levelM].damage;
            cooldown=upgradeStat[levelM].cooldown;
            clipSize=upgradeStat[levelM].clipSize;
            currentClip=clipSize;
            if(currentClip<=0) currentClip=-1;
            reloadDuration=upgradeStat[levelM].reloadDuration;
            range=upgradeStat[levelM].range;
            minRange=upgradeStat[levelM].minRange;
            aoeRadius=upgradeStat[levelM].aoeRadius;
            stunDuration=upgradeStat[levelM].stunDuration;
            slow=upgradeStat[levelM].slow;
            dot=upgradeStat[levelM].dot;
        }
        else if(type==_TowerType.SupportTower){
            buff=upgradeStat[levelM].buff;
            buff.buffID=towerID;
        }
        else if(type==_TowerType.ResourceTower){
            incomes=upgradeStat[levelM].incomes;
            cooldown=upgradeStat[levelM].cooldown;
        }

        if(upgradeStat[levelM].shootObject!=null)
            shootObject=upgradeStat[levelM].shootObject.gameObject;

        if(upgradeStat[levelM].turretObject!=null){

            if(turretObject.childCount>0) turretObject.gameObject.SetActiveRecursively(false);
            else turretObject.gameObject.active=false;

            Transform turretTemp=(Transform)Instantiate(upgradeStat[levelM].turretObject);
            turretTemp.position=turretObject.position;
            turretTemp.rotation=turretObject.rotation;
            turretTemp.parent=thisT;
            turretObject=turretTemp;
            //turretObject=upgradeStat[levelM].turretObject;

            UpdateShootPoint();
        }
        if(upgradeStat[levelM].barrelObject!=null){
            barrelObject=upgradeStat[levelM].barrelObject;
        }

        if(upgradeStat[levelM].baseObject!=null){

            if(baseObject.childCount>0) baseObject.gameObject.SetActiveRecursively(false);
            else baseObject.gameObject.active=false;

            Transform baseTemp=(Transform)Instantiate(upgradeStat[levelM].baseObject);
            baseTemp.position=baseObject.position;
            baseTemp.rotation=baseObject.rotation;
            baseTemp.parent=thisT;
            baseObject=baseTemp;

            //baseObject=upgradeStat[levelM].baseObject;
        }

        level+=1;

        UpdateTowerValue();
        GameControl.TowerUpgradeComplete(this);
    }
Пример #5
0
    public Slow Clone()
    {
        Slow clone=new Slow();
        clone.slowFactor=slowFactor;
        clone.duration=duration;
        clone.timeEnd=timeEnd;

        return clone;
    }
Пример #6
0
    //initialise stat, call when tower is first built
    private void InitStat()
    {
        //level=1;
        cooldown=baseStat.cooldown;

        range=baseStat.range;

        if(type==_TowerType.TurretTower || type==_TowerType.DirectionalAOETower || type==_TowerType.AOETower || type==_TowerType.Mine){
            damage=baseStat.damage;

            clipSize=baseStat.clipSize;
            currentClip=clipSize;
            if(currentClip<=0) currentClip=-1;
            reloadDuration=baseStat.reloadDuration;
            aoeRadius=baseStat.aoeRadius;
            stunDuration=baseStat.stunDuration;
            slow=baseStat.slow;
            dot=baseStat.dot;
        }
        else if(type==_TowerType.SupportTower){
            buff=baseStat.buff;
        }
        else if(type==_TowerType.ResourceTower){
            incomes=baseStat.incomes;
        }

        if(baseStat.shootObject!=null){
            shootObject=baseStat.shootObject.gameObject;
        }
        else{
            if(type==_TowerType.TurretTower){
                GameObject tempObj = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                tempObj.AddComponent<ShootObject>();
                tempObj.active=false;

                shootObject=tempObj;
            }
        }

        if(baseStat.turretObject!=null){
            turretObject=baseStat.turretObject;
        }
        if(baseStat.barrelObject!=null){
            barrelObject=baseStat.barrelObject;
        }

        //since this is initialization, update shootpoint regardless of if there's a turretObject
        UpdateShootPoint();

        if(baseStat.baseObject!=null){
            baseObject=baseStat.baseObject;
        }

        UpdateTowerValue();
    }
Пример #7
0
    private void UpgradeStat()
    {
        int levelM=level-1;

        if(type==_TowerType.TurretTower || type==_TowerType.DirectionalAOETower || type==_TowerType.AOETower){
            damage=upgradeStat[levelM].damage;
            cooldown=upgradeStat[levelM].cooldown;
            clipSize=upgradeStat[levelM].clipSize;
            currentClip=clipSize;
            if(currentClip<=0) currentClip=-1;
            reloadDuration=upgradeStat[levelM].reloadDuration;
            range=upgradeStat[levelM].range;
            minRange=upgradeStat[levelM].minRange;
            aoeRadius=upgradeStat[levelM].aoeRadius;
            stunDuration=upgradeStat[levelM].stunDuration;
            slow=upgradeStat[levelM].slow;
            dot=upgradeStat[levelM].dot;
        }
        else if(type==_TowerType.SupportTower){
            buff=upgradeStat[levelM].buff;
            buff.buffID=towerID;
        }
        else if(type==_TowerType.ResourceTower){
            incomes=upgradeStat[levelM].incomes;
            cooldown=upgradeStat[levelM].cooldown;
        }

        if(upgradeStat[levelM].shootObject!=null)
            shootObject=upgradeStat[levelM].shootObject.gameObject;

        if(upgradeStat[levelM].turretObject!=null){

            if(turretObject.childCount>0) turretObject.gameObject.SetActiveRecursively(false);
            else turretObject.gameObject.active=false;

            Transform turretTemp=(Transform)Instantiate(upgradeStat[levelM].turretObject);
            turretTemp.position=turretObject.position;
            turretTemp.rotation=turretObject.rotation;
            turretTemp.parent=thisT;
            turretObject=turretTemp;
            //turretObject=upgradeStat[levelM].turretObject;

            UpdateShootPoint();

            Animation tempAni=null;
            //search for turret build animation component
            //if there's a build animation clip
            //~ if(upgradeStat[levelM].turretBuildAnimation!=null){
                //~ //if not on the baseObject itself
                //~ if(upgradeStat[levelM].turretBuildAnimationBody.gameObject!=upgradeStat[levelM].turretObject){
                    //~ foreach(Transform child in turretObject.transform){
                        //~ tempAni=(Animation)child.gameObject.GetComponent(typeof(Animation));
                        //~ if(tempAni!=null){
                            //~ if(tempAni.gameObject.name==upgradeStat[levelM].turretBuildAnimationBody.gameObject.name){
                                //~ turretBuildAnimationBody=tempAni;
                            //~ }
                        //~ }
                    //~ }
                //~ }
                //~ else{
                    //~ tempAni=(Animation)turretObject.GetComponent(typeof(Animation));
                    //~ if(tempAni!=null) turretBuildAnimationBody=tempAni;
                //~ }

                //~ //if there's an animation component, assign the animation clip
                //~ if(tempAni!=null){
                    //~ turretBuildAnimation=upgradeStat[levelM].turretBuildAnimation;
                    //~ turretBuildAnimationBody.AddClip(turretBuildAnimation, turretBuildAnimation.name);
                //~ }
            //~ }

            tempAni=null;
            //search for turret build animation component
            //if there's a build animation clip
            if(upgradeStat[levelM].turretFireAnimation!=null){
                //if not on the baseObject itself
                if(upgradeStat[levelM].turretFireAnimationBody.gameObject!=upgradeStat[levelM].turretObject){
                    foreach(Transform child in turretObject.transform){
                        tempAni=(Animation)child.gameObject.GetComponent(typeof(Animation));
                        if(tempAni!=null){
                            if(tempAni.gameObject.name==upgradeStat[levelM].turretFireAnimationBody.gameObject.name){
                                turretFireAnimationBody=tempAni;
                            }
                        }
                    }
                }
                else{
                    tempAni=(Animation)turretObject.GetComponent(typeof(Animation));
                    if(tempAni!=null) turretFireAnimationBody=tempAni;
                }

                //if there's an animation component, assign the animation clip
                if(tempAni!=null){
                    turretFireAnimation=upgradeStat[levelM].turretFireAnimation;
                    turretFireAnimationBody.AddClip(turretFireAnimation, turretFireAnimation.name);
                }
            }
        }
        if(upgradeStat[levelM].barrelObject!=null){
            barrelObject=upgradeStat[levelM].barrelObject;
        }

        if(upgradeStat[levelM].baseObject!=null){

            if(baseObject.childCount>0) baseObject.gameObject.SetActiveRecursively(false);
            else baseObject.gameObject.active=false;

            Transform baseTemp=(Transform)Instantiate(upgradeStat[levelM].baseObject);
            baseTemp.position=baseObject.position;
            baseTemp.rotation=baseObject.rotation;
            baseTemp.parent=thisT;
            baseObject=baseTemp;

            //baseObject=upgradeStat[levelM].baseObject;

            Animation tempAni=null;
            //search for base animation component
            //if there's a build animation clip
            //~ if(upgradeStat[levelM].baseBuildAnimation!=null){
                //~ //if not on the baseObject itself
                //~ if(upgradeStat[levelM].baseBuildAnimationBody.gameObject!=upgradeStat[levelM].baseObject){
                    //~ foreach(Transform child in baseObject.transform){
                        //~ tempAni=(Animation)child.gameObject.GetComponent(typeof(Animation));
                        //~ if(tempAni!=null){
                            //~ if(tempAni.gameObject.name==upgradeStat[levelM].baseBuildAnimationBody.gameObject.name){
                                //~ baseBuildAnimationBody=tempAni;
                            //~ }
                        //~ }
                    //~ }
                //~ }
                //~ else{
                    //~ tempAni=(Animation)baseObject.GetComponent(typeof(Animation));
                    //~ if(tempAni!=null) baseBuildAnimationBody=tempAni;
                //~ }

                //~ if(tempAni!=null){
                    //~ baseBuildAnimation=upgradeStat[levelM].baseBuildAnimation;
                    //~ baseBuildAnimationBody.AddClip(baseBuildAnimation, baseBuildAnimation.name);
                //~ }
            //~ }

            tempAni=null;
            //search for base animation component
            //if there's a build animation clip
            if(upgradeStat[levelM].baseFireAnimation!=null){
                //if not on the baseObject itself
                if(upgradeStat[levelM].baseFireAnimationBody.gameObject!=upgradeStat[levelM].baseObject){
                    foreach(Transform child in baseObject.transform){
                        tempAni=(Animation)child.gameObject.GetComponent(typeof(Animation));
                        if(tempAni!=null){
                            if(tempAni.gameObject.name==upgradeStat[levelM].baseFireAnimationBody.gameObject.name){
                                baseFireAnimationBody=tempAni;
                            }
                        }
                    }
                }
                else{
                    tempAni=(Animation)baseObject.GetComponent(typeof(Animation));
                    if(tempAni!=null) baseFireAnimationBody=tempAni;
                }

                if(tempAni!=null){
                    baseFireAnimation=upgradeStat[levelM].baseFireAnimation;
                    baseFireAnimationBody.AddClip(baseFireAnimation, baseFireAnimation.name);
                }
            }
        }

        //~ if(upgradeStat[levelM].turretBuildAnimationBody!=null) turretBuildAnimationBody=upgradeStat[levelM].turretBuildAnimationBody;
        //~ if(upgradeStat[levelM].turretBuildAnimation!=null) turretBuildAnimation=upgradeStat[levelM].turretBuildAnimation;
        //~ if(upgradeStat[levelM].baseBuildAnimationBody!=null) baseBuildAnimationBody=upgradeStat[levelM].baseBuildAnimationBody;
        //~ if(upgradeStat[levelM].baseBuildAnimation!=null) baseBuildAnimation=upgradeStat[levelM].baseBuildAnimation;

        //~ if(upgradeStat[levelM].turretFireAnimationBody!=null) turretFireAnimationBody=upgradeStat[levelM].turretFireAnimationBody;
        //~ if(upgradeStat[levelM].turretFireAnimation!=null) turretFireAnimation=upgradeStat[levelM].turretFireAnimation;
        //~ if(upgradeStat[levelM].baseFireAnimationBody!=null) baseFireAnimationBody=upgradeStat[levelM].baseFireAnimationBody;
        //~ if(upgradeStat[levelM].baseFireAnimation!=null) baseFireAnimation=upgradeStat[levelM].baseFireAnimation;

        //~ if(turretBuildAnimationBody!=null && turretBuildAnimation!=null) turretBuildAnimationBody.AddClip(turretBuildAnimation, turretBuildAnimation.name);
        //~ if(baseBuildAnimationBody!=null && baseBuildAnimation!=null) baseBuildAnimationBody.AddClip(baseBuildAnimation, baseBuildAnimation.name);
        //~ if(turretFireAnimationBody!=null && turretFireAnimation!=null) turretFireAnimationBody.AddClip(turretFireAnimation, turretFireAnimation.name);
        //~ if(baseFireAnimationBody!=null && baseFireAnimation!=null) baseFireAnimationBody.AddClip(baseFireAnimation, baseFireAnimation.name);

        level+=1;

        UpdateTowerValue();
        GameControl.TowerUpgradeComplete(this);
    }
Пример #8
0
 public StatusEffects clone()
 {
     Slow slow = new Slow();
     slow.duration = this.duration;
     return slow;
 }
Пример #9
0
    public void RunEffect()
    {
        GameObject effects = GameObject.Find("Effects");

        switch (effect)
        {
        case Effects.ArmorUp:
            // less inc physical dmg
            break;

        case Effects.Burn:

            Burn burn = effects.GetComponent <Burn> ();
            damage = burn.Damage(damage, 3);
            //= damage / 3;
            burn.ApplyBurn(3, damage);
            break;

        case Effects.Bleed:
//				GameObject Bleed = GameObject.Find ("_Scripts");
            Bleed bleed = effects.GetComponent <Bleed> ();
            bleed.ApplyBleed();
            break;

        case Effects.Chill:
            // same as slow, but second proc will apply "frozen". Also apply frozen if speed = 0
            Chill chill = effects.GetComponent <Chill> ();
            chill.ApplyChill();
            break;

        case Effects.Slow:
//				GameObject Slow = GameObject.Find ("_Scripts");
            Slow slow = effects.GetComponent <Slow> ();
            slow.ApplySlow();
            break;

        case Effects.Freeze:
            // enemy will turns as long as frozen. Burn will neutralize effect. 50% less physical dmg
            Frozen frozen = effects.GetComponent <Frozen> ();
            frozen.ApplyFrozen();
            break;

        case Effects.Poison:
//				GameObject Poison = GameObject.Find ("_Scripts");
            Poison poison = effects.GetComponent <Poison> ();
            poison.damage = damage / 5;
            poison.ApplyPoison();
            break;

        case Effects.ShieldUp:
            // block next melee or ranged attack
            break;

        case Effects.SpeedUp:
            // 20% more MS
            break;

        case Effects.Stun:
//				GameObject Stun = GameObject.Find ("_Scripts");
            Stun stun = effects.GetComponent <Stun> ();
            stun.ApplyStun();
            break;

        case Effects.Blind:
            //				GameObject Stun = GameObject.Find ("_Scripts");
            Blind blind = effects.GetComponent <Blind> ();
            blind.Applyblind();
            break;

        case Effects.RemoveBleed:
            // Remove bleed stacks from target
            break;

        case Effects.MagicResUp:
            // less inc magic dmg
            break;

        case Effects.Restoration:
//				GameObject Restoration = GameObject.Find ("_Scripts");
            Restoration restoration = effects.GetComponent <Restoration> ();
            restoration.heal = healDot;
            restoration.ApplyRestoration();
            break;

        case Effects.Fly:
            // walk through objects
            break;

        case Effects.FullVision:
            // see full map
            break;

        case Effects.SharedVision:
            // all players see shared vision
            break;

        case Effects.VisionTotem:
            // tetem taht grands only vision
            break;

        case Effects.SpellTotem:
            // "playable" totem
            break;

        case Effects.Cure:
            // remove all negative effect
            break;

        case Effects.AiAlly:
            // summon AI ally
            break;

        case Effects.Empty:

            break;

        default:
            break;
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     playerRigidbody = GetComponent <Rigidbody2D>();
     animator        = GetComponent <Animator>();
     slow            = GetComponent <Slow>();
 }
Пример #11
0
 /// <summary>
 /// Returns the name of this indicator.
 /// </summary>
 /// <returns>The name of this indicator</returns>
 public override string ToString()
 {
     return("Ppo," + Fast.ToString() + "," + Slow.ToString() + "," + Smooth.ToString());
 }