示例#1
0
        static HSVType RGB_To_HSV(RGBType rgb)
        {
            float r = (float)rgb.R / 255;
            float g = (float)rgb.G / 255;
            float b = (float)rgb.B / 255;
            float v, x, f;

            HSVType hsv;
            int     i;

            x = Math.Min(r, Math.Min(g, b));
            v = Math.Max(r, Math.Max(g, b));

            if (v == x)
            {
                hsv.H = -1;
                hsv.S = 0;
                hsv.V = v;
                return(hsv);
            }

            f = (r == x) ? g - b : ((g == x) ? b - r : r - g);
            i = (r == x) ? 3 : ((g == x) ? 5 : 1);

            hsv.H = i - f / (v - x);
            hsv.S = (v - x) / v;
            hsv.V = v;
            return(hsv);
        }
示例#2
0
    public void SetColor(RGBType rgbType)
    {
        if (image == null)
        {
            return;
        }

        switch (rgbType)
        {
        case RGBType.Red:
        {
            image.color = Color.red;
        } break;

        case RGBType.Green:
        {
            image.color = Color.green;
        }
        break;

        case RGBType.Blue:
        {
            image.color = Color.blue;
        }
        break;

        default:
        {
            image.color = Color.black;
        } break;
        }
    }
示例#3
0
 public void Initialize(Transform targetTr, DropItemType itemType, RGBType rgbType)
 {
     this.rgbType                 = rgbType;
     this.transform.parent        = targetTr;
     this.transform.localPosition = Vector3.up * 0.7f;
     this.itemType                = itemType;
     ChangeColor(rgbType);
     ChangeSprite(itemType);
 }
示例#4
0
 private void ChangeAllPlatform(RGBType rgbType)
 {
     if (platformPool == null)
     {
         return;
     }
     for (int i = 0; i < platformPool.Datas.Count; i++)
     {
         platformPool.Datas[i].Initialize(rgbType);
     }
 }
示例#5
0
 public void CountPlatform(RGBType type)
 {
     if (platformData == null)
     {
         return;
     }
     if (platformData.ContainsKey(type) == false)
     {
         return;
     }
     platformData[type].AddCount();
 }
示例#6
0
    public void StartBrushMode(RGBType rgbType)
    {
        SoundManager.Instance.PlaySoundEffect("Magic");

        //중복 진입시
        if (isBrushMode == true)
        {
            EndBrushMode();
        }

        isBrushMode = true;
        brushType   = rgbType;
        ChangeAllPlatform(rgbType);
    }
示例#7
0
    public void SpawnDropItem(DropItemType dropItemType, Transform targetPlatform, RGBType rgbType = RGBType.End)
    {
        if (dropItemPool == null)
        {
            return;
        }
        DropItem item = dropItemPool.GetItem();

        if (item != null)
        {
            item.Initialize(targetPlatform, dropItemType, rgbType);
        }

#if UNITY_EDITOR
        Debug.Log("DropItem생성");
#endif
    }
示例#8
0
    private void SetLayerAndSprite(RGBType rgbType)
    {
#if UNITY_EDITOR
        // rgbType = RGBType.All;
#endif

        Color targetColor = Color.black;
        int   layerMask   = LayerMask.NameToLayer(LayerName.All);

        switch (rgbType)
        {
        case RGBType.Red:
        {
            targetColor = Color.red;
            layerMask   = LayerMask.NameToLayer(LayerName.Red);
        }
        break;

        case RGBType.Green:
        {
            targetColor = Color.green;
            layerMask   = LayerMask.NameToLayer(LayerName.Green);
        }
        break;

        case RGBType.Blue:
        {
            targetColor = Color.blue;
            layerMask   = LayerMask.NameToLayer(LayerName.Blue);
        }
        break;
        }



        if (spriteRenderer != null)
        {
            spriteRenderer.color = targetColor;
        }

        if (centerTile != null)
        {
            centerTile.gameObject.layer = layerMask;
        }
    }
示例#9
0
    public void B_ButtonClick()
    {
        nowRGBType = RGBType.Blue;

        this.gameObject.layer = LayerMask.NameToLayer(LayerName.Blue);

        // if (colorFrame != null)
        //  colorFrame.SetColor(RGBType.Blue);

        if (jumpFunc != null)
        {
            jumpFunc.Invoke();
        }

        if (characterView != null)
        {
            characterView.ChangeColor(Color.blue);
        }
    }
示例#10
0
    private void ChangeColor(RGBType rgbType)
    {
        if (spriteRenderer == null)
        {
            return;
        }

        Color color;

        switch (rgbType)
        {
        case RGBType.Red:
        {
            color = Color.red;
        }
        break;

        case RGBType.Green:
        {
            color = Color.green;
        }
        break;

        case RGBType.Blue:
        {
            color = Color.blue;
        }
        break;

        default:
        {
            color = Color.white;
        }
        break;
        }

        spriteRenderer.color = color;
    }
示例#11
0
    public void Initialize(RGBType rgbType)
    {
        switch (rgbType)
        {
        case RGBType.Red:
        {
            color.color = redColor;
        } break;

        case RGBType.Green:
        {
            color.color = greenColor;
        } break;

        case RGBType.Blue:
        {
            color.color = blueColor;
        } break;
        }


        Invoke("EffectOff", lifeTime);
    }
示例#12
0
    public void ReportSocialPlatformData(RGBType rgbType, int value)
    {
        switch (rgbType)
        {
        case RGBType.Red:
        {
            PlayGamesPlatform.Instance.IncrementAchievement(GPGSIds.achievement_character_devil, value, null);
        }
        break;

        case RGBType.Green:
        {
            PlayGamesPlatform.Instance.IncrementAchievement(GPGSIds.achievement_character_greenman, value, null);
        }
        break;

        case RGBType.Blue:
        {
            PlayGamesPlatform.Instance.IncrementAchievement(GPGSIds.achievement_character_bluealien, value, null);
        }
        break;
        }
    }
示例#13
0
    public void MakeNextPlatform()
    {
        Vector2 posit = Vector2.zero;

        RGBType rgbType = (RGBType)Random.Range((int)RGBType.Red, (int)RGBType.End);

        if (lastPlatForm != null)
        {
            float x = Random.Range(columns.LeftTr.position.x + 0.5f, columns.RightTr.position.x - 0.5f);
            float y = lastPlatForm.CenterTile.transform.position.y + Random.Range(intervalMin, intervalMax);

            posit.Set(x, y);
        }

        Platform targetPlatform = platformPool.GetItem();

        if (targetPlatform != null)
        {
            //맨처음 발판
            if (posit == Vector2.zero)
            {
                rgbType = RGBType.All;
            }

            //브러쉬 모드
            if (isBrushMode == true)
            {
                targetPlatform.Initialize(brushType);
                brushPlatformMakeCount++;
                if (brushPlatformMakeCount >= ItemData.BrushPlatformMakeNum)
                {
                    EndBrushMode();
                }
            }
            //일반모드
            else
            {
                targetPlatform.Initialize(rgbType);
            }



            targetPlatform.SetProperties(playerTr, this);
            targetPlatform.transform.position = posit;

            #region PlatformType
            //이동발판
            if (MyUtil.GetPercentageResult(movePlatformProbability) == true)
            {
                targetPlatform.SetPlatformType(PlatformType.HorizontalMove);
            }
            #endregion



            #region ItemMake


            //발판에 아이템 생성
            if (MyUtil.GetPercentageResult(Probabilities.WingSpawnProbabiliy) == true &&
                rgbType != RGBType.All)
            {
                objectMaker.SpawnDropItem(DropItemType.Wing, targetPlatform.transform);
            }

            if (MyUtil.GetPercentageResult(Probabilities.BrushSpawnProbability) &&
                rgbType != RGBType.All &&
                isBrushMode == false)
            {
                objectMaker.SpawnDropItem(DropItemType.Brush, targetPlatform.transform, rgbType);
            }

            #endregion


            lastPlatForm = targetPlatform;
        }
    }
示例#14
0
 public void Initialize(RGBType rgbType)
 {
     SetLayerAndSprite(rgbType);
 }