Пример #1
0
    //uses the physics clock, so it should be stable across all platforms
    void OnTriggerStay(Collider other)
    {
        if (GameManager.state != GameManager.GameState.running)
        {
            return;
        }

        if (other.gameObject.tag == "explosion")
        {
            Explosion explo     = other.gameObject.GetComponent <Explosion>();
            Element   exploElem = explo.ExploElem;

            if (explo.ApplyAilment)
            {
                ailmentType atype = Reference.elements[exploElem].ailment;
                addAilment(atype, 0); //TODO always level 0
            }

            float damageMult = 1;
            if (Reference.elements[element].weakness.Contains(exploElem)) //it is my weakness
            {
                damageMult = 2;
            }
            health -= Projectile.projData[exploElem].damage * damageMult;
        }
    }
Пример #2
0
 public Ailment(ailmentType type, int level)
 {
     this.type  = type;
     this.level = level;
     lifeTimer  = new Stopwatch();
     lifeTime   = ailmentData[type][level].duration;
 }
Пример #3
0
    public GameObject CreateAilParticle(ailmentType atype)
    {
        GameObject ret = ailPools[(int)atype].PoolCreate();

        ret.SetActive(true);
        ret.transform.rotation = ailPrefabs[(int)atype].transform.rotation;
        return(ret);
    }
Пример #4
0
    private void removeAilment(ailmentType atype)
    {
        ailments.Remove(atype);
        deactiveDelegates[(int)atype](atype, this);

        //remove particle
        GameObject part = particles[atype];

        ParticleManager.Instance.ReleaseAilParticle(atype, part);
        particles.Remove(atype);
    }
Пример #5
0
 public ElementAttributes(HashSet <Element> weakness,
                          HashSet <Element> strength,
                          HashSet <Element> creates,
                          ailmentType ailment,
                          Material mat)
 {
     this.weakness = weakness;
     this.strength = strength;
     this.creates  = creates;
     this.ailment  = ailment;
     this.mat      = mat;
 }
Пример #6
0
    private void addAilment(ailmentType atype, int level)
    {
        if (!ailments.ContainsKey(atype))
        {
            ailments.Add(atype, new Ailment(atype, level)); //TODO level 1 always so dont need to update
            activeDelegates[(int)atype](ailments[atype], this);
            ailments[atype].RestartClock();

            //add the particle
            GameObject part = ParticleManager.Instance.CreateAilParticle(atype);
            part.transform.position = transform.position;
            part.transform.parent   = transform;
            particles.Add(atype, part);
        }
        else if (Ailment.resetTimer.Contains(atype)) //if it already contains and needs timer reset
        {
            ailments[atype].RestartClock();
        }
    }
Пример #7
0
 private static void CutDe(ailmentType a, Enemy e)
 {
     e.health = e.health * Ailment.ailmentData[a][0].effectMult;
 }
Пример #8
0
 private static void DamDe(ailmentType a, Enemy e)
 {
     RecalculateAilSpeedMult(e);
 }
Пример #9
0
 private static void BurnDe(ailmentType a, Enemy e)
 {
     e.burnClock.Reset();
 }
Пример #10
0
 public void ReleaseAilParticle(ailmentType atype, GameObject prefab)
 {
     prefab.SetActive(false);
     ailPools[(int)atype].PoolRelease(prefab);
 }