コード例 #1
0
ファイル: LoraHandle.cs プロジェクト: k477522/Lora-Settings
 /// <summary>
 /// 讀取訊息
 /// </summary>
 /// <param name="msg">字串訊息</param>
 public void Read(string msg)
 {
     //該訊息為Lora回傳字串
     if (msg.Contains("ans"))
     {
         //根據=分割
         string ans = msg.Split('=').Last();
         //取得Lora Mode
         if (msg.Contains("LoraMode"))
         {
             Mode mode = Mode.MASTER;
             //Master
             if (ans == " MASTER")
             {
                 mode = Mode.MASTER;
             }
             //Slave
             else
             {
                 mode = Mode.SLAVE;
             }
             ModeChange?.Invoke(this, mode);
         }
     }
 }
コード例 #2
0
 private void Start()
 {
     Goal   = GameObject.Find("Goal");                  //Playerという名前のオブジェクトを探しPlayerに入れる
     Player = GameObject.Find("Player");                //Playerという名前のオブジェクトを探しPlayerに入れる
     script = Player.GetComponent <ModeChange>();       //PlayerControllerというスクリプトの情報をscriptにいれる
     hidari = GameObject.Find("k");
 }
コード例 #3
0
    void Start()
    {
        _modeSelector = new ModeSelector();

        ModeChange modeChange = GetComponent <ModeChange>();

        modeChange.SetModeSelector(_modeSelector);
        var leaserPointer  = GetComponent <LeaserPointer>();
        var grabObject     = GetComponent <GrabObject>();
        var fake6dof       = GetComponent <Fake6dof>();
        var move6way       = GetComponent <Move6way>();
        var moveWarp       = GetComponent <MoveWarp>();
        var moveSegwayLike = GetComponent <MoveSegwayLike>();

        _modeSelector.AddMode("Grab", new IModeFunc[] { modeChange, leaserPointer, grabObject });
        _modeSelector.AddMode("MoveWarp", new IModeFunc[] { modeChange, leaserPointer, moveWarp });
        _modeSelector.AddMode("Move6way", new IModeFunc[] { modeChange, move6way });
        _modeSelector.AddMode("MoveSegway", new IModeFunc[] { modeChange, fake6dof, moveSegwayLike });
        _modeSelector.AddMode("Fake6Dof", new IModeFunc[] { modeChange, fake6dof });

        _modeSelector.onSelect += (mode) => {
            _modeText.text = mode;
        };

        _modeSelector.SelectFirst();
    }
コード例 #4
0
 private void Start()
 {
     Key    = GameObject.Find("Key");                  //Playerという名前のオブジェクトを探しPlayerに入れる
     Player = GameObject.Find("Player");               //Playerという名前のオブジェクトを探しPlayerに入れる
     script = Player.GetComponent <ModeChange>();      //PlayerControllerというスクリプトの情報をscriptにいれる
     migi   = GameObject.Find("g");
 }
コード例 #5
0
ファイル: ModeChange.cs プロジェクト: Vylantze/Chaos-Children
 // overloaded version
 public bool compare(ModeChange mode)
 {
     if (mode == null) {
         print("Error with mode");
         return false;
     }
     else {
         int colour = mode.currentColour;
         return currentColour == colour; // if they are the same, return true
     }
 }
コード例 #6
0
 void ChangeMode(object sender, EventArgs e)
 {
     ModeChange.ChangeMode();
     if (GlobalVar.showHow == true)
     {
         learnerMode.IsVisible  = false;
         modeChangerButton.Text = AppResources.btnShowMeHow;
     }
     else
     {
         learnerMode.IsVisible  = true;
         modeChangerButton.Text = AppResources.btnHideHow;
     }
 }
コード例 #7
0
 void ChangeMode(object sender, EventArgs e)
 {
     ModeChange.ChangeMode();
     if (GlobalVar.showHow == true)
     {
         learnerMode.IsVisible  = false;
         modeChangerButton.Text = "Show me how";
     }
     else
     {
         learnerMode.IsVisible  = true;
         modeChangerButton.Text = "Hide how";
     }
 }
コード例 #8
0
    void Update()
    {
        player = GameObject.Find("Player");                //Playerという名前のオブジェクトを探しPlayerに入れる
        script = player.GetComponent <ModeChange>();       //PlayerControllerというスクリプトの情報をscriptにいれる

        //消す
        if (script.Mode == 2)
        {
            this.gameObject.SetActive(false);
        }
        //出す
        else if (script.Mode == 1 || script.Mode == 3)
        {
            this.gameObject.SetActive(true);
        }
    }
コード例 #9
0
    void Start()
    {
        goal        = GameObject.FindWithTag("goal");
        reset       = goal.GetComponent <reset3>();
        rd2d        = GetComponent <Rigidbody2D>();
        boxCollider = GetComponent <BoxCollider2D>();
        animator    = GetComponent <Animator>();
        //Component取得
        audioSource = GetComponent <AudioSource>();
        anim        = GetComponent <Animator>();

        Player = GameObject.Find("Player");                     //Playerという名前のオブジェクトを探しPlayerに入れる
        script = Player.GetComponent <ModeChange>();

        dm = GetComponent <damegeAnimation>();
    }
コード例 #10
0
    void Update()
    {
        if (this._frightenedTimer > 0)
        {
            // Ghosts are frightened, do the frightened timer:
            this._frightenedTimer -= Time.deltaTime;
            if (this._frightenedTimer <= 0)
            {
                this._ghostKillCombo = 0;
                Debug.Log("Fright time over!");
            }
        }
        else
        {
            // Ghosts are not frightened, do the mode-timer:
            if (this._currentDuration > 0)
            {
                this._currentDuration -= Time.deltaTime;
            }
            else
            {
                // Check if there are changes left:
                if (this._currentModeIteration >= MODE_CHANGES.Length)
                {
                    return;
                }
                // Countdown is over:
                ModeChange change = MODE_CHANGES[_currentModeIteration];
                foreach (GhostHolder ghost in this._allGhosts)
                {
                    ghost.AI.SetMode(change.Mode);
                }
                // new Countdown:
                this._currentDuration = change.Duration;
                this._currentModeIteration++;

                Debug.Log("Time over, next mode " + change.Mode + " for " + change.Duration + "s");
            }
        }
    }
コード例 #11
0
ファイル: CameraControl.cs プロジェクト: Chapmania/Juniper
 private void OnModeChange()
 {
     onModeChange?.Invoke();
     ModeChange?.Invoke(ControlMode);
 }
コード例 #12
0
ファイル: Thunder.cs プロジェクト: Vylantze/Chaos-Children
 // Use this for initialization
 void Start()
 {
     colour = GetComponent<ModeChange>();
     colour.currentColour = type;
 }
コード例 #13
0
ファイル: Events.cs プロジェクト: Holladiewal/IRCLib
 public void OnModeChangeEvent(ModeChangeEventArgs args)
 {
     ModeChange?.Invoke(this, args);
 }
コード例 #14
0
 public Mode(ModeRun run, ModeChange enter, ModeChange exit)
 {
     Run   = run;
     Enter = enter;
     Exit  = exit;
 }
コード例 #15
0
        public UtopiaMessage decodePayload()
        {
            //  Decode the payload
            UtopiaMessage evt = null;

            if ((this.msgID == StimulusEvent.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read "
                                             + StimulusEvent.MSGNAME + " message");
                }

                evt = StimulusEvent.deserialize(this.msgbuffer);
            }
            else if ((this.msgID == PredictedTargetProb.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read "
                                             + PredictedTargetProb.MSGNAME + " message");
                }

                evt = PredictedTargetProb.deserialize(this.msgbuffer);
            }
            else if ((this.msgID == ModeChange.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read " + ModeChange.MSGNAME + " message");
                }

                evt = ModeChange.deserialize(this.msgbuffer);
            }
            else if ((this.msgID == Reset.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read " + Reset.MSGNAME + " message");
                }

                evt = Reset.deserialize(this.msgbuffer);
            }
            else if ((this.msgID == NewTarget.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read " + NewTarget.MSGNAME + " message");
                }

                evt = NewTarget.deserialize(this.msgbuffer);
            }
            else if ((this.msgID == Heartbeat.MSGID))
            {
                if ((VERBOSITY > 2))
                {
                    System.Console.WriteLine("Trying to read " + Heartbeat.MSGNAME + " message");
                }

                evt = Heartbeat.deserialize(this.msgbuffer);
            }
            else
            {
                throw new ClientException("Unsupported Message type: " + this.msgID);
            }

            if ((VERBOSITY > 1))
            {
                System.Console.WriteLine("Got message: " + evt.ToString());
            }

            return(evt);
        }
コード例 #16
0
        private static void sendTestMessages(UtopiaClient utopiaClient, int offset)
        {
            //  write some test messages..
            int[] objIDs = new int[10];
            for (int i = 0; (i < objIDs.Length); i++)
            {
                objIDs[i] = i;
            }

            int[] objState = new int[objIDs.Length];
            //  send some test StimulusEvents
            for (int i = 0; (i < 5); i++)
            {
                for (int j = 0; (j < objState.Length); j++)
                {
                    objState[j] = (i + offset);
                }

                StimulusEvent e = new StimulusEvent(utopiaClient.getTimeStamp(), objIDs, objState);
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                try {
                    utopiaClient.sendMessage(e);
                }
                catch (IOException ex) {
                    Console.WriteLine(ex);
                }

                System.Threading.Thread.Sleep(1000);
            }

            {
                //  PREDICTEDTARGETPROB
                PredictedTargetProb e = new PredictedTargetProb(utopiaClient.getTimeStamp(), 1, ((float)(0.99)));
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }

            {
                //  PREDICTEDTARGETDIST
                PredictedTargetDist e = new PredictedTargetDist(utopiaClient.getTimeStamp(), new int[] { 1, 2, 3 }, new float[] { .1f, .2f, .3f });
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
            {
                //  HEARTBEAT V.2.0
                Heartbeat e = new Heartbeat(utopiaClient.getTimeStamp(), "TestMessage");
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
            // LOG
            {
                Log e = new Log(utopiaClient.getTimeStamp(), "ClientTest");
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
            {
                //  MODECHANGE
                ModeChange e = new ModeChange(utopiaClient.getTimeStamp(), "ClientTest");
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
            {
                //  RESET
                Reset e = new Reset(utopiaClient.getTimeStamp());
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
            {
                //  NEWTARGET
                NewTarget e = new NewTarget(utopiaClient.getTimeStamp());
                Console.WriteLine("Sending: " + e.ToString() + " -> server");
                utopiaClient.sendMessage(e);
                System.Threading.Thread.Sleep(1000);
            }
        }
コード例 #17
0
 void Start()
 {
     player = GameObject.Find("Player");                //Playerという名前のオブジェクトを探しPlayerに入れる
     script = player.GetComponent <ModeChange>();       //PlayerControllerというスクリプトの情報をscriptにいれる
 }
コード例 #18
0
 // Use this for initialization
 void Start()
 {
     player = MasterPlayer.mainPlayer.GetComponent<ModeChange> ();
     activePower = GetComponentsInChildren<Image>();
     selectSprite ();
 }
コード例 #19
0
ファイル: SettingsForm.cs プロジェクト: nastprol/Piano
 private void ModeBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     settings.ModeTypeName = modes[modeBox.SelectedItem.ToString()].Name;
     ModeChange?.Invoke(sender, e);
 }