Beispiel #1
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>();
                }
            }
        }
    }
Beispiel #2
0
    public void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.thisAbility)
        {
            ability = references.thisAbility;
            if (transform.parent)
            {
                bool     toggleOff = false;
                Stance[] stances   = transform.parent.GetComponentsInChildren <Stance>();
                for (int i = 0; i < stances.Length; i++)
                {
                    if (stances[i].ability == ability && toggle && stances[i] != this)
                    {
                        toggleOff = true;
                    }
                    if (stances[i] != this)
                    {
                        SelfDestroyer destroyer = stances[i].GetComponent <SelfDestroyer>();
                        if (destroyer)
                        {
                            destroyer.die();
                        }
                    }
                }
                if (toggleOff)
                {
                    Comp <SelfDestroyer> .GetOrAdd(gameObject).die();
                }
            }
        }
    }
Beispiel #3
0
    public void heal(GameObject ally)
    {
        if (onlyApplyToMinionFromAbility)
        {
            if (requiredAbility == null)
            {
                return;
            }
            CreationReferences refences = ally.GetComponent <CreationReferences>();
            if (!refences)
            {
                return;
            }
            if (refences.thisAbility != requiredAbility)
            {
                return;
            }
        }

        if (ally.GetComponent <BaseHealth> () != null)
        {
            ally.GetComponent <BaseHealth>().Heal(healAmount);
            if (attachable)
            {
                Instantiate(attachable, ally.transform);
            }
        }
        else
        {
            Debug.Log("Ally " + ally.name + " has no BaseHealth class");
        }
    }
    public void createAbilityObject()
    {
        if (requireNotPartOfChain)
        {
            ChainOnHit chain = GetComponent <ChainOnHit>();
            if (chain && (chain.chainsRemaining > 0 || chain.hasChained))
            {
                return;
            }
        }


        HitDetector hitDetector = GetComponent <HitDetector>();

        if (hitDetector)
        {
            List <GameObject> enemies = new List <GameObject>();

            if (hitDetector.sharedHitDetector != null)
            {
                foreach (GameObject enemy in hitDetector.sharedHitDetector.enemiesHit)
                {
                    if (enemy != null && !enemies.Contains(enemy))
                    {
                        enemies.Add(enemy);
                    }
                }
            }
            else
            {
                foreach (GameObject enemy in hitDetector.enemiesHit)
                {
                    if (enemy != null && !enemies.Contains(enemy))
                    {
                        enemies.Add(enemy);
                    }
                }
            }



            CreationReferences references = GetComponent <CreationReferences>();
            if (references)
            {
                Vector3 startPos = references.locationCreatedFrom;

                // create the first ability object
                if (enemies.Count >= 1 && castFromCreatorToo)
                {
                    GetComponent <AbilityObjectConstructor>().constructAbilityObject(abilityToInstantiate, startPos + offset, enemies[0].transform.position + offset);
                }

                for (int i = 0; i < enemies.Count - 1; i++)
                {
                    // create the other ability objects
                    GetComponent <AbilityObjectConstructor>().constructAbilityObject(abilityToInstantiate, enemies[i].transform.position + offset, enemies[i + 1].transform.position + offset);
                }
            }
        }
    }
 public void Start()
 {
     references = GetComponent <CreationReferences>();
     if (references && references.creator)
     {
         list = references.creator.GetComponent <AbilityList>();
     }
 }
    // Use this for initialization
    public override void onCreation()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references.creator)
        {
            Apply(references.creator);
        }
    }
    public void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            creator = references.creator;
        }
    }
Beispiel #8
0
    // Use this for initialization
    void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.creator)
        {
            sendForward(references.creator);
        }
    }
Beispiel #9
0
    public void preApplyDamage(GameObject enemy)
    {
        CreationReferences references = enemy.GetComponent <CreationReferences>();

        if (references && references.creator && myReferences && references.creator == myReferences.creator)
        {
            applyDamage(enemy); return;
        }
    }
Beispiel #10
0
    // Use this for initialization
    void Start()
    {
        mutatorManager      = GetComponent <AbilityMutatorManager>();
        myAlignmentManager  = GetComponent <AlignmentManager>();
        myTaggedStatsHolder = GetComponent <TaggedStatsHolder>();

        myCreationReferences = GetComponent <CreationReferences>();
        myHitDetector        = GetComponent <HitDetector>();
    }
    // Use this for initialization
    public void OnDestroy()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references.creator)
        {
            Apply(references.creator);
        }
    }
Beispiel #12
0
 void Start()
 {
     references = GetComponent <CreationReferences>();
     dying      = GetComponent <Dying>();
     if (dying)
     {
         dying.deathEvent += OnDeath;
     }
 }
Beispiel #13
0
    // Use this for initialization
    void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references)
        {
            creator = references.creator;
        }
        mover = GetComponent <AbilityMover>();
    }
 // Use this for initialization
 void Start()
 {
     baseLocalScaleZ = transform.localScale.z;
     references      = GetComponentInParent <CreationReferences>();
     if (references)
     {
         locationCreatedFrom = references.locationCreatedFrom;
         locationFound       = true;
     }
 }
Beispiel #15
0
    public void destroyIfHitCreatorMinion(GameObject hitObject)
    {
        CreationReferences references   = hitObject.GetComponent <CreationReferences>();
        CreationReferences myReferences = GetComponent <CreationReferences>();

        if (references && references.creator && myReferences && references.creator == myReferences.creator)
        {
            DestroyOnFailingToPierce(hitObject); return;
        }
    }
Beispiel #16
0
 void Start()
 {
     hitDetector  = GetComponent <HitDetector>();
     myReferences = GetComponent <CreationReferences>();
     if (hitDetector)
     {
         // subscribe to the new ally hit event
         hitDetector.newAllyHitEvent += createAbilityObjectIfNeeded;
     }
 }
    public void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.creator)
        {
            health = references.creator.GetComponent <BaseHealth>();
            ua     = references.creator.GetComponent <UsingAbility>();
            ua.usedAbilityManaEvent += dealDamage;
        }
    }
Beispiel #18
0
 public void Start()
 {
     references = GetComponent <CreationReferences>();
     if (references && references.creator)
     {
         usingAbility = references.creator.GetComponent <UsingAbility>();
         if (usingAbility)
         {
             usingAbility.usedAbilityManaEvent += destroyThis;
         }
     }
 }
 // Use this for initialization
 void Start()
 {
     baseLocalScaleZ = transform.localScale.z;
     references      = GetComponentInParent <CreationReferences>();
     if (references)
     {
         creator = references.creator; if (stretchToCastPointInstead)
         {
             sm = creator.GetComponent <SizeManager>();
         }
     }
 }
Beispiel #20
0
    // Use this for initialization
    void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.creator)
        {
            usingAbility = references.creator.GetComponent <UsingAbility>();
            if (usingAbility)
            {
                usingAbility.channelEndEvent += DestroyThis;
            }
        }
    }
    public void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.creator)
        {
            BaseHealth health = references.creator.GetComponent <BaseHealth>();
            if (health)
            {
                health.HealthDamage(flatDamage);
                health.HealthDamage(health.currentHealth * percentCurrentHealthTaken);
            }
        }
    }
Beispiel #22
0
    public void createAbilityObjectIfNeeded(GameObject ally)
    {
        if (!onlyHitCreatorMinions)
        {
            createAbilityObject(ally); return;
        }

        CreationReferences references = ally.GetComponent <CreationReferences>();

        if (references && references.creator && myReferences && references.creator == myReferences.creator)
        {
            createAbilityObject(ally); return;
        }
    }
    // Use this for initialization
    void Start()
    {
        CreationReferences references = GetComponent <CreationReferences>();

        if (references && references.creator)
        {
            creatorProtection = references.creator.GetComponent <ProtectionClass>();
        }
        if (creatorProtection)
        {
            applied = true;
            Apply(creatorProtection);
        }
    }
 // Use this for initialization
 void Start()
 {
     hitDetector  = GetComponent <HitDetector>();
     myReferences = GetComponent <CreationReferences>();
     if (hitDetector)
     {
         // subscribe to the new ally hit event
         hitDetector.newAllyHitEvent += preApplyDamage;
         // if it can damage the same ally again also subscribe to the ally hit again event
         if (canDamageSameAllyAgain)
         {
             hitDetector.allyHitAgainEvent += preApplyDamage;
         }
     }
 }
 public void Start()
 {
     if (creationReferencesObject)
     {
         CreationReferences references     = creationReferencesObject.GetComponent <CreationReferences>();
         ParticleSystem     particleSystem = GetComponent <ParticleSystem>();
         if (references && references.creator && particleSystem)
         {
             ActorModelManager amm = references.creator.GetComponent <ActorModelManager>();
             if (amm)
             {
                 amm.applyParticlesToBody(particleSystem);
             }
         }
     }
 }
Beispiel #26
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>();
            }
        }
    }
Beispiel #27
0
 public void Start()
 {
     if (newMaterial != null)
     {
         CreationReferences references = GetComponent <CreationReferences>();
         if (references && references.creator)
         {
             amm = references.creator.GetComponent <ActorModelManager>();
             if (amm && amm.body)
             {
                 oldMaterial       = amm.body.material;
                 amm.body.material = newMaterial;
             }
         }
     }
 }
Beispiel #28
0
    // I'm working Jerle!
    void Start()
    {
        // subscribe to the new enemy hit event
        GetComponent <HitDetector>().newAllyHitEvent += Apply;
        // if it can hit the same ally again also subscribe to the ally hit again event
        if (canApplyToSameAllyAgain)
        {
            GetComponent <HitDetector>().allyHitAgainEvent += Apply;
        }

        // only get references if needed
        if (onlyApplyToCreatorsMinions)
        {
            myReferences = GetComponent <CreationReferences>();
        }
    }
    public void applyDamage(GameObject enemy)
    {
        ProtectionClass enemyProtection = enemy.GetComponent <ProtectionClass>();

        if (enemyProtection)
        {
            List <HitEvents> hitEvents = enemyProtection.ApplyDamage(damageStats, gameObject);
            // react to the hit events
            CreationReferences references = GetComponent <CreationReferences>();
            if (references && references.creator && references.creator.GetComponent <AbilityEventListener>())
            {
                // get event listeners
                AbilityEventListener parentEventsListener = references.creator.GetComponent <AbilityEventListener>();
                AbilityEventListener localEventsListener  = GetComponent <AbilityEventListener>();
                // call event methods
                if (hitEvents.Contains(HitEvents.Hit))
                {
                    parentEventsListener.HitEvent(references.thisAbility, enemy);
                    if (localEventsListener)
                    {
                        localEventsListener.HitEvent(references.thisAbility, enemy);
                    }
                }
                if (hitEvents.Contains(HitEvents.Crit))
                {
                    parentEventsListener.CritEvent(references.thisAbility, enemy);
                    if (localEventsListener)
                    {
                        localEventsListener.CritEvent(references.thisAbility, enemy);
                    }
                }
                if (hitEvents.Contains(HitEvents.Kill))
                {
                    parentEventsListener.KillEvent(references.thisAbility, enemy);
                    if (localEventsListener)
                    {
                        localEventsListener.KillEvent(references.thisAbility, enemy);
                    }
                }
            }
        }
        else
        {
            Debug.LogError("Enemy " + enemy.name + " has no protection class");
        }
    }
Beispiel #30
0
    public void OnKill(Ability _ability, GameObject target)
    {
        // health on minion kill
        CreationReferences refs = target.GetComponent <CreationReferences>();

        if (refs && refs.creator == gameObject && health)
        {
            health.Heal(healthGainedOnMinionKill);
        }

        // leech on kill
        if (statBuffs)
        {
            statBuffs.addBuff(4f, Tags.Properties.PercentLifeLeech, 0, physLeechOnKill, null, null, physTag, "marrow shards phys leech on kill buff");
            statBuffs.addBuff(4f, Tags.Properties.CriticalChance, 0, critChanceOnKill, null, null, physTag, "marrow shards crit chance on kill buff");
        }
    }