示例#1
0
 /// <summary>
 /// レイを発射
 /// </summary>
 void LightFiring()
 {
     if (!player.GM.Parameter.StartGameFlag || player.GM.Parameter.EndGameFlag)
     {
         return;
     }
     if (Physics.SphereCast(transform.position, 1, transform.forward, out hit, player.GM.Parameter.LightHitRange, mask))
     {
         if (hit.collider.tag.Contains("Key"))
         {
             SwitchSymbol sg = hit.collider.GetComponent <SwitchSymbol>();
             sg.Activate(player.GM);
         }
     }
 }
    private void ParseRule(string rule)
    {
        int eqIndex = rule.IndexOf('=');

        if (eqIndex == -1)
        {
            // Not a valid rule
            return;
        }

        string key = rule.Substring(0, eqIndex);
        Symbol symbol;

        // Regex: Find |s not inside quotes
        string[] switchSymbols = Regex.Split(rule.Substring(eqIndex + 1), "\\|(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)");
        if (switchSymbols.Length == 0)
        {
            // Not a valid rule
            return;
        }
        else if (switchSymbols.Length == 1)
        {
            // Single value - no switch needed
            rules.Add(key, symbol = ParseNonSwitchSymbol(switchSymbols[0].Trim()));
        }
        else
        {
            // Multiple values - switch needed
            rules.Add(key, symbol = new SwitchSymbol(switchSymbols.Select(s => ParseNonSwitchSymbol(s.Trim())).ToArray()));
        }

        if (key == "S")
        {
            S = symbol;
        }
    }