Esempio n. 1
0
        public void StandardDamageWorks()
        {
            var source       = Build(Characters.Skeleton, 1);
            var target       = Build(Characters.Zombie, 2);
            int healthBefore = target.Health.CurrentValue;
            var command      = AppliedEffects[AppliedEffect.StandardDamage](source, target);

            // TODO: Check specifics of the command object
            Assert.NotNull(command);
            Assert.True(target.Health.CurrentValue < healthBefore);
        }
Esempio n. 2
0
 public void Reset()
 {
     Current       = null;
     HasHit        = false;
     HasZeroHealth = false;
     AppliedEffects.Clear();
     SkillEntries.Clear();
 }
        // TODO: Return collection of render commands
        // TODO: Add try/catch statement?
        public RenderQueueEntry[] Execute(Actor source, IEnumerable <Actor> friendlyParty, IEnumerable <Actor> enemyParty)
        {
            var rqes = new List <RenderQueueEntry>();

            var playerReadyEntry = new RenderQueueEntry()
            {
                TargetCardIds = new[] { source.CardId },
                Animation     = "ReadyAttack"
            };

            rqes.Add(playerReadyEntry);

            var targetIds = new List <short>();

            foreach (var effect in Effects)
            {
                var newTargets = Targeters[effect.Targeter](friendlyParty, enemyParty);

                foreach (var newTarget in newTargets)
                {
                    if (newTarget != null)
                    {
                        targetIds.Add(AppliedEffects[effect.AppliedEffect](source, newTarget));
                    }
                }

                var newRQE = new RenderQueueEntry()
                {
                    TargetCardIds = targetIds.ToArray(),
                    Animation     = effect.Animation
                };

                rqes.Add(newRQE);
            }

            return(rqes.ToArray());
        }
Esempio n. 4
0
    // Update is called once per frame
    void LateUpdate()
    {
        lr.SetPosition(0, transform.position);
        lr.SetPosition(1, transform.position + (transform.forward * 5000));
        RaycastHit[] hits;
        hits = Physics.RaycastAll(transform.position, transform.forward, 500f);
        for (int i = 0; i < hits.Length; i++)
        {
            if (hits[i].collider)
            {
                //Debug.Log(i + ", " + hits[i].transform.name);
                if (hits[i].transform.CompareTag("Enemy"))
                {
                    if (currentPen > 0)
                    {
                        currentPen -= 1;
                        AppliedEffects effects = hits[i].transform.GetComponent <AppliedEffects>();

                        if (effects.BurningEffect == null)
                        {
                            effects.BurningEffect = Instantiate(effect, hits[i].point, Quaternion.identity) as GameObject;
                            //sweffects.BurningEffect.GetComponent<EffectDuration>().PlayerStats = Weapon.PlayerStats;
                            effects.BurningEffect.transform.rotation = Quaternion.LookRotation(hits[i].transform.forward);
                            effects.BurningEffect.transform.SetParent(hits[i].transform);
                        }

                        hits[i].transform.GetComponent <EnemyHealthManager>().RemoveHealth(Damage * Time.deltaTime);
                    }
                    else
                    {
                        currentPen = enemyPen;
                        break;
                    }
                }
                else if (!hits[i].transform.CompareTag("Weapon"))
                {
                    lr.SetPosition(1, hits[i].point);
                    currentPen = enemyPen;
                }
            }
            else
            {
                currentPen = enemyPen;
            }
        }
    }
Esempio n. 5
0
    private void OnCollisionEnter(Collision other)
    {
        ContactPoint contact = other.contacts[0];
        Quaternion   rot     = Quaternion.FromToRotation(Vector3.up, contact.normal);;
        Vector3      pos     = contact.point;

        if (other.collider.CompareTag("Laser"))
        {
            Physics.IgnoreCollision(GetComponent <Collider>(), other.collider, true);
        }

        if (other.collider.CompareTag("Untagged") || other.collider.CompareTag("MapObject"))
        {
            if (hitVFX != null)
            {
                Instantiate(hitVFX, pos, rot);
            }
            Destroy(gameObject);
        }


        if (CanHitEnemy)
        {
            if (other.collider.CompareTag("Enemy"))
            {
                other.gameObject.GetComponent <EnemyHealthManager>().RemoveHealth(Damage);

                if (enemyHitVFX != null)
                {
                    Instantiate(enemyHitVFX, pos, rot);
                }

                if (applyBurnEffect)
                {
                    AppliedEffects effects = other.gameObject.GetComponent <AppliedEffects>();
                    if (effects.BurningEffect == null)
                    {
                        effects.BurningEffect = Instantiate(effect, pos, Quaternion.identity) as GameObject;
                        //effects.BurningEffect.GetComponent<EffectDuration>().PlayerStats = _weapon.PlayerStats;
                        effects.BurningEffect.transform.rotation = Quaternion.LookRotation(other.transform.forward);
                        effects.BurningEffect.transform.SetParent(other.transform);
                    }
                }

                Destroy(gameObject);
            }
        }

        if (CanHitPlayer)
        {
            if (other.collider.CompareTag("Player"))
            {
                if (enemyHitVFX != null)
                {
                    Instantiate(enemyHitVFX, pos, rot);
                }

                other.gameObject.GetComponent <PlayerHealth>().RemoveHealth(Damage);
                Destroy(gameObject);
            }
        }
    }
Esempio n. 6
0
 public Affectable()
 {
     Effects = new AppliedEffects(this);
 }
Esempio n. 7
0
 public void AddEffectEntry(Effect entry)
 {
     AppliedEffects.Add(entry);
 }