Пример #1
0
    public ParticleSystem InitializeParticles(Attacks.AttackType elemtype, Vector3 startpos)
    {
        ParticleSystem tempEnemy = null;

        if (ObjectPool.Instance.HasParticle(elemtype))
        {
            tempEnemy = ObjectPool.Instance.DepoolParticle(elemtype);
            // tempBullet.gameObject.transform.position = startpos;
        }
        else
        {
            switch (elemtype)
            {
            case Attacks.AttackType.Melee:
                tempEnemy = GameObject.Instantiate(melee).GetComponent <ParticleSystem>();
                break;

            case Attacks.AttackType.Ranged:
                tempEnemy = GameObject.Instantiate(ranged).GetComponent <ParticleSystem>();
                break;

            case Attacks.AttackType.AoE:
                tempEnemy = GameObject.Instantiate(aoe).GetComponent <ParticleSystem>();
                break;
            }
        }
        tempEnemy.gameObject.transform.position = startpos;
        tempEnemy.gameObject.transform.parent   = ParticlesParent.transform;

        tempEnemy.gameObject.SetActive(true);
        return(tempEnemy);
    }
Пример #2
0
    public void BugFinished(ParticleSystem enemy)
    {
        //bool bugKilled = false;
        //enemy.transform.position = enemy.transform.position;
        //bugKilled = enemy.DoKillBug();
        //if(bugKilled)
        if (particleList.Contains(enemy))
        {
            particleList.Remove(enemy);
            enemy.gameObject.SetActive(false);
            Attacks.AttackType attackType = Attacks.AttackType.Melee;
            switch (enemy.gameObject.name[0])
            {
            case 'M':
                attackType = Attacks.AttackType.Melee;
                break;

            case 'R':
                attackType = Attacks.AttackType.Ranged;
                break;

            case 'A':
                attackType = Attacks.AttackType.AoE;
                break;
            }
            ObjectPool.Instance.PoolParticle(attackType, enemy);
        }
    }
Пример #3
0
    public void CreateParticle(Attacks.AttackType atkType, Attacks.AtkDefElement elemType, Vector3 startPos)
    {
        ParticleSystem p = Factory.Instance.InitializeParticles(atkType, startPos);

        if (atkType == Attacks.AttackType.Ranged)
        {
            var rend = p.GetComponent <Renderer>();
            rend.material.SetVector("_Color", RPSEnemy.RPSColors[(int)elemType] / 2 * 3f);
            rend.material.SetVector("_EmissionColor", RPSEnemy.RPSColors[(int)elemType] * 3f);
        }
        else if (atkType == Attacks.AttackType.AoE)
        {
            var childPart     = p.transform.Find("Embers").GetComponent <ParticleSystem>();
            var childPartMain = childPart.main;
            childPartMain.startColor = RPSEnemy.RPSColors[(int)elemType];
            var rends = p.transform.GetComponentsInChildren <Renderer>();
            for (int i = 0; i < rends.Length; i++)
            {
                rends[i].material.SetVector("_Color", RPSEnemy.RPSColors[(int)elemType] / 2 * 3f);
            }
        }
        else if (atkType == Attacks.AttackType.Melee)
        {
            var rend = p.GetComponent <Renderer>();
            for (int i = 0; i < rend.materials.Length; i++)
            {
                rend.materials[i].SetVector("_Color", RPSEnemy.RPSColors[(int)elemType] / 2 * 3f);
            }
            //p.GetComponentInChildren<Renderer>().material.SetVector("_Color", RPSEnemy.RPSColors[(int)elemType] * 2f);
        }
        p.Play();
        particleList.Add(p);
    }
Пример #4
0
    public void DoDamage(float dmg, Attacks.AttackType atkType, Attacks.AtkDefElement playerElement, Moveonterrain player = null)
    {
        int   atkMultiplier = 0;
        float playerMult    = 1;

        if (player != null)
        {
            playerMult = player.AttackDmgMults[(int)atkType, (int)playerElement];
        }
        switch (atkType)
        {
        case Attacks.AttackType.AoE:
            atkMultiplier = 1;
            break;

        case Attacks.AttackType.Ranged:
            atkMultiplier = 3;
            break;

        case Attacks.AttackType.Melee:
            atkMultiplier = 5;
            break;
        }
        hp -= dmg * atkMultiplier * playerMult;

        if (hp < 1)
        {
            isAlive = false;
        }
    }
Пример #5
0
 public void PoolParticle(Attacks.AttackType elemtype, ParticleSystem particle)
 {
     if (!ParticlePool.ContainsKey(elemtype))
     {
         ParticlePool.Add(elemtype, new Queue <ParticleSystem>());
     }
     ParticlePool[elemtype].Enqueue(particle);
 }
Пример #6
0
 public void CalculateXPDamage(int XPMult, Attacks.AtkDefElement affectedElement, Attacks.AttackType atkType)
 {
     XP[(int)affectedElement] += XPGainAmt[(int)atkType, (int)affectedElement] * XPMult;
     for (int i = 0; i < 3; i++)
     {
         Mathf.Clamp(XP[i], 0, XPLevelThreshold[i] + 27);
     }
 }
Пример #7
0
 public ParticleSystem DepoolParticle(Attacks.AttackType elemtype)
 {
     if (ParticlePool.ContainsKey(elemtype))
     {
         if (ParticlePool[elemtype].Count > 0)
         {
             return(ParticlePool[elemtype].Dequeue());
         }
     }
     return(null);
 }
Пример #8
0
 public bool HasParticle(Attacks.AttackType elemtype)
 {
     if (ParticlePool.ContainsKey(elemtype))
     {
         if (ParticlePool[elemtype].Count > 0)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #9
0
    public void DoDefense(int defenseMode, RPSEnemy source, Attacks.AtkDefElement attackingElement, Attacks.AttackType atkType)
    {
        int XPMult = 2;

        if (defenseMode == 1)      // Good Defense
        {
            XPMult = -1;
            switch (defenseType)
            {
            case DefenseType.Dmg:
                source.hp -= dmgValue * 5;
                break;

            case DefenseType.DrainHP:
                hp        += dmgValue * 3;
                source.hp -= dmgValue * 3;
                break;

            case DefenseType.BolsterAtk:
                if (dmgValue < 20)
                {
                    dmgValue *= 2;
                }
                break;
            }
        }
        else if (defenseMode == 0)
        {
            XPMult = 4;
            switch (defenseType)
            {
            case DefenseType.Dmg:
                hp -= dmgValue * 5;
                break;

            case DefenseType.DrainHP:
                hp        -= dmgValue * 3;
                source.hp += dmgValue * 3;
                break;

            case DefenseType.BolsterAtk:
                if (dmgValue > float.MinValue)
                {
                    dmgValue /= 2;
                }
                break;
            }
        }

        if (source.CompareTag("Player"))
        {
            source.GetComponent <Moveonterrain>().CalculateXPDamage(XPMult, attackingElement, atkType);
        }
        else
        {
            Debug.Log("PAJWO");
        }
    }