예제 #1
0
    //--method--
    //初期化に必要な処理を集めたメソッド
    public void FirstInitializeCard(cardColor color, int cardNumber, CardManager manager)
    {
        //位置や引数の代入
        _parent                 = manager;
        _originPosition         = transform.localPosition;
        transform.localPosition = _parent.transform.localPosition;
        _cardState              = cardState.stop;
        InitializeCardParam(color, cardNumber);
        //変数の初期化
        _rectTransform = GetComponent <RectTransform>();
        _cardSize      = _rectTransform.sizeDelta;
        _dead          = false;
        _cardText      = GetComponentInChildren <Text>();
        _cardImage     = GetComponent <Image>();
        _cardRect      = new Rect(0, 0, 0, 0);
        _insFireworks  = FindObjectOfType <InstanceFirework>();
        //色と数値テキストの変更
        ChangeCardColor();
        _cardText.text = _cardParam.StateNumber.ToString();
        //ショットエリアの矩形エリア情報を取得
        RectTransform rt = ShotArea.GetComponent <RectTransform>();
        float         x  = ShotArea.transform.localPosition.x - rt.sizeDelta.x / 2;
        float         y  = ShotArea.transform.localPosition.y - rt.sizeDelta.y / 2;

        _shotAreaRect = new Rect(x, y, rt.sizeDelta.x, rt.sizeDelta.y);
    }
예제 #2
0
    public void ColorSetup(ParticleSystem sys, cardColor color)
    {
        //色専用の変数
        Gradient grad = new Gradient();

        //カードの色によって分ける
        switch (color)
        {
        case cardColor.red:
            grad.SetKeys(
                new GradientColorKey[] {
                new GradientColorKey(Color.gray, 0.0f),
                new GradientColorKey(Color.red, 0.5f),
                new GradientColorKey(Color.gray, 1.0f)
            },
                new GradientAlphaKey[] {
                new GradientAlphaKey(0.2f, 0.0f),
                new GradientAlphaKey(1.0f, 1f)
            }
                );
            break;

        case cardColor.green:
            grad.SetKeys(
                new GradientColorKey[] {
                new GradientColorKey(Color.gray, 0.0f),
                new GradientColorKey(Color.green, 0.5f),
                new GradientColorKey(Color.gray, 1.0f)
            },
                new GradientAlphaKey[] {
                new GradientAlphaKey(0.2f, 0.0f),
                new GradientAlphaKey(1.0f, 1f)
            }
                );
            break;

        case cardColor.yellow:
            grad.SetKeys(
                new GradientColorKey[] {
                new GradientColorKey(Color.gray, 0.0f),
                new GradientColorKey(Color.yellow, 0.5f),
                new GradientColorKey(Color.gray, 1.0f)
            },
                new GradientAlphaKey[] {
                new GradientAlphaKey(0.2f, 0.0f),
                new GradientAlphaKey(1.0f, 1f)
            }
                );
            break;
        }
        var col = sys.colorOverLifetime;

        col.color = grad;
    }
예제 #3
0
 public void InitializeCard(cardColor color, int cardNumber)
 {
     //位置や引数の代入
     transform.localPosition = _parent.transform.localPosition;
     MoveStart();
     InitializeCardParam(color, cardNumber);
     //変数の初期化
     _dead = false;
     //色と数値テキストの変更
     ChangeCardColor();
     _cardText.text = _cardParam.StateNumber.ToString();
 }
예제 #4
0
    //カードの初期化関数
    void ResetCard(int suffix, bool first)
    {
        cardColor color      = (cardColor)Enum.ToObject(typeof(cardColor), Rand(0, CARD_COLOR_MAX));
        int       cardNumber = Rand(1, CARD_NUM_MAX);

        if (first)
        {
            _cards[suffix].FirstInitializeCard(color, cardNumber, this);
        }
        else
        {
            _cards[suffix].InitializeCard(color, cardNumber);
        }
    }
예제 #5
0
    public IEnumerator FireWorksSetup(Vector3 pos, cardColor col, float time)
    {
        yield return(new WaitForSeconds(time));

        //生成
        pos.x += Screen.width / 2;
        pos   *= 0.1f;
        pos.z  = 65;
        GameObject obj = (GameObject)Instantiate(_prefab, pos, Quaternion.Euler(0, -90, 0));
        //パーティクルを再生する
        ParticleSystem sys = obj.transform.Find("Start").GetComponent <ParticleSystem>();

        ParticleAction(() => {
            sys.Simulate(2.5f, true, false);
            sys.Play();
        });
        //色を変更
        ColorSetup(sys.transform.Find("Exprosion/Trail").GetComponent <ParticleSystem>(), col);
    }
예제 #6
0
    public void Instance(Vector3 pos, int cardPower, cardColor color)
    {
        if (cardPower > 2)
        {
            switch (GameManager.Instance.ComboCount)
            {
            default:
            case 0:
                StartCoroutine(FireWorksSetup(pos, color, 0));
                break;

            case 1:
            case 2:
                StartCoroutine(FireWorksSetup(pos, color, 0));
                pos.x += 5;
                StartCoroutine(FireWorksSetup(pos, color, 1));
                break;

            case 3:
            case 4:
            case 5:
            case 6:
                float interval = 100f;
                for (int i = 0; i < 3; i++)
                {
                    StartCoroutine(FireWorksSetup(pos, color, 0));
                    pos.x += interval;
                }
                pos.x -= interval / 2;
                for (int i = 0; i < 3; i++)
                {
                    StartCoroutine(FireWorksSetup(pos, color, 1));
                    pos.x -= interval;
                }
                break;
            }
        }
        else
        {
            StartCoroutine(FireWorksSetup(pos, color, 0));
        }
    }
예제 #7
0
 //---constract---
 public CardParam(cardColor color, int num)
 {
     _cardColor = color;
     _num       = num;
 }
예제 #8
0
 //カード情報の初期化
 public void InitializeCardParam(cardColor color, int num)
 {
     _cardParam = new CardParam(color, num);
 }
예제 #9
0
    public bool setCard(cardColor color, int num)
    {
        if (num <= 0 || num > 15)
        {
            return(false);
        }

        /* _numPosition = m_num.GetComponent<Transform>();
         * _colorPosition = m_color.GetComponent<Transform>();
         * _numSprite = m_num.GetComponent<UISprite>();
         * _colorSprite = m_color.GetComponent<UISprite>();
         * if (num < 13)
         * {
         *
         *  _numPosition.position = new Vector2(_numPositionX1, _numPositionY1);
         *  _colorPosition.position = new Vector2(_colorPositionX1,_colorPositionY1);
         *  _numSprite.width = _numWidth1;
         *  _numSprite.height = _numHeight1;
         * }
         * else
         * {
         *   _numPosition.position = new Vector2(_numPosition.position.x, _numPositionY2);
         *   _colorPosition.position = new Vector2(_colorPosition.position.x, _colorPositionY2);
         *   _numSprite.width = _numWidth2;
         *   _numSprite.height = _numHeight2;
         * }
         * */
        string tmpC  = null;
        bool   isRed = true;

        switch (color)
        {
        case cardColor.HONGTAO:
            tmpC = "hongtao";
            break;

        case cardColor.HEITAO:
            isRed = false;
            tmpC  = "heitao";
            break;

        case cardColor.FANGKUI:
            tmpC = "fangkuai";
            break;

        case cardColor.MEIHUA:
            isRed = false;
            tmpC  = "meihua";
            break;

        case cardColor.XIAOWANG:
            tmpC = "xiaowang";
            break;

        case cardColor.DAWANG:
            tmpC = "dawang";
            break;

        default:
            return(false);
        }
        m_color.GetComponent <UISprite>().spriteName = tmpC;
        _color = color;
        string tmpN = null;

        /*switch(num)
         * {
         *  case cardNum.ONE:
         *      tmpN = "1";
         *      break;
         *  case cardNum.TWO:
         *      tmpN = "2";
         *      break;
         *  case cardNum.THREE:
         *      tmpN = "3";
         *      break;
         *  case cardNum.FOUR:
         *      tmpN = "4";
         *      break;
         *  case cardNum.FIVE:
         *      tmpN = "5";
         *      break;
         *  case cardNum.SIX:
         *      tmpN = "6";
         *      break;
         *  case cardNum.SEVEN:
         *      tmpN = "7";
         *      break;
         *  case cardNum.EIGHT:
         *      tmpN = "8";
         *      break;
         *  case cardNum.NINE:
         *      tmpN = "9";
         *      break;
         *  case cardNum.TEN:
         *      tmpN = "10";
         *      break;
         *  case cardNum.ELEVEN:
         *      tmpN = "11";
         *      break;
         *  case cardNum.TWELVE:
         *      tmpN = "12";
         *      break;
         *  case cardNum.THIRTEEN:
         *      tmpN = "13";
         *      break;
         *  case cardNum.FOURTEEN:
         *      tmpN = "14";
         *      break;
         *  case cardNum.FIFTEEN:
         *      tmpN = "15";
         *      break;
         *  default:
         *      return false;
         * }*/
        if (!isRed)
        {
            tmpN += 'h';
        }
        tmpN += num.ToString();

        m_num.GetComponent <UISprite>().spriteName = tmpN;
        _num = num;
        return(true);
    }