/// <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); } } }
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"); }
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(); }
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"); }
// 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 } }
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; } }
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"; } }
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); } }
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>(); }
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"); } } }
private void OnModeChange() { onModeChange?.Invoke(); ModeChange?.Invoke(ControlMode); }
// Use this for initialization void Start() { colour = GetComponent<ModeChange>(); colour.currentColour = type; }
public void OnModeChangeEvent(ModeChangeEventArgs args) { ModeChange?.Invoke(this, args); }
public Mode(ModeRun run, ModeChange enter, ModeChange exit) { Run = run; Enter = enter; Exit = exit; }
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); }
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); } }
void Start() { player = GameObject.Find("Player"); //Playerという名前のオブジェクトを探しPlayerに入れる script = player.GetComponent <ModeChange>(); //PlayerControllerというスクリプトの情報をscriptにいれる }
// Use this for initialization void Start() { player = MasterPlayer.mainPlayer.GetComponent<ModeChange> (); activePower = GetComponentsInChildren<Image>(); selectSprite (); }
private void ModeBox_SelectedIndexChanged(object sender, EventArgs e) { settings.ModeTypeName = modes[modeBox.SelectedItem.ToString()].Name; ModeChange?.Invoke(sender, e); }