Beispiel #1
0
 void OnChangeMagicView(_Magic magic, bool success)
 {
     Invoke("DestroyRuneCompoView", 1);
     if (!success)
     {
         Debug.Log("Magic fail");
     }
     else
     {
         if (magic.prefab == null)
         {
             Debug.Log("Magic prefab null");
         }
         else
         {
             _presentMagic = magic;
             magicPrefab   = Instantiate(Resources.Load(magic.prefab) as GameObject,
                                         transform.position, Quaternion.identity);
             // isatt bool값을 매직 프리팹이나 json 에서 불러와야됨
             magicPrefab.transform.parent = gameObject.transform;
             magicPrefab.AddComponent <BoxCollider2D>();
             magicPrefab.transform.localScale += new Vector3(0.1F, 0, 0);
             Debug.Log("magicPrefab startposition:" + magicPrefab.transform.position);
             StartCoroutine(hitting(magicPrefab, enmMask));
         }
     }
 }
Beispiel #2
0
 void OnSpellMagic(_Magic magic)
 {
     _presentMagic = magic;
     magicPrefab   = Instantiate(Resources.Load(magic.prefab) as GameObject,
                                 transform.position, Quaternion.identity);
     magicPrefab.transform.parent = gameObject.transform;
     magicPrefab.AddComponent <BoxCollider2D>();
     StartCoroutine(hitting(magicPrefab, plyMask));
 }
Beispiel #3
0
    void OnHitMagic(_Magic prMagic, GameObject beatObj, GameObject hitObj)
    {
        Player beater = beatObj.GetComponent <Player>();
        int    deal   = (int)(beater.dmg * (1.0 + player.mdDmg));

        _health -= deal;
        // GetComponent<Animator>(); ....
        // dmg 공식 int dmg
        // health -= dmg;
    }
Beispiel #4
0
    void presentEnemy()     // 단순하게  고쳐라
    {
        string          filepath = Application.dataPath + "/rune31/Scripts/GameData/";
        List <_Dungeon> dungeon;

        dungeon = JsonConvert.DeserializeObject <_Dungeons>(File.ReadAllText(filepath + "DungeonData.json")).Dungeons;
        if (dungeon[0].enemy[areanum.ToString()] == null)
        {
            Destroy(gameObject);
        }
        else
        {
            AddEnemy();
            //Debug.Log("in Enemy"+enmTotalPool.totalPool.Keys.Count);
            _presentEnemy = enmTotalPool.totalPool[dungeon[0].enemy[areanum.ToString()]];

            List <_Magic> inhQuery =
                (from mgc in mgcTotalPool.totalList
                 where mgc.name == _presentEnemy.magic
                 select mgc).ToList();

            Debug.Log("in Enemy inhQuery" + "\n" + inhQuery.Count);

            if (inhQuery.Count != 0)
            {
                _inherentMagic = inhQuery[0];
            }

            _enemyImg = Resources.Load(String.Format("{0}", _presentEnemy.prefab), typeof(Sprite)) as Sprite;
            GetComponent <SpriteRenderer>().sprite = _enemyImg;

            _magicPenetration = _presentEnemy.magicPenetration;
            _magicResistance  = _presentEnemy.magicResistance;
            _health           = _presentEnemy.health;
            _attDmg           = _presentEnemy.attackDmg;
            _attRate          = _presentEnemy.attackRate;
            _mgcCool          = _presentEnemy.mgcCool;
            _maxDrop          = _presentEnemy.maxDrop;
            _reward           = _presentEnemy.reward;
        }
    }
Beispiel #5
0
 void OnMagicHit(_Magic prMagic, GameObject beatObj, GameObject hitObj)
 {
 }
Beispiel #6
0
    //이것도 magicspace 를 다른 클래스로 저장해놓고 이벤트로 고친다?
    IEnumerator MakeMagic()
    {
        bool isMagic = false;

        _chant = 0;
        if (isMagic)
        {
            yield return(new WaitForSeconds(1.0f));
        }

        else
        {
            if ((magicSpace["Forme_Rune"] != null) & (magicSpace.ContainsKey("Forme_Rune")))
            {
                if (avaMagic.ContainsKey(magicSpace["Forme_Rune"].name))
                {
                    string forme = magicSpace["Forme_Rune"].name;
                    if ((magicSpace["Element_Rune"] != null) & (magicSpace.ContainsKey("Element_Rune")))                    // magic element 쪽에 null dict 으로 만들면 안됨. 혹은 코드추가해야됨.
                    {
                        if (avaMagic[forme].ContainsKey(magicSpace["Element_Rune"].name))
                        {
                            isMagic = true;
                            string element = magicSpace["Element_Rune"].name;
                            if ((magicSpace["Cast_Rune"] != null) & (magicSpace.ContainsKey("Cast_Rune")))
                            {
                                if (avaMagic[forme][element].ContainsKey(magicSpace["Cast_Rune"].name))
                                {
                                    string cast = magicSpace["Cast_Rune"].name;
                                    _presentMagic = avaMagic[forme][element][cast];
                                    Debug.Log("chant magic :" + _presentMagic.name);
                                    OnChangeMagicView(_presentMagic, true);
                                    _chant = 0;
                                    magicSpace["Forme_Rune"]   = default(Rune);
                                    magicSpace["Element_Rune"] = default(Rune);
                                    magicSpace["Cast_Rune"]    = default(Rune);
                                    yield return(new WaitForSeconds(1.0f));
                                }
                                else
                                {
                                    _presentMagic = avaMagic[forme][element]["Rho"];
                                    Debug.Log("chant magic :" + _presentMagic.name);
                                    OnChangeMagicView(_presentMagic, true);
                                    _chant = 0;
                                    magicSpace["Forme_Rune"]   = default(Rune);
                                    magicSpace["Element_Rune"] = default(Rune);
                                    magicSpace["Cast_Rune"]    = default(Rune);
                                    yield return(new WaitForSeconds(1.0f));
                                }
                            }
                            else
                            {
                                Debug.Log("need Cast");
                                yield return(new WaitForSeconds(1.0f));
                            }
                        }
                        else
                        {
                            Debug.Log("err by element" + magicSpace["Element_Rune"].name);
                            OnChangeMagicView(null, false);
                            chant = 0;
                            magicSpace["Forme_Rune"]   = default(Rune);
                            magicSpace["Element_Rune"] = default(Rune);
                            magicSpace["Cast_Rune"]    = default(Rune);
                            yield return(new WaitForSeconds(1.0f));
                        }
                    }
                    else
                    {
                        Debug.Log("need element");
                        yield return(new WaitForSeconds(1.0f));
                    }
                }
                else
                {
                    Debug.Log("u dont have this forme");
                    yield return(new WaitForSeconds(1.0f));
                }
            }
            else
            {
                Debug.Log("need forme");
                yield return(new WaitForSeconds(1.0f));
            }
        }
    }