Пример #1
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.summonSkeleton);
        base.Awake();
        summonWarrior = Ability.getAbility(AbilityID.summonSkeletonWarrior);
        summonMage    = Ability.getAbility(AbilityID.summonSkeletonMage);
        summonArcher  = Ability.getAbility(AbilityID.summonSkeletonArcher);
        summonWarlord = Ability.getAbility(AbilityID.summonSkeletonWarlord);
        summonBrawler = Ability.getAbility(AbilityID.summonSkeletonBrawler);

        skeletonAbilities.Add(ability);
        skeletonAbilities.Add(summonWarrior);
        skeletonAbilities.Add(summonMage);
        skeletonAbilities.Add(summonArcher);
        skeletonAbilities.Add(summonWarlord);
        skeletonAbilities.Add(summonBrawler);

        summonTracker = Comp <SummonTracker> .GetOrAdd(gameObject);

        summonTracker.newSummonEvent += onNewSummon;

        protectionClass = GetComponent <ProtectionClass>();
        if (protectionClass)
        {
            health = protectionClass.healthClass;
        }
        else
        {
            health = GetComponent <BaseHealth>();
        }
        mana = GetComponent <BaseMana>();

        statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     player = PlayerFinder.getPlayer();
     PlayerFinder.playerChangedEvent += ChangePlayer;
     if (player != null)
     {
         playerMana    = player.GetComponent <BaseMana> ();
         playerCharges = player.GetComponent <ChargeManager> ();
     }
     tooltipAbility = GetComponent <AbilityTooltip> ();
     foreach (UIBarWithMaterial bar in GetComponentsInChildren <UIBarWithMaterial>())
     {
         //if (bar.name == "CooldownBar") { bar.currentFill = bar.maxFill; }
         //else
         if (bar.name == "OutOfMana")
         {
             outOfMana = bar;
         }
     }
     foreach (Image im in GetComponentsInChildren <Image>())
     {
         if (im.name == "Sprite")
         {
             icon = im;
         }
         if (im.name == "CooldownBar")
         {
             cooldownBar = im;
         }
     }
 }
Пример #3
0
    // Use this for initialization
    void Start()
    {
        // subscribe to the new enemy hit event
        GetComponent <HitDetector>().newEnemyHitEvent += giveResources;
        // if it can damage the same enemy again also subscribe to the enemy hit again event
        if (canHitSameEnemyTwice)
        {
            GetComponent <HitDetector>().enemyHitAgainEvent += giveResources;
        }
        // get a reference to the creator's mana and protection
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            GameObject creator = references.creator;
            if (creator)
            {
                if (healthOnHit != 0 || wardOnHit != 0)
                {
                    creatorProtection = creator.GetComponent <ProtectionClass>();
                }
                if (manaOnHit != 0)
                {
                    creatorMana = creator.GetComponent <BaseMana>();
                }
            }
        }
    }
Пример #4
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.summonWraith);
        health  = GetComponent <BaseHealth>();
        mana    = GetComponent <BaseMana>();

        if (health)
        {
            statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

            tracker = Comp <SummonTracker> .GetOrAdd(gameObject);

            AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

            listener.onCritEvent += OnCrit;
        }

        // get wraith prefabs
        if (flameWraithPrefab == null)
        {
            Ability wraithAbility = Ability.getAbility(AbilityID.summonFlameWraith);
            if (wraithAbility && wraithAbility.abilityPrefab)
            {
                SummonEntityOnDeath summon = wraithAbility.abilityPrefab.GetComponent <SummonEntityOnDeath>();
                if (summon)
                {
                    flameWraithPrefab = summon.entity;
                }
            }

            wraithAbility = Ability.getAbility(AbilityID.summonPutridWraith);
            if (wraithAbility && wraithAbility.abilityPrefab)
            {
                SummonEntityOnDeath summon = wraithAbility.abilityPrefab.GetComponent <SummonEntityOnDeath>();
                if (summon)
                {
                    putridWraithPrefab = summon.entity;
                }
            }

            wraithAbility = Ability.getAbility(AbilityID.summonBloodWraith);
            if (wraithAbility && wraithAbility.abilityPrefab)
            {
                SummonEntityOnDeath summon = wraithAbility.abilityPrefab.GetComponent <SummonEntityOnDeath>();
                if (summon)
                {
                    bloodWraithPrefab = summon.entity;
                }
            }
        }

        // spirit escape prefab
        if (spiritEscapePrefab == null)
        {
            spiritEscapePrefab = PrefabList.getPrefab("spiritEscape");
        }

        base.Awake();
    }
Пример #5
0
 public void ChangePlayer(GameObject newPlayer)
 {
     player = newPlayer;
     if (player != null)
     {
         playerMana    = player.GetComponent <BaseMana> ();
         playerCharges = player.GetComponent <ChargeManager> ();
     }
 }
Пример #6
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.hammerThrow);
        base.Awake();
        mana   = GetComponent <BaseMana>();
        health = GetComponent <BaseHealth>();
        AbilityEventListener ael = AbilityEventListener.GetOrAdd(gameObject);

        ael.onHitEvent += OnHit;
    }
Пример #7
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.glacier);
        mana    = GetComponent <BaseMana>();
        AbilityEventListener eventListener = GetComponent <AbilityEventListener>();

        if (eventListener)
        {
            eventListener.onKillEvent += GainManaOnKill;
            eventListener.onHitEvent  += GainManaOnHit;
        }
        base.Awake();
    }
Пример #8
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.vengeance);
        base.Awake();
        mana   = GetComponent <BaseMana>();
        health = GetComponent <BaseHealth>();
        AbilityEventListener ael = AbilityEventListener.GetOrAdd(gameObject);

        statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

        ua = GetComponent <UsingAbility>();

        ael.onHitEvent += OnHit;
        ael.onHitEvent += OnKill;
    }
Пример #9
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.staticOrb);
        base.Awake();
        AbilityEventListener eventListener = GetComponent <AbilityEventListener>();

        if (eventListener)
        {
            eventListener.onKillEvent += OnKill;
            eventListener.onHitEvent  += OnHit;
        }
        protectionClass = GetComponent <ProtectionClass>();
        mana            = GetComponent <BaseMana>();
        usingAbility    = GetComponent <UsingAbility>();
    }
Пример #10
0
    // Use this for initialization
    void Start()
    {
        // subscribe to the new enemy hit event
        GetComponent <HitDetector>().newAllyHitEvent += giveMana;
        // get a reference to the creator's mana
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            creator = references.creator;
            if (creator)
            {
                creatorMana = creator.GetComponent <BaseMana>();
            }
        }
    }
Пример #11
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.ripBlood);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onHitEvent  += OnHit;
        listener.onKillEvent += OnKill;
        statBuffs             = Comp <StatBuffs> .GetOrAdd(gameObject);

        tracker = Comp <SummonTracker> .GetOrAdd(gameObject);

        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana      = GetComponent <BaseMana>();
        baseStats = GetComponent <BaseStats>();
        base.Awake();
    }
Пример #12
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.manaStrike);
        base.Awake();
        mana = GetComponent <BaseMana>();
        AbilityEventListener ael = GetComponent <AbilityEventListener>();

        if (ael)
        {
            ael.onHitEvent  += onHit;
            ael.onKillEvent += onKill;
            ael.onCritEvent += onCrit;
        }
        aoc = GetComponent <AbilityObjectConstructor>();
        lightningDisplacement = new Vector3(0f, 1f, 0f);
        statBuffs             = GetComponent <StatBuffs>();
        if (statBuffs == null)
        {
            statBuffs = gameObject.AddComponent <StatBuffs>();
        }
    }
    // Use this for initialization
    void Start()
    {
        // get a reference to the creator's mana and protection
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            GameObject creator = references.creator;
            if (creator)
            {
                if (health != 0 || ward != 0)
                {
                    creatorProtection = creator.GetComponent <ProtectionClass>();
                }
                if (mana != 0)
                {
                    creatorMana = creator.GetComponent <BaseMana>();
                }
            }
        }
    }
Пример #14
0
    // Use this for initialization
    void Start()
    {
        // subscribe to the new enemy hit event
        GetComponent <HitDetector>().newEnemyHitEvent += giveMana;
        // if it can damage the same enemy again also subscribe to the enemy hit again event
        if (canHitSameEnemyTwice)
        {
            GetComponent <HitDetector>().enemyHitAgainEvent += giveMana;
        }
        // get a reference to the creator's mana
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            GameObject creator = references.creator;
            if (creator)
            {
                creatorMana = creator.GetComponent <BaseMana>();
            }
        }
    }
Пример #15
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.sacrifice);
        dotTag.Add(Tags.AbilityTags.DoT);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onKillEvent += OnKill;
        BaseHealth health = GetComponent <BaseHealth>();

        if (health)
        {
            statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

            tracker = Comp <SummonTracker> .GetOrAdd(gameObject);
        }
        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana           = GetComponent <BaseMana>();
        baseStats      = GetComponent <BaseStats>();
        boneNovaOffset = new Vector3(0f, 1.2f, 0f);
        base.Awake();
    }
Пример #16
0
    // Use this for initialization
    protected override void Awake()
    {
        ability = AbilityIDList.getAbility(AbilityID.marrowShards);
        physTag.Add(Tags.AbilityTags.Physical);
        AbilityEventListener listener = Comp <AbilityEventListener> .GetOrAdd(gameObject);

        listener.onKillEvent += OnKill;
        listener.onCritEvent += OnCrit;
        health = GetComponent <BaseHealth>();
        if (health)
        {
            statBuffs = Comp <StatBuffs> .GetOrAdd(gameObject);

            tracker = Comp <SummonTracker> .GetOrAdd(gameObject);
        }
        aoc = Comp <AbilityObjectConstructor> .GetOrAdd(gameObject);

        mana               = GetComponent <BaseMana>();
        baseStats          = GetComponent <BaseStats>();
        boneNovaOffset     = new Vector3(0f, 1.2f, 0f);
        spiritEscapeOffset = new Vector3(0f, 1.1f, 0f);
        spiritEscapePrefab = PrefabList.getPrefab("spiritEscape");
        base.Awake();
    }
Пример #17
0
 // Use this for initialization
 protected override void Awake()
 {
     ability = AbilityIDList.getAbility(AbilityID.valeOrb);
     base.Awake();
     mana = GetComponent <BaseMana>();
 }
Пример #18
0
 protected override void Start()
 {
     base.Start();
     Health = new BaseHealth(MaxHealth);
     Mana   = new BaseMana(MaxMana);
 }
Пример #19
0
    void initialise()
    {
        initialised = true;
        // make sure there is a parent
        if (transform.parent == null)
        {
            return;
        }
        if (parent == null)
        {
            parent = transform.parent.gameObject;
        }
        if (parent == null)
        {
            Debug.LogError("BuffParent component has no parent"); return;
        }
        // find the parent's protection class
        parentProtection = parent.gameObject.GetComponent <ProtectionClass>();

        if (parentProtection)
        {
            if (ward != 0)
            {
                parentProtection.GainWard(ward);
            }
            if (wardPercentage != 0 && parent.GetComponent <BaseHealth>())
            {
                parentProtection.GainWard((wardPercentage * parent.GetComponent <BaseHealth>().maxHealth));
            }
        }

        if (increasedSize != 0)
        {
            SizeManager sizeManager = parent.GetComponent <SizeManager>();
            if (sizeManager)
            {
                sizeManager.increaseSize(increasedSize);
            }
        }

        // find the parent's base health
        if (lifeRegen != 0)
        {
            parentHealth = parent.GetComponent <BaseHealth>();
            parentHealth.addedHealthRegenPerSecond += lifeRegen;
        }
        // find the parent's base mana
        if (manaCostDivider != 0)
        {
            parentMana = parent.GetComponent <BaseMana>();
            parentMana.addedManaCostDivider += manaCostDivider;
        }
        // find the parent's demo ward regen
        if (wardRegen != 0)
        {
            parentProtection.wardRegen += wardRegen;
        }
        // find the parent's base stats
        if (speed != 0)
        {
            parentBaseStats = parent.GetComponent <BaseStats>();
            if (parentBaseStats != null)
            {
                parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, speed, BaseStats.ModType.ADDED);
            }
        }
        // find the parent's speed manager
        if (percentageSpeed != 0)
        {
            if (!parentBaseStats)
            {
                parentBaseStats = parent.GetComponent <BaseStats>();
            }
            parentSpeedManager = parent.GetComponent <SpeedManager>();
            if (parentSpeedManager != null && parentBaseStats != null)
            {
                parentBaseStats.ChangeStatModifier(Tags.Properties.Movespeed, percentageSpeed, BaseStats.ModType.INCREASED);
            }
        }
        if (reducedStunDuration != 0)
        {
            parentStunnedState = parent.gameObject.GetComponent <Stunned>();
            if (parentStunnedState != null)
            {
                parentStunnedState.baseStunDuration -= reducedStunDuration;
            }
        }
        // apply taggedStats
        parentBaseStats = parent.GetComponent <BaseStats>();
        if (parentBaseStats)
        {
            foreach (TaggedStatsHolder.TaggableStat stat in taggedStats)
            {
                parentBaseStats.ChangeStatModifier(stat.property, stat.addedValue, BaseStats.ModType.ADDED, stat.tagList);
                parentBaseStats.ChangeStatModifier(stat.property, stat.increasedValue, BaseStats.ModType.INCREASED, stat.tagList);
                foreach (float value in stat.moreValues)
                {
                    parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.MORE, stat.tagList);
                }
                foreach (float value in stat.quotientValues)
                {
                    parentBaseStats.ChangeStatModifier(stat.property, value, BaseStats.ModType.QUOTIENT, stat.tagList);
                }
            }
            parentBaseStats.UpdateStats();
        }

        // update protection totals
        if (parentProtection)
        {
            parentProtection.UpdateProtectionTotals();
        }
        // subscribe to a death event to remove the buffs
        if (GetComponent <SelfDestroyer>())
        {
            GetComponent <SelfDestroyer>().deathEvent += removeBuffs;
        }
    }