Example #1
0
        protected void OnHit()
        {
            // Loop through all the OnHitEffects that are specified in the associated Tower's Weapon data.
            OnHitEffects.ForEach(x =>
            {
                EffectController effectController = null;

                if (x.AreaOfEffect == 0f)
                {
                    switch (x.Type)
                    {
                    case EffectType.Damage: effectController = EffectController.Create <EffectDamage>(x.Identity, Target); break;

                    case EffectType.Slow: effectController = EffectController.Create <EffectSlow>(x.Identity, Target); break;
                    }
                }
                else
                {
                    switch (x.Type)
                    {
                    case EffectType.Damage: effectController = EffectControllerMulti.Create <EffectDamage>(TargetsInRange(x.AreaOfEffect)); break;

                    case EffectType.Slow: effectController = EffectControllerMulti.Create <EffectSlow>(TargetsInRange(x.AreaOfEffect)); break;
                    }
                }

                effectController.SetSource(cachedPosition);
                effectController.SetEffectData(x);
                effectController.SetParams(x);
                effectController.ApplyEffect();
            });
        }
Example #2
0
 // Use this for initialization
 void Start()
 {
     myFacing       = Pathfinding.Direction.South;
     currHP         = maxHP;
     currMP         = maxMP;
     aStar          = GameObject.FindGameObjectWithTag("A*");
     battleGrid     = aStar.GetComponent <AStarGrid>().battleGrid;
     onHitManager   = GameObject.FindGameObjectWithTag("GameManager").GetComponent <OnHitEffects>();
     selector       = GameObject.FindGameObjectWithTag("GameManager").GetComponent <SelectionManager>();
     unitAttackMenu = GameObject.FindGameObjectWithTag("AttackMenu").GetComponent <AttackMenuScript>();
 }
Example #3
0
 private void Awake()
 {
     // Assure that the object can be destroyed if has to be created again later.
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Example #4
0
    /* @brief Opens the editor window for the On Hit Effects object.
     * @param The script that will be read from for properties (OnHitEffects).
     */
    public static void Open(OnHitEffects _dataObject)
    {
        OnHitEffectEditorWindow window = GetWindow <OnHitEffectEditorWindow>("On Hit Effect Editor");

        window.serializedObject = new SerializedObject(_dataObject);
    }