コード例 #1
0
ファイル: DataParser.cs プロジェクト: irispon/RandomDiceCopy
    public void EnemyParse()
    {
        string      sql        = "SELECT*FROM Enemy ";
        IDataReader dataReader = DBManager.GetInstance().DataBaseRead(sql);
        EnemyCache  enemyCache = EnemyCache.GetInstance();

        while (dataReader.Read())
        {
            string spritePath = string.Empty;
            spritePath = dataReader.GetString(0);

            if (Application.platform == RuntimePlatform.Android)
            {
                spritePath = spritePath.Replace("./Assets/Resources/", "").Replace(".png", "");
                Sprite sprite = Resources.Load <Sprite>(spritePath);
                enemyCache.normalEnemies.Add(sprite);
            }
            else
            {
                Sprite sprite = SpriteLoader.LoadNewSprite(spritePath);
                enemyCache.normalEnemies.Add(sprite);
            }
        }


        sql        = "SELECT*FROM Boss";
        dataReader = DBManager.GetInstance().DataBaseRead(sql);

        while (dataReader.Read())
        {
            Enemy boss = new Enemy();

            string spritePath = string.Empty;
            string name       = dataReader.GetString(0);
            spritePath = dataReader.GetString(1);

            enemyCache.bosses.Add(name, boss);
            boss.speed = dataReader.GetFloat(2);
            //    Debug.Log(dataReader.GetFloat(2));
            boss.hp = dataReader.GetInt32(4);
            Sprite sprite;

            if (Application.platform == RuntimePlatform.Android)
            {
                spritePath = spritePath.Replace("./Assets/Resources/", "").Replace(".png", "");
                sprite     = Resources.Load <Sprite>(spritePath);
            }
            else
            {
                sprite = SpriteLoader.LoadNewSprite(spritePath);
            }


            boss.sprite = sprite;
            boss.maxHp  = boss.hp;
        }
    }
コード例 #2
0
ファイル: Spwan.cs プロジェクト: irispon/RandomDiceCopy
    /// <summary>
    /// 적 스텟 범위
    /// </summary>



    public void Start()
    {
        child        = GetComponent <PoolChild>();
        destinations = new Queue <Vector3>();
        destinations.Enqueue(board.SecondVertex());
        destinations.Enqueue(board.ThirdVertex());
        destinations.Enqueue(board.FourthVertex());
        StageManager.GetInstance().Join(this);
        enemyHp    = new Vector2(60, 200);
        enemySpeed = new Vector2(3f, 5f);
        enemyCache = EnemyCache.GetInstance();
        StartCoroutine(SpwanMonster());
    }