public Color get_color(BALLTYPE i)
    {
        switch (i)
        {
        case BALLTYPE.RED:
            return(Color.red);

        case BALLTYPE.GREEN:
            return(Color.green);

        case BALLTYPE.BLUE:
            return(Color.blue);

        case BALLTYPE.YELLOW:
            return(Color.yellow);

        case BALLTYPE.CYAN:
            return(Color.cyan);

        case BALLTYPE.MAGENTA:
            return(Color.magenta);

        case BALLTYPE.BOMB:
            return(Color.white);

        case BALLTYPE.LASTONE:
            return(new Color(1, 1, 1, 0.5f));

        default:
            return(Color.white);
        }
    }
    // Use this for initialization
    void Start()
    {
        if (BCLlist == null)
        {
            BCLlist = new List <BubbleColorLine> ();
        }
        if (BallsColorLine == null)
        {
            BallsColorLine = MapGenerator.mapGenerator.mCurrentLevelData.BallsColorLine;
        }

        n    = BCLlist.Count;
        name = "BallsLine+" + n;
        BCLlist.Add(this);

        this.transform.localPosition = new Vector3(13.45f, (14.5f - n * 2.22f), -4f);
        spriteRenderer = GetComponent <SpriteRenderer> ();
        type           = BALLTYPE.LASTONE;
        setColor();

        if (BallsColorLine.Count == n + 1)
        {
            ResetAll();
        }
    }
 public CellBall(BALLTYPE type, bool basic, int armor)
 {
     this.position = Vector3.zero;
     this.type     = type;
     this.basic    = basic;
     this.armor    = armor;
     this.frozen   = false;
 }
    void Prev()
    {
        if (type == BALLTYPE.RED)
        {
            type = BALLTYPE.LASTONE;
        }
        else
        {
            type--;
        }

        setColor();
    }
    void Next()
    {
        if (type == BALLTYPE.LASTONE)
        {
            type = BALLTYPE.RED;
        }
        else
        {
            type++;
        }

        setColor();
    }
コード例 #6
0
    public void setColor(BALLTYPE color)
    {
        if (color == BALLTYPE.LASTCOLOR)
        {
            color = GetRandomBalltype();
        }
        this.color = color;

        ClearChild();

        if (ball.armor > 0)
        {
            GetChildrenSprite().sprite = GameSetting.Instance.spriteArmor;
        }

        if (color == BALLTYPE.BOMB)
        {
            GetSprite().sprite = GameSetting.Instance.spriteBomb;

            if (ToolTipManager.Instance.IsNeedToBeToolTiped(enumToolTipsList.Bomb))
            {
                ToolTipObject tt = gameobject.AddComponent <ToolTipObject>();
                tt.tt = enumToolTipsList.Bomb;
            }
        }
        else if (color == BALLTYPE.MOVEDOWN)
        {
            GetSprite().sprite = GameSetting.Instance.spriteMoveDown;

            if (ToolTipManager.Instance.IsNeedToBeToolTiped(enumToolTipsList.MoveDown))
            {
                ToolTipObject tt = gameobject.AddComponent <ToolTipObject>();
                tt.tt = enumToolTipsList.MoveDown;
            }
        }
        else if (ball.isbasic)
        {
            GetSprite().sprite = GameSetting.Instance.spriteBasic;
        }
        else
        {
            GetSprite().sprite = GameSetting.Instance.spriteMain;
        }


        GetSprite().color = IGame.Instance.get_color(color);
    }
 public void Load(int i)
 {
     type = (BALLTYPE)i;
     setColor();
 }
 // Use this for initialization
 void Start()
 {
     type = BALLTYPE.LASTONE;
     GetComponent <Renderer>().material.color = new Color(1, 1, 1, 0.5f);
     spriteRenderer = GetComponent <SpriteRenderer> ();
 }
    private bool ReadBlock(BinaryReader _BinaryReader)
    {
        DATABLOCK block = (DATABLOCK)_BinaryReader.ReadByte();

        switch (block)
        {
        case DATABLOCK.VERSION:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: VERSION");
                        #endif
            version = _BinaryReader.ReadInt32();
                        #if DEBUGSAVE
            Debug.Log("Version " + version);
                        #endif
            if (version < 4)
            {
                Debug.LogError("OLDVERSION");
                return(false);
            }
            return(true);

        case DATABLOCK.CHAPTER:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: CHAPTER");
                        #endif

            ID          = _BinaryReader.ReadInt32();
            GameType    = (GAMETYPE)_BinaryReader.ReadByte();
            Name        = _BinaryReader.ReadString();
            Description = _BinaryReader.ReadString();

            return(true);

        case DATABLOCK.LEVEL:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: LEVEL");
                        #endif
            currentLevelData = new LevelData();
            LevelList.Add(currentLevelData);
            while (ReadBlock(_BinaryReader))
            {
                continue;
            }

            return(true);

        case DATABLOCK.CELL_BALL:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: CELL_BALL");
                        #endif
            if (currentLevelData == null)
            {
                Debug.LogError("ReadBlock: CELL_BALL NO LEVEL");
                return(false);
            }

            LevelData.CellBall ball = new LevelData.CellBall();

            ball.position.Set(
                _BinaryReader.ReadSingle(),
                _BinaryReader.ReadSingle(),
                0.0f);

            ball.type   = (BALLTYPE)_BinaryReader.ReadByte();
            ball.basic  = _BinaryReader.ReadBoolean();
            ball.frozen = _BinaryReader.ReadBoolean();
            ball.armor  = _BinaryReader.ReadInt32();

            currentLevelData.CellBallList.Add(ball);

            return(true);

        case DATABLOCK.BALLCOLORLINE:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: BALLCOLORLINE");
                        #endif

            BALLTYPE bt = (BALLTYPE)_BinaryReader.ReadByte();
            while (bt != BALLTYPE.LASTONE)
            {
                currentLevelData.BallsColorLine.Add(bt);
                bt = (BALLTYPE)_BinaryReader.ReadByte();
            }
            return(true);

        case DATABLOCK.LEVELEND:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: LEVELEND");
                        #endif
            return(false);

        case DATABLOCK.END:
                        #if DEBUGSAVE
            Debug.Log("ReadBlock: END");
                        #endif
            return(false);

        default:
                        #if DEBUGSAVE
            Debug.LogError("ReadBlock: NO DATA");
                        #endif
            return(false);
        }
    }