Exemple #1
0
        public void InitSpell(float healPerTickMult, int amnOfTicks, GameObject caster, Vector3?fieldCenter = null, Vector3?fieldSizeHalfExtents = null)
        {
            this.caster     = caster;
            this.amnOfTicks = amnOfTicks;

            if (fieldCenter.HasValue)
            {
                this.fieldCenter = fieldCenter.Value;
            }
            if (fieldSizeHalfExtents.HasValue)
            {
                this.fieldSizeHalfExtents = fieldSizeHalfExtents.Value;
            }

            healFieldGraphic.localScale = this.fieldSizeHalfExtents * 2;

            var fieldEffectShape = healFieldEffect.shape;

            fieldEffectShape.scale = new Vector2(this.fieldSizeHalfExtents.x, this.fieldSizeHalfExtents.z);

            actualHealPerTick = (int)Math.Round(avgHealPerTick * healPerTickMult);

            colliderHits = new Collider[maxHealTargets];

            boxEntitiesGetter =
                new GetEntitiesInBox <IHealable>(entitiesLayerMask, fieldCenter.HasValue ? fieldCenter.Value : transform.position,
                                                 fieldSizeHalfExtents.HasValue ? fieldSizeHalfExtents.Value : transform.position);
            noCasterEntitiesExtractor = new GetEntitiesWithoutCaster <IHealable>();

            InitTimer();
        }
        public void Init(int actualSwDamage, Vector3 swExtents, Element spellElement, GameObject caster,
                         LayerMask entitiesLayerMask, ref Collider[] colliderHits)
        {
            this.colliderHits = colliderHits;

            this.actualSwDamage = actualSwDamage;
            this.caster         = caster;
            this.swExtents      = swExtents;
            this.spellElement   = spellElement;

            Material graphMat = graphics.material;

            Color swColor = spellElement.ElementColor;

            graphMat.color = new Color(swColor.r, swColor.g, swColor.b, graphMat.color.a);

            noCasterEntitiesExtractor = new GetEntitiesWithoutCaster <IDamageable>();
            boxEntitiesGetter         = new GetEntitiesInBox <IDamageable>(entitiesLayerMask, transform.position, swExtents);

            ProcessShockwave();
        }
Exemple #3
0
 private void Awake()
 {
     removalProcessor          = GetComponent <IRemovalProcessor>();
     noCasterEntitiesExtractor = new GetEntitiesWithoutCaster <IDamageable>();
 }