Beispiel #1
0
 public Game(GameFieldBase gameField, Player[] players)
 {
     GameField = gameField;
     GameField.Initialize();
     Players   = players;
     WhoseTurn = Players[0];
 }
Beispiel #2
0
    /// <summary>
    /// set a field as a single event trigger and change its appearance
    /// </summary>
    /// <param name="field"></param>
    /// <param name="value"></param>
    private static void SetAsSingleEventTrigger(GameFieldBase field, bool value)
    {
        field.IsSingleEventTrigger = value;
        RegularField regularField = field as RegularField;

        if (regularField != null && !regularField.IsBench)
        {
            StringBuilder materialSource = new StringBuilder(TexturesDirectory);
            if (regularField.Index >= FirstRedFieldIndex && regularField.Index <= LastRedFieldIndex)
            {
                if (regularField.IsBend)
                    materialSource.Append(RedTriggerBendMaterial);
                else
                    materialSource.Append(RedTriggerRegularMaterial);
            }
            else if (regularField.Index >= FirstYellowFieldIndex && regularField.Index <= LastYellowFieldIndex)
            {
                if (regularField.IsBend)
                    materialSource.Append(YellowTriggerBendMaterial);
                else
                    materialSource.Append(YellowTriggerRegularMaterial);
            }
            else if (regularField.Index >= FirstBlueFieldIndex && regularField.Index <= LastBlueFieldIndex)
            {
                if (regularField.IsBend)
                    materialSource.Append(BlueTriggerBendMaterial);
                else
                    materialSource.Append(BlueTriggerRegularMaterial);
            }
            else if (regularField.Index >= FirstGreenFieldIndex && regularField.Index <= LastGreenFieldIndex)
            {
                if (regularField.IsBend)
                    materialSource.Append(GreenTriggerBendMaterial);
                else
                    materialSource.Append(GreenTriggerRegularMaterial);
            }
            Material material = Resources.Load(materialSource.ToString(), typeof(Material)) as Material;
            if (material != null)
                GameObject.Find(regularField.gameObject.name + "/" + "default").GetComponent<MeshRenderer>().material = material;
        }
    }
Beispiel #3
0
    /// <summary>
    /// set a field as a multi event trigger and change its appearance
    /// </summary>
    /// <param name="field"></param>
    /// <param name="value"></param>
    private static void SetAsMultiEventTrigger(GameFieldBase field, bool value)
    {
        field.IsMultiEventTrigger = value;
        RegularField regularField = field as RegularField;

        if (regularField != null && !regularField.IsBench)
        {
            StringBuilder materialSource = new StringBuilder(TexturesDirectory);
            if (regularField.IsBend)
            {
                materialSource.Append(RainbowTriggerBendMaterial);
            }
            else
            {
                materialSource.Append(RainbowTriggerRegularMaterial);
            }

            Material material = Resources.Load(materialSource.ToString(), typeof(Material)) as Material;
            if (material != null)
                GameObject.Find(regularField.gameObject.name + "/" + "default").GetComponent<MeshRenderer>().material = material;
        }
    }