Example #1
0
    // Update is called once per frame
    void Update()
    {
        if (!lanternAquired && cube.GetComponent <Dialog>().currentString == 4)
        {
            playerLantern.SetActive(true);
            lanternAquired = true;
        }
        if (!cubeGone && cube.GetComponent <Dialog>().currentString == 12)
        {
            cubeGone = true;

            ghostSound.Play();
        }
        if (cubeGone)
        {
            cube.transform.Translate(Vector3.forward * Time.deltaTime * -10);
        }
        if (player.position.x < -38 && crazyState == PPState.normal)
        {
            crazyState = PPState.crazy1;
            postProcessingProfiles[0].SetActive(false);  //can be made a function SetPPProfile(index)
            postProcessingProfiles[1].SetActive(true);
            postProcessingProfiles[2].SetActive(false);
        }
        if (player.position.x < -58 && crazyState == PPState.crazy1)
        {
            crazyState = PPState.crazy2;
            postProcessingProfiles[0].SetActive(false);
            postProcessingProfiles[1].SetActive(false);
            postProcessingProfiles[2].SetActive(true);
        }
        if (player.position.x < -68)
        {
            warpLight.intensity += Time.deltaTime * 20;
        }

        // mergea functie care facea sa fie de la 0 la 1, aka normalizare si d-astea

        ghostSound.volume = (1 - Mathf.Abs((-73 - player.position.x - 20) / 100) + 0.1f) / 8;
        ghostSound.pitch  = 1 - (1 - Mathf.Abs((-73 - player.position.x - 20) / 100) + 0.1f) / 6;
        music.pitch       = 1 + (1 - Mathf.Abs((-73 - player.position.x - 20) / 100) + 0.1f) / 6;
    }
Example #2
0
        /// <summary>
        /// ファイル一つを読む
        /// </summary>
        /// <param name="filepath"></param>
        private void loadErb(string filepath, string filename, List<string> isOnlyEvent)
        {
            //読み込んだファイルのパスを記録
            //一部ファイルの再読み込み時の処理用
            labelDic.AddFilename(filename);
            EraStreamReader eReader = new EraStreamReader();
            if (!eReader.Open(filepath, filename))
            {
                output.PrintError(eReader.Filename + "のオープンに失敗しました");
                return;
            }
            try
            {
                PPState ppstate = new PPState();
                LogicalLine nextLine = new NullLine();
                LogicalLine lastLine = new NullLine();
                FunctionLabelLine lastLabelLine = null;
                StringStream st = null;
                string rowLine = null;
                ScriptPosition position = null;
                int funcCount = 0;
                if (Program.AnalysisMode)
                    output.Print(" ");
                while ((st = eReader.ReadEnabledLine()) != null)
                {
                    rowLine = st.RowString;
                    position = new ScriptPosition(eReader.Filename, eReader.LineNo, rowLine);
                    //1808alpha006 eramakerExの仕様通りにrenameを無制限に適用する
                    if (Config.UseRenameFile && ParserMediator.RenameDic != null &&(rowLine.IndexOf("[[") >= 0) && (rowLine.IndexOf("]]") >= 0))
                    {
                        foreach (KeyValuePair<string, string> pair in ParserMediator.RenameDic)
                            rowLine = rowLine.Replace(pair.Key, pair.Value);
                        st = new StringStream(rowLine);
                    }

                    //命令文の一部を[[]]置換できるのはよろしくないので、処理位置変更に対応
                    //全置換は弾く
                    if (st.Current == '[' && st.Next != '[')
                    {
                        st.ShiftNext();
                        string token = LexicalAnalyzer.ReadSingleIdentifier(st);
                        LexicalAnalyzer.SkipWhiteSpace(st);
                        string token2 = LexicalAnalyzer.ReadSingleIdentifier(st);
                        if ((string.IsNullOrEmpty(token)) || (st.Current != ']'))
                            ParserMediator.Warn("[]の使い方が不正です", position, 1);
                        ppstate.AddKeyWord(token, token2, position);
                        st.ShiftNext();
                        if (!st.EOS)
                            ParserMediator.Warn("[" + token + "]の後ろは無視されます。", position, 1);
                        continue;
                    }
                    //if ((skip) || (Program.DebugMode && ifndebug) || (!Program.DebugMode && ifdebug))
                    //	continue;
                    if (ppstate.Disabled)
                        continue;
                    //ここまでプリプロセッサ

                    if (st.Current == '#')
                    {
                        if ((lastLine == null) || !(lastLine is FunctionLabelLine))
                        {
                            ParserMediator.Warn("関数宣言の直後以外で#行が使われています", position, 1);
                            continue;
                        }
                        if (!LogicalLineParser.ParseSharpLine((FunctionLabelLine)lastLine, st, position, isOnlyEvent))
                            noError = false;
                        continue;
                    }
                    if ((st.Current == '$') || (st.Current == '@'))
                    {
                        bool isFunction = (st.Current == '@');
                        nextLine = LogicalLineParser.ParseLabelLine(st, position, output);
                        if (isFunction)
                        {
                            FunctionLabelLine label = (FunctionLabelLine)nextLine;
                            lastLabelLine = label;
                            if (label is InvalidLabelLine)
                            {
                                noError = false;
                                ParserMediator.Warn(nextLine.ErrMes, position, 2);
                                labelDic.AddInvalidLabel(label);
                            }
                            else// if (label is FunctionLabelLine)
                            {
                                labelDic.AddLabel(label);
                                if (!label.IsEvent && (Config.WarnNormalFunctionOverloading || Program.AnalysisMode))
                                {
                                    FunctionLabelLine seniorLabel = labelDic.GetSameNameLabel(label);
                                    if (seniorLabel != null)
                                    {
                                        //output.NewLine();
                                        ParserMediator.Warn("関数@" + label.LabelName + "は既に定義(" + seniorLabel.Position.Filename + "の" + seniorLabel.Position.LineNo.ToString() + "行目)されています", position, 1);
                                        funcCount = -1;
                                    }
                                }
                                funcCount++;
                                if (Program.AnalysisMode && (Config.PrintCPerLine > 0 && (funcCount % Config.PrintCPerLine) == 0))
                                {
                                    output.NewLine();
                                    output.Print(" ");
                                }
                            }
                        }
                        else
                        {
                            if (nextLine is GotoLabelLine)
                            {
                                GotoLabelLine gotoLabel = (GotoLabelLine)nextLine;
                                gotoLabel.ParentLabelLine = lastLabelLine;
                                if (lastLabelLine != null && !labelDic.AddLabelDollar(gotoLabel))
                                {
                                    ScriptPosition pos = labelDic.GetLabelDollar(gotoLabel.LabelName, lastLabelLine).Position;
                                    ParserMediator.Warn("ラベル名$" + gotoLabel.LabelName + "は既に同じ関数内(" + pos.Filename + "の" + pos.LineNo.ToString() + "行目)で使用されています", position, 2);
                                }
                            }
                        }
                        if (nextLine is InvalidLine)
                        {
                            noError = false;
                            ParserMediator.Warn(nextLine.ErrMes, position, 2);
                        }
                    }
                    else
                    {
                        //1808alpha006 処理位置変更
                        ////全置換はここで対応
                        ////1756beta1+++ 最初に全置換してしまうと関数定義を_Renameでとか論外なことができてしまうので永久封印した
                        //if (ParserMediator.RenameDic != null && st.CurrentEqualTo("[[") && (rowLine.TrimEnd().IndexOf("]]") == rowLine.TrimEnd().Length - 2))
                        //{
                        //    string replacedLine = st.Substring();
                        //    foreach (KeyValuePair<string, string> pair in ParserMediator.RenameDic)
                        //        replacedLine = replacedLine.Replace(pair.Key, pair.Value);
                        //    st = new StringStream(replacedLine);
                        //}
                        nextLine = LogicalLineParser.ParseLine(st, position, output);
                        if (nextLine == null)
                            continue;
                        if (nextLine is InvalidLine)
                        {
                            noError = false;
                            ParserMediator.Warn(nextLine.ErrMes, position, 2);
                        }
                    }
                    if (lastLabelLine == null)
                        ParserMediator.Warn("関数が定義されるより前に行があります", position, 1);
                    nextLine.ParentLabelLine = lastLabelLine;
                    lastLine = addLine(nextLine, lastLine);
                }
                addLine(new NullLine(), lastLine);
                position = new ScriptPosition(eReader.Filename, -1, null);
                ppstate.FileEnd(position);
            }
            finally
            {
                eReader.Close();
            }
            return;
        }
Example #3
0
 private void OnEventReceived(BaseEvent ommEvent)
 {
     if (ommEvent == null)
     {
         return;
     }
     if (ommEvent is EventDECTSubscriptionMode dectSubscriptionMode)
     {
         DECTSubscriptionModeChanged?.Invoke(this, new OmmEventArgs <EventDECTSubscriptionMode>(dectSubscriptionMode));
     }
     else if (ommEvent is EventAlarmCallProgress alarmCallProgress)
     {
         AlarmCallProgress?.Invoke(this, new OmmEventArgs <EventAlarmCallProgress>(alarmCallProgress));
     }
     else if (ommEvent is EventRFPSummary rfpSummary)
     {
         RfpSummary?.Invoke(this, new OmmEventArgs <EventRFPSummary>(rfpSummary));
     }
     else if (ommEvent is EventPPDevSummary ppDevSummary)
     {
         PPDevSummary?.Invoke(this, new OmmEventArgs <EventPPDevSummary>(ppDevSummary));
     }
     else if (ommEvent is EventPPUserSummary ppUserSummary)
     {
         PPUserSummary?.Invoke(this, new OmmEventArgs <EventPPUserSummary>(ppUserSummary));
     }
     else if (ommEvent is EventPPDevCnf ppDevCnf)
     {
         PPDevCnf?.Invoke(this, new OmmEventArgs <EventPPDevCnf>(ppDevCnf));
     }
     else if (ommEvent is EventPPUserCnf ppUserCnf)
     {
         PPUserCnf?.Invoke(this, new OmmEventArgs <EventPPUserCnf>(ppUserCnf));
     }
     else if (ommEvent is EventPPCnf ppCnf)
     {
         PPCnf?.Invoke(this, new OmmEventArgs <EventPPCnf>(ppCnf));
     }
     else if (ommEvent is EventRFPState rfpState)
     {
         RFPState?.Invoke(this, new OmmEventArgs <EventRFPState>(rfpState));
     }
     else if (ommEvent is EventRFPCnf rfpCnf)
     {
         RFPCnf?.Invoke(this, new OmmEventArgs <EventRFPCnf>(rfpCnf));
     }
     else if (ommEvent is EventRFPSyncRel rfpSyncRel)
     {
         RFPSyncRel?.Invoke(this, new OmmEventArgs <EventRFPSyncRel>(rfpSyncRel));
     }
     else if (ommEvent is EventRFPSyncQuality rfpSyncQuality)
     {
         RFPSyncQuality?.Invoke(this, new OmmEventArgs <EventRFPSyncQuality>(rfpSyncQuality));
     }
     else if (ommEvent is EventStbStateChange stbStateChange)
     {
         StbStateChange?.Invoke(this, new OmmEventArgs <EventStbStateChange>(stbStateChange));
     }
     else if (ommEvent is EventLicenseCnf licenseCnf)
     {
         LicenseCnf?.Invoke(this, new OmmEventArgs <EventLicenseCnf>(licenseCnf));
     }
     else if (ommEvent is EventMessageProgress messageProgress)
     {
         MessageProgress?.Invoke(this, new OmmEventArgs <EventMessageProgress>(messageProgress));
     }
     else if (ommEvent is EventMessageConfirmation messageConfirmation)
     {
         MessageConfirmation?.Invoke(this, new OmmEventArgs <EventMessageConfirmation>(messageConfirmation));
     }
     else if (ommEvent is EventMessageQueueEmpty messageQueueEmpty)
     {
         MessageQueueEmpty?.Invoke(this, new OmmEventArgs <EventMessageQueueEmpty>(messageQueueEmpty));
     }
     else if (ommEvent is EventMessageSend messageSend)
     {
         MessageSend?.Invoke(this, new OmmEventArgs <EventMessageSend>(messageSend));
     }
     else if (ommEvent is EventPositionHistory positionHistory)
     {
         PositionHistory?.Invoke(this, new OmmEventArgs <EventPositionHistory>(positionHistory));
     }
     else if (ommEvent is EventPositionInfo positionInfo)
     {
         PositionInfo?.Invoke(this, new OmmEventArgs <EventPositionInfo>(positionInfo));
     }
     else if (ommEvent is EventPositionTrack positionTrack)
     {
         PositionTrack?.Invoke(this, new OmmEventArgs <EventPositionTrack>(positionTrack));
     }
     else if (ommEvent is EventPositionRequest positionRequest)
     {
         PositionRequest?.Invoke(this, new OmmEventArgs <EventPositionRequest>(positionRequest));
     }
     else if (ommEvent is EventPPState ppState)
     {
         PPState?.Invoke(this, new OmmEventArgs <EventPPState>(ppState));
     }
     else if (ommEvent is EventDECTAuthCodeCnf dectAuthCodeCnf)
     {
         DECTAuthCodeCnf?.Invoke(this, new OmmEventArgs <EventDECTAuthCodeCnf>(dectAuthCodeCnf));
     }
 }