예제 #1
0
    private void applySpell(spellType spell, float default_damage)
    {
        if (spell == weakSpellType)
        {
            float weakDamage = weaknessDamageFactor * default_damage;
            health -= weakDamage;

            //Vector3 dmgPopupPos = transform.position + new Vector3(0, 0.5f, 0);
            Vector3    dmgPopupPos = transform.position;
            GameObject dmgPopup    = Instantiate(damagePopup, dmgPopupPos, transform.rotation);
            dmgPopup.GetComponent <DamagePopup>().Setup(weakDamage);
        }
        else if (spell == resistedSpellType)
        {
            float resistDamage = resistedDamageFactor * default_damage;
            health -= resistDamage;

            //Vector3 dmgPopupPos = transform.position + new Vector3(0, 0.5f, 0);
            Vector3    dmgPopupPos = transform.position;
            GameObject dmgPopup    = Instantiate(damagePopup, dmgPopupPos, transform.rotation);
            dmgPopup.GetComponent <DamagePopup>().Setup(resistDamage);
        }
        else if (spell != immuneSpellType)
        {
            health -= default_damage;

            //Vector3 dmgPopupPos = transform.position + new Vector3(0, 0.5f, 0);
            Vector3    dmgPopupPos = transform.position;
            GameObject dmgPopup    = Instantiate(damagePopup, dmgPopupPos, transform.rotation);
            dmgPopup.GetComponent <DamagePopup>().Setup(default_damage);
        }
        else if (spell == immuneSpellType)
        {
            //Vector3 dmgPopupPos = transform.position + new Vector3(0, 0.5f, 0);
            Vector3    dmgPopupPos = transform.position;
            GameObject dmgPopup    = Instantiate(damagePopup, dmgPopupPos, transform.rotation);
            dmgPopup.GetComponent <DamagePopup>().Setup(0);
        }

        if (health <= 0)
        {
            switch (enemyId)
            {
            case 1:
                FindObjectOfType <AudioManager>().Play("SlimeDeath");
                break;

            case 2:
                FindObjectOfType <AudioManager>().Play("SkeletonDeath");
                break;
            }

            Destroy(gameObject);
        }
    }
예제 #2
0
    public void SpellConstructor(int itemId, string spellName, Sprite spellIcon, spellType spelltype,
                                 spellEffect spelleffect, GameObject prefab, Sprite animation)
    {
        id             = itemId;
        this.spellName = spellName;
        icon           = spellIcon;
        this.prefab    = prefab;
        this.animation = animation;
        _spelltype     = spelltype;
        _spelleffect   = spelleffect;

        // Essential parameters each new spell needs
    }
예제 #3
0
 public Card(string crdName, GameObject crdImage, string crdEffect, cardType crdType, cardAttribute crdAttribute, monsterType monType, spellType spType, trapType tpType, int monAttack, int monDefense, cardState crdState, string crdOwner)
 {
     cardName        = crdName;
     cardImage       = crdImage;
     cardEffect      = crdEffect;
     myCardType      = crdType;
     myCardAttribute = crdAttribute;
     myMonsterType   = monType;
     mySpellType     = spType;
     myTrapType      = tpType;
     monsterAttack   = monAttack;
     monsterDefense  = monDefense;
     myCardState     = crdState;
     cardOwner       = crdOwner;
 }
예제 #4
0
 void ChangeSpell()
 {
     if (Input.GetKey("q") || OVRInput.GetDown(OVRInput.Button.One))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell                 = Instantiate(fireSpellPrefab);
         currentSpellType         = spellType.FIRE;
         spell                    = newSpell;
         spell.transform.rotation = gameObject.transform.rotation;
         spell.transform.parent   = gameObject.transform;
         print("destroyed");
     }
     else if (Input.GetKey("w") || OVRInput.GetDown(OVRInput.Button.Two))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell                 = Instantiate(frostSpellPrefab);
         currentSpellType         = spellType.FROST;
         spell                    = newSpell;
         spell.transform.rotation = gameObject.transform.rotation;
         spell.transform.parent   = gameObject.transform;
         print("destroyed");
     }
     else if (Input.GetKey("e") || OVRInput.GetDown(OVRInput.RawButton.RHandTrigger))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell                 = Instantiate(arcaneSpellPrefab);
         currentSpellType         = spellType.ARCANE;
         spell                    = newSpell;
         spell.transform.rotation = gameObject.transform.rotation;
         spell.transform.parent   = gameObject.transform;
         print("destroyed");
     }
 }
    public void Update()
    {
        //get input
        if (Input.GetMouseButtonDown(0))
        {
            if (AttackingIsRunning == false)
            {
                StartCoroutine(Attacking());
            }
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            spell++;
            if (spell == spellType.CYCLE)
            {
                spell = 0;
            }
        }
    }
예제 #6
0
    public override void DrawSpellProperties(Rect viewRect)
    {
        base.DrawSpellProperties(viewRect);

        GUILayout.BeginVertical();
        spellName = EditorGUILayout.TextField("Spell name: ", spellName);

        sType = (spellType)EditorGUILayout.EnumPopup("Type:", sType);

        EditorGUILayout.LabelField("Avatar : ");
        avatarSprite = (Sprite)EditorGUILayout.ObjectField(avatarSprite, typeof(Sprite), GUILayout.Width(75), GUILayout.Height(75));

        tooltip     = EditorGUILayout.TextArea(tooltip, GUILayout.Height(50));
        cost        = EditorGUILayout.IntField("Cout : ", cost);
        attackPower = EditorGUILayout.IntField("Attack Power : ", attackPower);
        magicPower  = EditorGUILayout.IntField("Magic power : ", magicPower);
        average     = EditorGUILayout.IntField("Average : ", average);
        idSpecial   = EditorGUILayout.IntField("Special ID : ", idSpecial);

        GUILayout.EndVertical();
    }
예제 #7
0
    public GameObject[] GetPrefab(spellType type)
    {
        GameObject[] tab = new GameObject[2];
        
        switch (type)
        {
			case spellType.ELEMENT:
                tab[0] = elementPrefab;
				break;
			case spellType.PLANTE:
                tab[0] = plantePrefab;
				break;
			case spellType.PLANTE2:
                tab[0] = plante2Prefab;
				break;
			case spellType.BUISSON:
                tab[0] = buissonPrefab;
				break;
            case spellType.ROCK:
                tab[0] = rockPrefab;
                break;
            case spellType.TREE:
                tab[0] = treePrefab;
                break;
			case spellType.ARTIFICE:
                tab[0] = artificePrefab;
				break;
			case spellType.PAPILLON:
                tab[0] = papillonPrefab;
				break;
			case spellType.LUCIOLE:
                tab[0] = luciolePrefab;
				break;
			case spellType.OISEAUX:
                tab[0] = birdPrefab;
				break;
        }

        return tab;
    }
예제 #8
0
 void ChangeSpell(AiCube aiCube)
 {
     if (aiCube.cubeType == AiCube.AiCubeType.Fire)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(fireSpellPrefab);
         currentSpellType = spellType.FIRE;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
     else if (aiCube.cubeType == AiCube.AiCubeType.Frost)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(frostSpellPrefab);
         currentSpellType = spellType.FROST;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
     else if (aiCube.cubeType == AiCube.AiCubeType.Arcane)
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(arcaneSpellPrefab);
         currentSpellType = spellType.ARCANE;
         spell            = newSpell;
         spell.gameObject.transform.position = gameObject.transform.position;
         print("destroyed");
     }
 }
예제 #9
0
 void ChangeSpell()
 {
     if (Input.GetKey("q") || OVRInput.GetDown(OVRInput.Button.One))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(fireSpellPrefab);
         currentSpellType = spellType.FIRE;
         spell            = newSpell;
         print("destroyed");
     }
     else if (Input.GetKey("w"))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(frostSpellPrefab);
         currentSpellType = spellType.FROST;
         spell            = newSpell;
         print("destroyed");
     }
     else if (Input.GetKey("e"))
     {
         if (spell != null)
         {
             Destroy(spell);
         }
         newSpell         = Instantiate(arcaneSpellPrefab);
         currentSpellType = spellType.ARCANE;
         spell            = newSpell;
         print("destroyed");
     }
 }
예제 #10
0
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {

            healObj.SetActive(false);
        }
        else if (_spell == spellType.active_spell)
        {
            //teleport
        }
        else if (_spell == spellType.passive_spell)
        {

        }
        else if (_spell == spellType.ultimate_spell)
        {
            Debug.Log("end");
            myUltiCamera.removeUltimate();
            isInUltimate = false;
            enemy.GetComponent<CharacterBase>().setisInUltimate(false);
            myUltimatePS.Stop();
            enemy.GetComponent<CharacterBase>().TakesDamage(ultimateDamage);
            //ultimateTextAnimator.enabled = false;

        }
    }
예제 #11
0
    IEnumerator startSpell(spellType _spell,float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (characterSelectManager.selectedCharacter == (int)characterSelectManager.mage.Inferno)
        {
            if (_spell == spellType.armor_spell)
            {
                isKnockBack = true;
                myArmorPS.Stop();
            }
            else if (_spell == spellType.active_spell)
            {
                //defFactor = 1;//reset
            }
            else if (_spell == spellType.passive_spell)
            {
                //defFactor = 1;//reset
            }
        }
        else if (characterSelectManager.selectedCharacter == (int)characterSelectManager.mage.Pristine)
        {
            if (_spell == spellType.armor_spell)
            {
                defFactor = 1;//reset
            }
            else if (_spell == spellType.passive_spell)
            {
                //defFactor = 1;//reset
            }
        }
        else if (characterSelectManager.selectedCharacter == (int)characterSelectManager.mage.Radiance)
        {
            if (_spell == spellType.armor_spell)
            {
                defFactor = 1;//reset
            }
            else if (_spell == spellType.passive_spell)
            {
                //defFactor = 1;//reset
            }
        }
    }
예제 #12
0
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {
            isKnockBack = true;
            myArmorPS.Stop();
        }
        else if (_spell == spellType.active_spell)
        {
            normalSpeed = normalSpeed / 2;
            myActivePS.enableEmission = false;
        }
        else if (_spell == spellType.passive_spell)
        {

        }
        else if(_spell == spellType.ultimate_spell)
        {
            Debug.Log("end");
            myUltiCamera.removeUltimate();
            isInUltimate = false;
            enemy.GetComponent<CharacterBase>().setisInUltimate(false);
            myUltimatePS.Stop();
            enemy.GetComponent<CharacterBase>().TakesDamage(ultimateDamage);
            //ultimateTextAnimator.enabled = false;

        }
    }
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {
            canCastSpell[0] = true;
            defFactor = 1.0f;
            iceArmorObj.SetActive(false);
            transmitParticleSystem(true, false, false, false, false);
        }
        else if (_spell == spellType.active_spell)
        {
            //return enemy speed to normal speed
            isFreeze = false;
            transmitFreeze(isFreeze);

            //enemy.GetComponent<CharacterBaseNetwork>().setSpeed(1.0f);
           // freezeEffect.SetActive(false);

        }
        else if (_spell == spellType.passive_spell)
        {
            transmitspellCoolDownRate(1);
            //enemy.GetComponent<CharacterBaseNetwork>().setSpellCoolDownRate(1);//return enemy spell cooldown to normal rate
        }
        else if (_spell == spellType.ultimate_spell)
        {
            isInUltimate = false;

            myserverLogic.setisInUltimateServer(false);
            myUltiCamera.removeUltimate();

            transmitUltimate(false, true);
            enemy.GetComponent<CharacterBaseNetwork>().TakesDamage(ultimateDamage);

        }
    }
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {
            healObj.SetActive(false);
            transmitParticleSystem(true, false, false, false, false);
        }
        else if (_spell == spellType.active_spell)
        {
          //teleport
        }
        else if (_spell == spellType.passive_spell)
        {

        }
        else if (_spell == spellType.ultimate_spell)
        {

            isInUltimate = false;
            myserverLogic.setisInUltimateServer(false);
            myUltiCamera.removeUltimate();

            //enemy.GetComponent<CharacterBase>().setisInUltimate(false);
            //myUltimatePS.Stop();

            transmitUltimate(false, true);
            enemy.GetComponent<CharacterBaseNetwork>().TakesDamage(ultimateDamage);

        }
    }
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {
            isKnockBack = true;

            myArmorPS.Stop();
            transmitParticleSystem(true, false, false, false, false);
        }
        else if (_spell == spellType.active_spell)
        {
            normalSpeed = normalSpeed / 2;
            myActivePS.enableEmission = false;
            transmitParticleSystem(false, true, false, false, false);
        }
        else if (_spell == spellType.passive_spell)
        {

        }
        else if (_spell == spellType.ultimate_spell)
        {
            isInUltimate = false;

            myserverLogic.setisInUltimateServer(false);
            myUltiCamera.removeUltimate();
            //enemy.GetComponent<CharacterBase>().setisInUltimate(false);
            //myUltimatePS.Stop();

            transmitUltimate(false, true);
            enemy.GetComponent<CharacterBaseNetwork>().TakesDamage(ultimateDamage);

        }
    }
예제 #16
0
    IEnumerator spellDurationTimer(spellType _spell, float timeTaken)
    {
        yield return new WaitForSeconds(timeTaken);

        if (_spell == spellType.armor_spell)
        {
            canCastSpell[0] = true;
            defFactor = defFactor - 1.0f;
            iceArmorObj.SetActive(false);
        }
        else if (_spell == spellType.active_spell)
        {
            //return enemy speed to normal speed
            enemy.GetComponent<CharacterBase>().setSpeed(2.0f);
            freezeEffect.SetActive(false);

        }
        else if (_spell == spellType.passive_spell)
        {
            enemy.GetComponent<CharacterBase>().setSpellCoolDownRate(1);//return enemy spell cooldown to normal rate
        }
        else if (_spell == spellType.ultimate_spell)
        {

            myUltiCamera.removeUltimate();
            isInUltimate = false;
            enemy.GetComponent<CharacterBase>().setisInUltimate(false);
            myUltimatePS.Stop();
            enemy.GetComponent<CharacterBase>().TakesDamage(ultimateDamage);
         //   ultimateTextAnimator.enabled = false;

        }
    }