コード例 #1
0
    private void MakeBadEmotionObject(int count, EmotionScale scale, int idx = 0)
    {
        for (int i = 0; i < count; i++)
        {
            EmotionObject newEmotionObject = Instantiate(badEmotionObjectPrefab);
            newEmotionObject.emotionType = EmotionType.BAD;
            newEmotionObject.spawnerIdx  = idx;

            switch (scale)
            {
            case EmotionScale.ONE:
                newEmotionObject.emotionScale = EmotionScale.ONE;
                _stack_BadOneEmotionObejct.Push(newEmotionObject);
                break;

            case EmotionScale.TWO:
                newEmotionObject.emotionScale = EmotionScale.TWO;
                _stack_BadTwoEmotionObejct.Push(newEmotionObject);
                break;

            case EmotionScale.THREE:
                newEmotionObject.emotionScale = EmotionScale.THREE;
                _stack_BadThreeEmotionObejct.Push(newEmotionObject);
                break;

            case EmotionScale.FOUR:
                newEmotionObject.emotionScale = EmotionScale.FOUR;
                _stack_BadFourEmotionObejct.Push(newEmotionObject);
                break;

            case EmotionScale.FIVE:
                newEmotionObject.emotionScale = EmotionScale.FIVE;
                _stack_BadFiveEmotionObejct.Push(newEmotionObject);
                break;
            }

            newEmotionObject.transform.SetParent(badEmotionObjectParent.transform);
            newEmotionObject.gameObject.SetActive(false);
        }
    }
コード例 #2
0
    public EmotionObject GetBadEmotionObject(EmotionScale scale, int idx)
    {
        EmotionObject emotionObject = null;

        int len = 0;

        switch (scale)
        {
        case EmotionScale.ONE:
            len = _stack_BadOneEmotionObejct.Count;

            if (len == 0)
            {
                MakeBadEmotionObject(1, EmotionScale.ONE, idx);
            }

            emotionObject = _stack_BadOneEmotionObejct.Pop();
            break;

        case EmotionScale.TWO:
            len = _stack_BadTwoEmotionObejct.Count;

            if (len == 0)
            {
                MakeBadEmotionObject(1, EmotionScale.TWO, idx);
            }

            emotionObject = _stack_BadTwoEmotionObejct.Pop();
            break;

        case EmotionScale.THREE:
            len = _stack_BadThreeEmotionObejct.Count;

            if (len == 0)
            {
                MakeBadEmotionObject(1, EmotionScale.THREE, idx);
            }

            emotionObject = _stack_BadThreeEmotionObejct.Pop();
            break;

        case EmotionScale.FOUR:
            len = _stack_BadFourEmotionObejct.Count;

            if (len == 0)
            {
                MakeBadEmotionObject(1, EmotionScale.FOUR, idx);
            }

            emotionObject = _stack_BadFourEmotionObejct.Pop();
            break;

        case EmotionScale.FIVE:
            len = _stack_BadFiveEmotionObejct.Count;

            if (len == 0)
            {
                MakeBadEmotionObject(1, EmotionScale.FIVE, idx);
            }

            emotionObject = _stack_BadFiveEmotionObejct.Pop();
            break;
        }

        return(emotionObject);
    }