Ejemplo n.º 1
0
        //private IList<Trait> _traits;
        //public IList<Trait> Traits { get { return _traits; } }     // return an unmodifialbe list - ArrayList.ReadOnly?

        /// <summary>
        /// Initializes a new instance of the <see cref="Race"/> class for testing.
        /// </summary>
        /// <param name="raceType">Type of the race.</param>
        public Race(Races raceType) {
            RaceType = raceType;
            LeaderName = raceType.GetName() + " Leader";
            Description = new StringBuilder(raceType.GetDescription());
            Color = RandomExtended<GameColor>.Choice(Enums<GameColor>.GetValues()
                .Except(default(GameColor), GameColor.Black, GameColor.Clear).ToArray());
        }
Ejemplo n.º 2
0
 public Race(RaceStat stats) {
     RaceType = stats.Race;
     LeaderName = stats.LeaderName;
     Description = stats.Description;
     Color = stats.Color;
     //Traits = stats.Traits;
 }
Ejemplo n.º 3
0
    void SetColor(GameColor gc)
    {
        switch (gc)
        {
        case GameColor.green:
            fader.color         = green;
            faderFollower.color = green;
            break;

        case GameColor.yellow:
            fader.color         = yellow;
            faderFollower.color = yellow;
            break;

        case GameColor.red:
            fader.color         = red;
            faderFollower.color = red;
            break;

        default:
            fader.color         = Color.white;
            faderFollower.color = Color.white;
            break;
        }
    }
        public void Given_4PiecesAtDifferentPositions_DiceIs3_Excpect_ListWith2Pieces()
        {
            //Arrange

            var gamePieces = new List <GamePiece>()
            {
                new GamePiece()
                {
                    Color = 0, Number = 1, TrackPosition = 1
                },
                new GamePiece()
                {
                    Color = 0, Number = 2, TrackPosition = 5
                },
                new GamePiece()
                {
                    Color = 0, Number = 3, TrackPosition = 7
                },
                new GamePiece()
                {
                    Color = 0, Number = 4, TrackPosition = 8
                }
            };
            GameColor color      = 0;
            var       diceResult = 3;

            //Act

            var movableGamePieces = Tools.GetMovableGamePieces(gamePieces, color, diceResult);

            //Assert
            Assert.Equal(2, movableGamePieces.Count());
            Assert.Equal(gamePieces[0], movableGamePieces[0]);
            Assert.Equal(gamePieces[3], movableGamePieces[1]);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Race"/> class.
 /// </summary>
 /// <param name="stat">The stat.</param>
 public Race(RaceStat stat) {
     Species = stat.Species;
     LeaderName = stat.LeaderName;
     ImageFilename = stat.ImageFilename;
     Description = stat.Description;
     Color = stat.Color;
 }
    void FireBullet()
    {
        if (cooldown)
        {
            return;
        }

        GameObject bulletInstance_1 = Instantiate(bullet, transform.position, GetRotation(splitterFace1));
        GameObject bulletInstance_2 = Instantiate(bullet, transform.position, GetRotation(splitterFace2));

        Bullet bulletComp_1 = bulletInstance_1.GetComponent <Bullet>();

        bulletComp_1.SetColor(splitterColor);
        bulletComp_1.SetShooter(gameObject);

        Bullet bulletComp_2 = bulletInstance_2.GetComponent <Bullet>();

        bulletComp_2.SetColor(splitterColor);
        bulletComp_2.SetShooter(gameObject);

        cooldown      = true;
        isCharged     = false;
        splitterColor = GameColor.COLOR_WHITE;
        SetEmitterColor(Color.grey);
    }
Ejemplo n.º 7
0
        public void DrawLine(GameColor color, int x0, int y0, int x1, int y1)
        {
            float dx = x1 - x0;
            float dy = y1 - y0;

            if (Math.Abs(dx) > Math.Abs(dy))
            {
                dx /= Math.Abs(dx);
                dy /= Math.Abs(dx);
            }
            else
            {
                dx /= Math.Abs(dy);
                dy /= Math.Abs(dy);
            }
            float x = x0;
            float y = y0;

            blocks[x0, y0] = color;
            while (x != x1 || y != y1)
            {
                x += dx;
                y += dy;
                blocks[( int )Math.Round(x), ( int )Math.Round(y)] = color;
            }
        }
Ejemplo n.º 8
0
        Brush GetColor(GameColor c)
        {
            switch (c)
            {
            // hard code all game colors
            case GameColor.BlackBackground:
                return(new SolidColorBrush(Color.FromArgb(255, 0, 0, 0)));

            case GameColor.NormalCell:
                return(new SolidColorBrush(Color.FromArgb(100, 100, 100, 100)));

            case GameColor.AvailableBoardGlow:
                return(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)));

            case GameColor.BoardWonX:
                return(new SolidColorBrush(Color.FromArgb(255, 200, 255, 200)));

            case GameColor.BoardWonO:
                return(new SolidColorBrush(Color.FromArgb(255, 255, 200, 200)));

            case GameColor.BoardDraw:
                return(new SolidColorBrush(Color.FromArgb(255, 255, 255, 200)));

            case GameColor.Border:
                return(new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)));
            }
            return(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)));
        }
Ejemplo n.º 9
0
 protected Chess(ChessFactory factory, GameColor color, ChessType type)
 {
     Factory = factory;
     Color   = color;
     Type    = type;
     Sprite  = Factory.Skin[color, type].Clone();
 }
Ejemplo n.º 10
0
 public void DrawText(Vector2 pos, string text, float size, GameColor color)
 {
     _ds.DrawText(text, pos, GetWin2DColor(color), new CanvasTextFormat
     {
         FontSize = size
     });
 }
Ejemplo n.º 11
0
        public static Color GetColor(GameColor color)
        {
            switch (color)
            {
            case (GameColor.COLOR_BLUE):
                return(Color.blue);

            case (GameColor.COLOR_RED):
                return(Color.red);

            case (GameColor.COLOR_MAGENTA):
                return(Color.magenta);

            case (GameColor.COLOR_GREEN):
                return(Color.green);

            case (GameColor.COLOR_CYAN):
                return(Color.cyan);

            case (GameColor.COLOR_YELLOW):
                return(Color.yellow);

            default:
                return(Color.white);
            }
        }
Ejemplo n.º 12
0
    /// <summary>
    /// Ajout des mouvements dans une direction autorisés par la pièce, après vérification.
    /// </summary>
    /// <param name="board">Le plateau de jeu.</param>
    /// <param name="neighbor">Enumeration d'une case voisine.</param>
    /// <param name="legalMoves">Une liste de coordonnees</param>
    public virtual void CheckNeighborIsLegalRepeat(Neighbor neighbor, List <Coordinates> legalMoves, Board board)
    {
        bool        ok         = true;
        GameColor   ownerColor = owner.color;
        Box         b;
        Coordinates c = box.coord;

        while (ok)
        {
            c = c.getNeighbor(neighbor, ownerColor);
            if (c.isInsideBorders())
            {
                b = board.boxes[c.getIndex()];
                if (b.token == null)
                {
                    legalMoves.Add(c);
                }
                else if (b.token.owner.color != owner.color)
                {
                    legalMoves.Add(c);
                    ok = false;
                }
                else
                {
                    ok = false;
                }
            }
            else
            {
                ok = false;
            }
        }
    }
Ejemplo n.º 13
0
 public Player(int id, string playerName, GameColor clr)
 {
     this.name     = playerName;
     this.playerID = id;
     this.color    = clr;
     CreateTokens(clr);
 }
Ejemplo n.º 14
0
        public Chess CreateChess(ChessType type, GameColor color, PointF position = new PointF())
        {
            Chess chess;

            switch (type)
            {
            case ChessType.Bishop:  chess = new ChessBishop(this, color); break;

            case ChessType.King:    chess = new ChessKing(this, color); break;

            case ChessType.Knight:  chess = new ChessKnight(this, color); break;

            case ChessType.Pawn:    chess = new ChessPawn(this, color); break;

            case ChessType.Queen:   chess = new ChessQueen(this, color); break;

            case ChessType.Rook:    chess = new ChessRook(this, color); break;

            default:
                return(null);
            }
            ActiveChess.Add(chess);
            chess.Sprite.Size     = chessSize;
            chess.Sprite.Position = position;
            return(chess);
        }
    public void initObject(GameColor color, int num)
    {
        gColor = color;
        string redPrefix   = "01_red_segments";
        string bluePrefix  = "02_blue_segments";
        string greenPrefix = "03_green_segments";
        string spriteName  = "";

        switch (color)
        {
        case GameColor.RED:
            spriteName = redPrefix;
            break;

        case GameColor.GREEN:
            spriteName = greenPrefix;
            break;

        case GameColor.BLUE:
            spriteName = bluePrefix;
            break;
        }
        //spriteName += num.ToString ();
        Debug.Log(spriteName);
        Sprite[] sprites = Resources.LoadAll <Sprite>(spriteName);
        this.GetComponent <SpriteRenderer> ().sprite = sprites [num];
    }
Ejemplo n.º 16
0
 private void ButtonUp(GameColor color)
 {
     if (touchedColors.Contains(color))
     {
         touchedColors.Remove(color);
     }
 }
Ejemplo n.º 17
0
 protected ConcreteObject(ObjectType objectType, ConcreteObjectBuilder builder)
     : base(objectType, builder)
 {
     m_name = builder.Name;
     m_color = builder.Color;
     m_materialID = builder.MaterialID;
 }
Ejemplo n.º 18
0
    // Use this for initialization

    public void Init()
    {
        GameColor parent = transform.parent.GetComponent <GameColor>();

        //if parent is a color part, follow it's color
        if (parent)
        {
            gameColor = parent.gameColor;
        }
        switch (gameColor)
        {
        case GameColorEnum.none:
            gameObject.SetActive(false);
            break;

        default:
            if (sr == null)
            {
                return;
            }
            // Debug.Log("index " + index);
            sr.sprite = ResourceManager.Instance.circleSprite[(int)gameColor];
            if (!hasFinishedStart)
            {
                transform.Rotate(new Vector3(0, 0, (-index) * 90));
            }
            hasFinishedStart = true;
            //CSUtil.ERROR("game color is an invalid value");
            break;
        }
    }
Ejemplo n.º 19
0
 public Field(int id, GameColor clr, int Finished)
 {
     this.fieldId        = id;
     this.color          = clr;
     InnerOccupants      = new List <Token>();
     this.GetFinishedTkn = Finished;
 }
        public void Given_4PiecesAtBase_DiceIs2_Excpect_ListWith0Pieces()
        {
            //Arrange

            var gamePieces = new List <GamePiece>()
            {
                new GamePiece()
                {
                    Color = 0, Number = 1, TrackPosition = null
                },
                new GamePiece()
                {
                    Color = 0, Number = 2, TrackPosition = null
                },
                new GamePiece()
                {
                    Color = 0, Number = 3, TrackPosition = null
                },
                new GamePiece()
                {
                    Color = 0, Number = 4, TrackPosition = null
                }
            };
            GameColor color      = 0;
            var       diceResult = 2;

            //Act

            var movableGamePieces = Tools.GetMovableGamePieces(gamePieces, color, diceResult);

            //Assert
            Assert.Empty(movableGamePieces);
        }
Ejemplo n.º 21
0
    public void Refresh(GameColor color, bool animate = true)
    {
        Color newCurrentColor = _colorsManager.GetColor(color);
        Color newNextColor    = _colorsManager.GetColor(_colorsManager.GetNextColor(color));

        if (animate)
        {
            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", _currentColorImage.color,
                               "to", newCurrentColor,
                               "onupdate", "SetCurrentColorImageColor",
                               "time", 1.0f,
                               "easetype", iTween.EaseType.easeOutCubic
                               ));
            iTween.ValueTo(gameObject, iTween.Hash(
                               "from", _nextColorImage.color,
                               "to", newNextColor,
                               "onupdate", "SetNextColorImageColor",
                               "time", 1.0f,
                               "easetype", iTween.EaseType.easeOutCubic
                               ));
        }
        else
        {
            _currentColorImage.color = newCurrentColor;
            _nextColorImage.color    = newNextColor;
        }
    }
Ejemplo n.º 22
0
        /// <summary>
        /// Checks if the user's input matches this sequence's input.
        /// </summary>
        /// <param name="chosenColor"></param>
        /// <returns></returns>
        public GameStatus CheckUserInput(GameColor chosenColor)
        {
            try
            {
                GameColor colorToTestAgainst = CurrentSequence.Dequeue();

                // If the user chooses the wrong color the game will be over.
                if (chosenColor != colorToTestAgainst)
                {
                    return(GameStatus.GAME_OVER);
                }
                // If the user has not lost the game and the count of the colors is 0, they have won the round
                if (CurrentSequence.Count == 0)
                {
                    return(GameStatus.WON_ROUND);
                }
                // Otherwise, the user is still winning
                else
                {
                    return(GameStatus.WINNING);
                }
            } catch (NullReferenceException e)
            {
                Console.WriteLine(e.StackTrace.ToString());
                Console.WriteLine("Error. Sequence Generation may be broken!");
                return(GameStatus.GAME_OVER);
            }
        }
Ejemplo n.º 23
0
 /// <summary> return comination of colors apart from color
 ///
 ///
 /// </summary>
 /// <param name="color"></param> color to subtract from black from
 /// <returns></returns> all color combination expect selected color
 private GameColor subtractFromBlack(GameColor color)
 {
     if (color.getColorName() == "red")
     {
         return(new GameColor("green"));
     }
     else if (color.getColorName() == "blue")
     {
         return(new GameColor("orange"));
     }
     else if (color.getColorName() == "yellow")
     {
         return(new GameColor("purple"));
     }
     else if (color.getColorName() == "orange")
     {
         return(new GameColor("blue"));
     }
     else if (color.getColorName() == "purple")
     {
         return(new GameColor("yellow"));
     }
     else if (color.getColorName() == "green")
     {
         return(new GameColor("red"));
     }
     else if (color.getColorName() == "clear")
     {
         return(new GameColor("black"));
     }
     else
     {
         return(new GameColor("white"));
     }
 }
Ejemplo n.º 24
0
 public BlockAtrributes(int health, GameColor color, PowerUpType favoredPowerUp, PowerUpType secondaryFavoredPowerUp = PowerUpType.Nothing)
 {
     Health                 = health;
     Color                  = color;
     FavoredPowerUp         = favoredPowerUp;
     SecondaryFavorePowerUp = secondaryFavoredPowerUp;
 }
Ejemplo n.º 25
0
 /// <summary> return the addition of two colors
 /// Precondition: input must be on of the basic colors
 /// Invalid colors default to black
 /// </summary>
 /// <param name="color2"></param> second color to be added
 /// <returns></returns> color of the combination
 public GameColor add(GameColor otherColor)
 {
     if (this.Equals(otherColor))
     {
         return(this);
     }
     else if (getColorName() == "clear" || getColorName() == "white")
     {
         return(otherColor);
     }
     else if (otherColor.getColorName() == "clear" || otherColor.getColorName() == "white")
     {
         return(this);
     }
     else if (colorsPresent(otherColor, "red", "blue"))
     {
         return(new GameColor("purple"));
     }
     else if (colorsPresent(otherColor, "red", "yellow"))
     {
         return(new GameColor("orange"));
     }
     else if (colorsPresent(otherColor, "blue", "yellow"))
     {
         return(new GameColor("green"));
     }
     else
     {
         return(new GameColor("black"));
     }
 }
Ejemplo n.º 26
0
 public StartGameData(string loginQuery, string loginReply, GameColor colorQuery, ChessDirection directionQuery)
 {
     LoginQuery     = loginQuery;
     LoginReply     = loginReply;
     ColorQuery     = colorQuery;
     DirectionQuery = directionQuery;
 }
        public void Given_4PiecesAtFinalTrack_DiceIs1_Excpect_ListWith1Pieces()
        {
            //Arrange

            var gamePieces = new List <GamePiece>()
            {
                new GamePiece()
                {
                    Color = 0, Number = 1, TrackPosition = 43
                },
                new GamePiece()
                {
                    Color = 0, Number = 2, TrackPosition = 42
                },
                new GamePiece()
                {
                    Color = 0, Number = 3, TrackPosition = 41
                },
                new GamePiece()
                {
                    Color = 0, Number = 4, TrackPosition = 40
                }
            };
            GameColor color      = 0;
            var       diceResult = 1;

            //Act

            var movableGamePieces = Tools.GetMovableGamePieces(gamePieces, color, diceResult);

            //Assert
            Assert.Single(movableGamePieces);
        }
Ejemplo n.º 28
0
 // Load game textures
 private void LoadGameTextures()
 {
     if (gameData != null)
     {
         if (gameData.characters != null)
         {
             for (int c = 0; c < gameData.characters.Length; c++)
             {
                 GameCharacter character = gameData.characters[c];
                 if (!string.IsNullOrEmpty(character.characterIconPath) && character.characterIconTexture == null)
                 {
                     LoadTexture(character.characterIconPath, delegate(Texture2D texture)
                     {
                         character.characterIconTexture = texture;
                     });
                 }
             }
         }
         if (gameData.colors != null)
         {
             for (int c = 0; c < gameData.colors.Length; c++)
             {
                 GameColor color = gameData.colors[c];
                 if (color.colorBorderTexture == null)
                 {
                     LoadTexture(color.colorName + ".png", delegate(Texture2D texture)
                     {
                         color.colorBorderTexture = texture;
                     });
                 }
             }
         }
     }
 }
Ejemplo n.º 29
0
 void ProcessBullet(Bullet lastBullet)
 {
     splitterColor = lastBullet.GetColor();
     isCharged     = (splitterColor != GameColor.COLOR_WHITE);
     SetEmitterColor(ColorDefs.GetColor(splitterColor));
     Destroy(lastBullet.gameObject);
 }
Ejemplo n.º 30
0
    public void SetColor(GameColor newColor)
    {
        if (sprite == null)
        {
            sprite = GetComponent <SpriteRenderer>();
        }
        if (trail == null)
        {
            trail = GetComponent <TrailRenderer>();
        }
        if (particle == null)
        {
            particle = GetComponent <ParticleSystem>();
        }

        bulletColor = newColor;
        Color color = ColorDefs.GetColor(bulletColor);

        sprite.color = color;

        trail.startColor = color;
        trail.endColor   = new Color(color.r, color.g, color.b, 0.0f);
        ParticleSystem.MainModule settings = particle.main;
        settings.startColor = new ParticleSystem.MinMaxGradient(color);
    }
Ejemplo n.º 31
0
        public static GamePiece GetGamePieceToMove(List <GamePiece> gamePieceSetup, GameColor color, int diceResult)
        {
            GamePiece        gamePieceToMove = null;
            List <GamePiece> movablePieces   = Tools.GetMovableGamePieces(gamePieceSetup, color, diceResult);

            if (movablePieces.Count != 0)
            {
                Console.WriteLine("Choose your game piece:");
                for (int i = 0; i < movablePieces.Count; i++)
                {
                    string trackPosition = (movablePieces[i].TrackPosition == null) ? "base" : "position " + (movablePieces[i].TrackPosition + 1).ToString();
                    Console.WriteLine(
                        $"{i + 1}) Piece number: {movablePieces[i].Number} at {trackPosition}");
                }

                var chosenPieceIndex = (int.TryParse(Console.ReadLine(), out var result)) ? result - 1 : 0;
                if (chosenPieceIndex < 0 || chosenPieceIndex > movablePieces.Count - 1)
                {
                    chosenPieceIndex = 0;
                }
                gamePieceToMove = movablePieces[chosenPieceIndex];
            }
            else
            {
                Console.WriteLine($"You don't have available moves based on dice result");
                Console.ReadKey();
            }
            return(gamePieceToMove);
        }
Ejemplo n.º 32
0
        internal Player(GameColor color, bool isHuman)
        {
            IsHuman = isHuman;

            PlayerColor = color;
            PlayerName = color + " Player";
        }
Ejemplo n.º 33
0
 public HumanPlayer(GameColor pawnColor, CheckboardDisplay checkboardDisplay)
 {
     camera = Camera.main;
     this.checkboardDisplay = checkboardDisplay;
     this.pawnColor         = pawnColor;
     selectedFields         = new List <FieldDisplay>();
 }
Ejemplo n.º 34
0
    public int GetCombinedLayerMask(GameColor color)
    {
        if (_staticLayerMask == 0)
        {
            foreach (KeyValuePair <GameColor, GameColorConfig> pair in _configurations)
            {
                if (pair.Value.isStatic)
                {
                    if (_staticLayerMask == 0)
                    {
                        _staticLayerMask = GetLayerMask(pair.Key);
                    }
                    else
                    {
                        _staticLayerMask = _staticLayerMask | GetLayerMask(pair.Key);
                    }
                }
            }
        }

        /*if (color == GameColor.WHITE)
         * {
         *  return GetLayerMask(GameColor.WHITE);
         * }*/
        return(_staticLayerMask | GetLayerMask(color));
    }
Ejemplo n.º 35
0
 public void SetByPosition(int index, GameColor color)
 {
     if (index < GameManager.ANSWER_COUNT)
     {
         colors[index] = color;
     }
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="race">The race to copy.</param>
 public Race(Race race) {
     Species = race.Species;
     LeaderName = race.LeaderName;
     ImageFilename = race.ImageFilename;
     Description = race.Description;
     Color = race.Color;
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Initializes a new instance of the <see cref="A3DVectrosityBase" /> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="points">The points.</param>
 /// <param name="target">The transform that this line follows in the scene.</param>
 /// <param name="parent">The parent to attach the VectorObject too.</param>
 /// <param name="width">The width.</param>
 /// <param name="color">The color.</param>
 public A3DVectrosityBase(string name, Vector3[] points, Transform target, Transform parent = null, float width = 1F, GameColor color = GameColor.White)
     : base(name, parent) {
     _points = points;
     _target = target;
     _lineWidth = width;
     _color = color;
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Race" /> class for testing.
 /// </summary>
 /// <param name="species">Species of the race.</param>
 /// <param name="color">Color.</param>
 public Race(Species species, GameColor color) {
     Species = species;
     LeaderName = species.GetDefaultLeaderName();
     ImageFilename = species.GetImageFilename();
     Description = species.GetEnumAttributeText();
     Color = color;
 }
Ejemplo n.º 39
0
 public GridWireframe_Alt(string name, Transform target, IList<Vector3> points, Visibility visibility = Visibility.Always, float width = 1F, GameColor color = GameColor.Gray) {
     _lineName = name;
     _target = target;
     _points = points;
     _visibility = visibility;
     _lineWidth = width;
     _color = color;
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RaceStat"/> struct.
 /// </summary>
 /// <param name="species">The species.</param>
 /// <param name="leaderName">Name of the race leader.</param>
 /// <param name="imageFilename">The filename used to find the image texture in an atlas for this race.</param>
 /// <param name="description">The race description.</param>
 /// <param name="color">The race color.</param>
 public RaceStat(Species species, string leaderName, string imageFilename, string description, GameColor color)
     : this() {
     Species = species;
     LeaderName = leaderName;
     ImageFilename = imageFilename;
     Description = description;
     Color = color;
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Copy constructor.
 /// </summary>
 /// <param name="race">The race to copy.</param>
 public Race(Race race) {
     RaceType = race.RaceType;
     LeaderName = race.LeaderName;
     Description = race.Description;
     Color = race.Color;
     // _traits = new List<Trait>();
     // race.Traits.ForAll<Trait>(t => _traits.Add(t));
 }
Ejemplo n.º 42
0
 private void EnsureGemActive(GameColor color)
 {
     if (!gemActive[color]) {
         gemActive[color] = true;
         gemMap[color].StartAnim();
         gemMap[color].SetColor(color.GemColor());
     }
 }
Ejemplo n.º 43
0
 public CubeWireframe_Alt(string name, Transform target, Vector3 boxSize, Visibility visibility = Visibility.Static, float width = 1F, GameColor color = GameColor.White) {
     _lineName = name;
     _target = target;
     _size = boxSize;
     _visibility = visibility;
     _lineWidth = width;
     _color = color;
 }
Ejemplo n.º 44
0
 private LineBehaviour CreateFaintLine(GameColor color)
 {
     Vector3 start = gemMap[color].transform.position;
     Vector3 end = templeMap[color].GetGemPosition();
     LineBehaviour line = (LineBehaviour) Instantiate(faintLinePrefab, start, Quaternion.identity);
     line.Configure(start, end, new Color(1f, 1f, 1f, 0.3f), 20f, 2f, 2f);
     return line;
 }
Ejemplo n.º 45
0
    // Use this for initialization
    void Start()
    {
        charged = false;
        color = GameColor.FromName(colorName);
        gem.renderer.material.color = color.DullColor();

        lines = new LineBehaviour[monuments.Length];
    }
Ejemplo n.º 46
0
 protected override void Start() {
     base.Start();
     //RefreshColorsInUse();   // GuiPlayerColorPopupList selection initialization takes place in Awake so defer capture until Start
     _currentUserPlayerColor = _userPlayerColorPopupList.SelectedColor;
     RefreshAIPlayerColorsInUse();
     //RefreshColorChoicesAvailableToAIPlayers(colorToRemove: _currentUserPlayerColor, refreshSelection: false);
     RefreshColorChoicesAvailableToAIPlayers(colorToRemove: _currentUserPlayerColor);
     Subscribe();    // subscribe to color selection changes AFTER removing the current userPlayer color so we don't hear about any change events that result
 }
Ejemplo n.º 47
0
 private LineBehaviour CreateBoldLine(GameColor color)
 {
     Vector3 end = gemMap[color].transform.position;
     Vector3 start = templeMap[color].GetGemPosition();
     LineBehaviour line = (LineBehaviour) Instantiate(boldLinePrefab, start, Quaternion.identity);
     Color lineColor = color.GemColor();
     lineColor.a = 0.25f;
     line.Configure(start, end, lineColor, 30f, 1f, 0.5f);
     return line;
 }
Ejemplo n.º 48
0
 public ColoredText(string text, GameColor color) {
     if (color != GameColor.White) {
         string colorHex = MyNguiUtilities.ColorToHex(color);
         string colorNgui = MyNguiConstants.NguiEmbeddedColorFormat.Inject(colorHex);
         TextWithEmbeddedColor = colorNgui + text + MyNguiConstants.NguiEmbeddedColorTerminator;
     }
     else {
         TextWithEmbeddedColor = text;
     }
 }
Ejemplo n.º 49
0
    private IEnumerator SwitchColorRoutine(GameColor color)
    {
        Color startColor = renderer.material.color;

        for (float timer = 0f; timer < 2f; timer += Time.deltaTime) {
            SetRendererColors(Color.Lerp(startColor, color.DullColor(), timer / 1f));
            yield return null;
        }

        SetRendererColors(color.DullColor());
    }
Ejemplo n.º 50
0
    // Use this for initialization
    void Start()
    {
        if (color == null) {
            color = GameColor.FromName(colorName);
        }

        renderer.material.color = color.GemColor();
        ParticleSystemRenderer pr = particles.GetComponent<ParticleSystemRenderer>();
        pr.material.SetColor("_TintColor", color.GemColor());

        StartCoroutine(CreateRoutine());
    }
Ejemplo n.º 51
0
        internal void UpdateBar(GameColor color, bool isEaten)
        {

            if (isEaten)
            {
                AddChecker(color);
                return;
            }

            RemoveChecker(color);
            
        }
Ejemplo n.º 52
0
 /// <summary>
 /// Initializes a new instance of the <see cref="HighlightCircle"/> class.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="target">The target.</param>
 /// <param name="normalizedRadius">The normalized radius.</param>
 /// <param name="isRadiusDynamic">if set to <c>true</c> [is radius dynamic].</param>
 /// <param name="maxCircles">The maximum circles.</param>
 /// <param name="width">The width.</param>
 /// <param name="color">The color.</param>
 public HighlightCircle(string name, Transform target, float normalizedRadius, bool isRadiusDynamic = true, int maxCircles = 1, float width = 1F, GameColor color = GameColor.White)
     : base(name) {
     Target = target;
     NormalizedRadius = normalizedRadius;
     IsRadiusDynamic = isRadiusDynamic;
     MaxCircles = maxCircles;
     Widths = new List<float>(maxCircles);
     Widths.Fill<float>(width);
     Colors = new List<GameColor>(maxCircles);
     Colors.Fill<GameColor>(color);
     //InitializeCamera();
 }
Ejemplo n.º 53
0
        public Drawing GetDetailedDrawing(SymbolID symbolID, GameColor color)
        {
            int key = ((int)symbolID << 16) | (int)color;

            Drawing drawing;

            if (m_drawingCache.TryGetValue(key, out drawing))
                return drawing;

            drawing = m_tileSet.GetDetailedDrawing(symbolID, color);
            m_drawingCache[key] = drawing;
            return drawing;
        }
Ejemplo n.º 54
0
        private void InitializeColorChangeSystem(GameColor color) {
            Color32 primaryMeshColor = color.ToUnityColor(_primaryMeshAlpha);
            _primaryMeshMPB = new MaterialPropertyBlock();  // default color is black
            _primaryMeshRenderer.GetPropertyBlock(_primaryMeshMPB);
            // renderer's existing MaterialPropertyBlock color is also black, implying that the existing property block is the default, at least wrt color
            _primaryMeshMPB.SetColor(UnityConstants.StdShader_Property_AlbedoColor, primaryMeshColor);
            //D.Log("{0}.PrimaryMeshMPB color after initialization = {1}.", DebugName, _primaryMeshMPB.GetVector(UnityConstants.StdShader_Property_AlbedoColor));

            if (_hiddenMeshMPB == null) {
                _hiddenMeshMPB = new MaterialPropertyBlock();
                _primaryMeshRenderer.GetPropertyBlock(_hiddenMeshMPB);
                _hiddenMeshMPB.SetColor(UnityConstants.StdShader_Property_AlbedoColor, HiddenMeshColor);
            }
        }
Ejemplo n.º 55
0
    public override void HandleColor(GameColor color, float amount)
    {
        audio.PlayOneShot(gotColor);

        if (!tanks.ContainsKey(color)) {
            tanks[color] = Mathf.Min(amount, tankSize);
        } else {
            tanks[color] = Mathf.Min(tanks[color] + amount, tankSize);
        }

        if (currentColor == null) {
            currentColor = color;
        }
    }
Ejemplo n.º 56
0
        private void RemoveChecker(GameColor color)
        {
            if (color == GameColor.White)
            {
                _whiteBar.RemoveChecker();
                if (_whiteBar.CheckersAmount == 0)
                    _whiteBar = null;

                return;
            }

            _redBar.RemoveChecker();
            if (_redBar.CheckersAmount == 0)
                _redBar = null;            
        }
Ejemplo n.º 57
0
 public void changeColor(GameColor newColor)
 {
     if (Time.timeScale != 0)
     {
         if (newColor == curUsingColor) {
             curUsingColor = GameColor.White;
             levelManager.SlowDown();
         }
         else {
             curUsingColor = newColor;
             levelManager.SlowDown();
         }
         OnColorChange((int)curUsingColor);
     }
 }
Ejemplo n.º 58
0
    private void InitializeColorPopupListValues() {
        // initialize user player color values
        _userPlayerColorPopupList.AssignColorSelectionChoices(_allPlayerColors);
        _userPlayerColorPopupList.RefreshSelectionFromPreference();   // no default value needed as its preference will be used
        _userPlayerColorSelected = _userPlayerColorPopupList.SelectedColor;

        // initialize AIPlayer color values
        var aiColorChoices = _allPlayerColors.Except(_userPlayerColorSelected);

        _aiPlayerColorPopupLists.ForAll(aiCpl => {
            aiCpl.AssignColorSelectionChoices(aiColorChoices);
            aiCpl.RefreshSelectionFromPreference();   // no default value needed as its preference will be used
            UpdateAIPlayerCollections(aiCpl);
        });
        RefreshAIPlayerColorsInUse();
    }
Ejemplo n.º 59
0
 protected override void RecordPopupListState(string popupListName, string selectionName) {
     base.RecordPopupListState(popupListName, selectionName);
     UniverseSize universeSize;
     if (Enums<UniverseSize>.TryParse(selectionName, true, out universeSize)) {
         //D.Log("UniverseSize recorded as {0}.".Inject(selectionName));
         _universeSize = universeSize;
     }
     Races playerRace;
     if (Enums<Races>.TryParse(selectionName, true, out playerRace)) {
         //D.Log("Player recorded as {0}.".Inject(selectionName));
         _playerRace = playerRace;
     }
     GameColor playerColor;
     if (Enums<GameColor>.TryParse(selectionName, true, out playerColor)) {
         _playerColor = playerColor;
     }
 }
Ejemplo n.º 60
0
    public override void HandleColor(GameColor color, float amount)
    {
        if (!active) {
            audio.PlayOneShot(colorGot);

            if (color == this.color) {
                colorAmount += amount;
            } else {
                this.color = color;
                colorAmount = amount;

                StopAllCoroutines();
                StartCoroutine(SwitchColorRoutine(color));
            }
            Debug.Log("Crystal Received Color: " + colorAmount + " / " + colorRequired);
        }
    }