/// <summary> /// 2点間の移動時間を取得 /// </summary> /// <param name="origin"></param> /// <param name="destination"></param> /// <param name="apiKey"></param> /// <returns></returns> public static double GetDuration(string origin, string destination, MovingMode mode, string apiKey) { double ret = 0; WebResponse response = null; try { string url = @"https://maps.googleapis.com/maps/api/distancematrix/json?origins=" + origin + "&destinations=" + destination + "&mode=" + mode.ToString() + "&key=" + apiKey; HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); response = request.GetResponse(); Stream dataStream = response.GetResponseStream(); StreamReader sReader = new StreamReader(dataStream); string jsonString = sReader.ReadToEnd(); Debug.Write(jsonString); var jo = JObject.Parse(jsonString); JToken jt = jo.SelectToken("$.rows..elements..duration.value"); ret = double.Parse(StringUtil.NullBlankToZero(jt.ToString())); return(ret); } finally { response.Close(); } }
void SelectionRangeSlider_MouseDown(object sender, MouseEventArgs e) { if (Sliders.Count < 1) return; int contMin = 255; Slider contrSlider = Sliders[0]; foreach (var slider in Sliders) { int pointedValue = slider.Min + e.X * (slider.Max - slider.Min) / Width; int distMin = Math.Abs(pointedValue - slider.SelectedMin); int distMax = Math.Abs(pointedValue - slider.SelectedMax); int minDist = Math.Min(distMin, distMax); if (minDist < contMin) { contMin = minDist; contrSlider = slider; currentSlider = slider; } else continue; if (minDist == distMin) movingMode = MovingMode.MovingMin; else movingMode = MovingMode.MovingMax; } SelectionRangeSlider_MouseMove(sender, e); }
/* * State machine for moving mode */ private void SetMovingMode(MovingMode mode) { // Exit state switch (movingMode) { case MovingMode.sprint: _common.SetAnimationMode(CommonBehavior.AnimationMode.none); break; case MovingMode.stunned: _common.SetAnimationMode(CommonBehavior.AnimationMode.none); break; } movingMode = mode; // Entry state switch (movingMode) { // reset sprint cool down time and sprint duration when enter sprint mode case MovingMode.sprint: tmp_sprintCoolDownTime = sprintCoolDownTime; tmp_sprintDuration = sprintDuration; _common.SetAnimationMode(CommonBehavior.AnimationMode.dashing); break; case MovingMode.stunned: tmp_stunDuration = stunDuration; _common.SetAnimationMode(CommonBehavior.AnimationMode.stunned); break; } }
public void SendSound(float soundLevel, MovingMode movingMode) { //If the box isn't checked, send the sound if (!OnlyPlayer && MovementManager.GetEnemy().activeSelf) { MovementManager.SetDestination(this.transform.position, soundLevel, movingMode); } }
public MainWindow() { InitializeComponent(); Action switchMode = () => { timer2.Stop(); switch (mode) { case MovingMode.Rebound: mode = MovingMode.Follow; setMode.Text = "跟随"; break; case MovingMode.Follow: mode = MovingMode.Stop; setMode.Text = "停止"; break; case MovingMode.Stop: mode = MovingMode.Rebound; setMode.Text = "反弹"; break; } Animation(); }; icon.DoubleClick += (object sender, EventArgs e) => switchMode(); setMode.Text = "反弹"; setMode.Click += (object sender, EventArgs e) => switchMode(); author.Text = "作者"; author.Click += (object sender, EventArgs e) => new author().Show(); onQuit.Text = "退出"; onQuit.Click += (object sender, EventArgs e) => { icon.Visible = false; icon.Dispose(); Environment.Exit(1); }; menu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { author, onQuit }); icon.Icon = Properties.Resources.disc; icon.ContextMenu = menu; icon.Visible = true; ShowInTaskbar = false; //KeyDown += (object sender, KeyEventArgs e) => { if (e.Key == Key.Space) dragging = true; }; //KeyUp += (object sender, KeyEventArgs e) => dragging = false; MouseDown += (object sender, MouseButtonEventArgs e) => DragMove();//{ if (dragging) DragMove(); }; /* * timer1.Interval = new TimeSpan(0, 0, 0, 0, 500); * timer1.Tick += (object sender, EventArgs e) => picChange(); * timer1.Start(); */ Animation(); }
public YTMenuMovingComponent(Menu menu, MovingMode mode) { _Menu = menu; _MovingMode = mode; _MovingState = MovingState.Static; _ScreenWidth = (int)WindowsHandler.GetScreenWidth(); _ScreenHeight = (int)WindowsHandler.GetScreenHeight(); _xQueue = new Queue <double>(); _yQueue = new Queue <double>(); _ShakingQueue = new Queue <double>(); }
public JBEnemyCharacterData(int level) { number = 0; name = ""; weapon = BossWeapon.none; movemode = MovingMode.none; attackmode = 0; attackpower = 0; attackdistance = 0; existType = BossExistType.NONE; hp = 0; speed = 0; score = 0; }
void updatePino() { pino.SetActive(true); tamashibi.SetActive(false); boss.SetActive(false); title.GetComponent <Text>().text = "Gallely:Character:Enemy"; charaname.GetComponent <Text>().text = "ピノキオ"; main.GetComponent <Text>().text = "嘘を吐くと鼻が伸びるらしい存在\n嘘一つとて人を守るための嘘と\n苦しめる嘘がある\n彼らはきっとその嘘で\n苦しみを与えてしまったのだろう\n鼻の先が血に染まる\nかつて見たあの人の姿はもう見えない\n……別に鼻の先で人を刺すことは\nしないのでご安心を"; from.GetComponent <Text>().text = "出会えるところ:Chapter1 森の中"; if (InputTime == 0) { if (Input.GetKeyDown("p") || 1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Boss; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } else if (Input.GetKeyDown("q") || -1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Tamashibi; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } } if (InputTime > 0) { if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0) { InputTime = 0; } else { InputTime -= 5; } } if (Input.GetKeyDown("a") || Input.GetButtonDown("Attack")) { action_type = Random.Range(0, 4); if (action_type > 2) { pino.GetComponent <Animator> ().SetTrigger("attack"); } else if (action_type > 0) { pino.GetComponent <Animator> ().SetTrigger("die"); } } }
void updateBoss() { boss.SetActive(true); pino.SetActive(false); hero.SetActive(false); title.GetComponent <Text>().text = "Gallely:Character:Boss"; charaname.GetComponent <Text>().text = "青い鳥"; main.GetComponent <Text>().text = "ある兄妹は一つの結論にたどり着いた\n幸福とは一人では得られない\n他者との比較が幸福の源であると\n『優越感』こそが幸福の正体であると\nだから兄は\n妹の世話をして過ごすことにした\n妹は\n兄の時間を奪い過ごすことにした\n青い鳥はその兄妹を\n紅に染まった瞳で見つめていた"; from.GetComponent <Text>().text = "出会えるところ:Chapter1 森の最奥"; if (InputTime == 0) { if (Input.GetKeyDown("p") || 1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Hero; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } else if (Input.GetKeyDown("q") || -1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Pino; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } } if (InputTime > 0) { if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0) { InputTime = 0; } else { InputTime -= 5; } } if (Input.GetKeyDown("a") || Input.GetButtonDown("Attack")) { action_type = Random.Range(0, 4); if (action_type > 2) { boss.GetComponent <Animator> ().SetTrigger("attack1"); } else if (action_type > 0) { boss.GetComponent <Animator> ().SetTrigger("attack2"); } } }
//Sets the destination which the AI should move to public void SetDestination(Vector3 pos, float soundLevel, MovingMode movingMode) { if (Vector3.Distance(Enemy.transform.position, pos) <= MaxHearingDistanceRun && movingMode == MovingMode.mM_Run) { Enemy.SetDestination(pos); } else if (Vector3.Distance(Enemy.transform.position, pos) <= MaxHearingDistanceWalk && movingMode == MovingMode.mM_Walk) { Enemy.SetDestination(pos); } else if (Vector3.Distance(Enemy.transform.position, pos) <= MaxHearingDistanceCrouch && movingMode == MovingMode.mM_Crouched) { Enemy.SetDestination(pos); } else if (movingMode == MovingMode.mM_Null && soundLevel > 5) { Enemy.SetDestination(pos); } }
void updateKakashi() { kakashi.SetActive(true); hero.SetActive(false); tamashibi.SetActive(false); title.GetComponent <Text>().text = "Gallely:Character:Enemy"; charaname.GetComponent <Text>().text = "カカシくん"; main.GetComponent <Text>().text = "森の案内人。看板は彼が持参したもの\n攻撃のやり方を教えてくれるが\nその攻撃に巻き込まれ\n命を落とすこともしばしば\n棒部分の先端で敵を刺すことが\n出来るとか出来ないとか……\n物事を教えることが善意なのか\n悪意なのかは彼のみぞ知る\n"; from.GetComponent <Text>().text = "出会えるところ:Chapter1 森の入り口"; if (InputTime == 0) { if (Input.GetKeyDown("p") || 1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Tamashibi; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } else if (Input.GetKeyDown("q") || -1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Hero; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } } if (InputTime > 0) { if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0) { InputTime = 0; } else { InputTime -= 5; } } if (Input.GetKeyDown("a") || Input.GetButtonDown("Attack")) { kakashi.GetComponent <Animator> ().SetTrigger("die"); audioSource.PlayOneShot(audioClip[16]); //ボイス } }
private void SetMovingMode(MovingMode mode) { // Exit state switch (movingMode) { case MovingMode.stunned: _common.SetAnimationMode(CommonBehavior.AnimationMode.none); break; } movingMode = mode; // Entry state switch (movingMode) { case MovingMode.stunned: tmp_stunDuration = stunDuration; _common.SetAnimationMode(CommonBehavior.AnimationMode.stunned); break; } }
void updateTamashibi() { tamashibi.SetActive(true); kakashi.SetActive(false); pino.SetActive(false); title.GetComponent <Text>().text = "Gallely:Character:Enemy"; charaname.GetComponent <Text>().text = "タマシビ"; main.GetComponent <Text>().text = "彷徨える魂の片鱗\nおどろおどろしい喜びの顔と\n悲しみの顔を見せ、襲いかかってくる\n彷徨える魂は在るべきところへ\n安らかに眠らせてあげよう"; from.GetComponent <Text>().text = "出会えるところ:Chapter1 森の中"; if (InputTime == 0) { if (Input.GetKeyDown("p") || 1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Pino; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } else if (Input.GetKeyDown("q") || -1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Kakashi; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } } if (InputTime > 0) { if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0) { InputTime = 0; } else { InputTime -= 5; } } if (Input.GetKeyDown("a") || Input.GetButtonDown("Attack")) { tamashibi.GetComponent <Animator> ().SetTrigger("attack"); } }
// Use this for initialization void Start() { _trans = gameObject.GetComponent <Transform>(); _rigid = gameObject.GetComponent <Rigidbody>(); _rend = gameObject.GetComponent <Renderer>(); _common = this.GetComponent <CommonBehavior>(); movingMode = MovingMode.control; // Initialize tmp variables tmp_sprintDuration = sprintDuration; tmp_sprintCoolDownTime = sprintCoolDownTime; tmp_kickCoolDownTime = kickCoolDownTime; tmp_stunDuration = stunDuration; // Initialize input names horizontalInputName = "Horizontal_P" + ((int)team).ToString(); verticalInputName = "Vertical_P" + ((int)team).ToString(); sprintInputName = "Sprint_P" + ((int)team).ToString(); kickInputName = "Kick_P" + ((int)team).ToString(); }
// Update is called once per frame void Update() { if (targetObject == null) { return; } homingDir = targetObject.transform.position - gameObject.transform.position; switch (mode) { case MovingMode.EXPLOTION: updateExplosion(); break; case MovingMode.EXPLOTION_HOMING: updateExplosionHoming(); break; case MovingMode.HOMING: updateHoming(); break; } //Debug.Log( mode ); //Debug.Log( gameObject.transform.position ); // Debug.Log( homingDir.magnitude ); timeFromExplotion += Time.deltaTime; //自分自身を足していく if (mode == MovingMode.EXPLOTION && timeFromExplotion > explosionTime * explotionRate) { mode = MovingMode.EXPLOTION_HOMING; } if (mode == MovingMode.EXPLOTION_HOMING && timeFromExplotion > explosionTime) { mode = MovingMode.HOMING; } }
public void SetMovingMode(MovingMode movingMode) { _movingMode = movingMode; Setup(); }
public override void OnInspectorGUI() { //base.OnInspectorGUI(); _mechanicalPart = target as RotatingMechanicalPart; EditorGUI.BeginChangeCheck(); _selectedMenuIndex = GUILayout.Toolbar(_selectedMenuIndex, _toolbarMenuOptions); if (EditorGUI.EndChangeCheck()) { GUI.FocusControl(null); } //Set up the box style if null if (_menuBoxStyle == null) { _menuBoxStyle = new GUIStyle(GUI.skin.box); _menuBoxStyle.normal.textColor = GUI.skin.label.normal.textColor; _menuBoxStyle.fontStyle = FontStyle.Bold; _menuBoxStyle.alignment = TextAnchor.UpperLeft; } GUILayout.BeginVertical(_menuBoxStyle); if (_toolbarMenuOptions[_selectedMenuIndex] == "Settings") { /* * SETTINGS */ GUILayout.Label("SETTINGS", EditorStyles.boldLabel); EditorGUI.BeginChangeCheck(); float movementInput = EditorGUILayout.Slider("Rotation Input", _mechanicalPart.MovementInput, 0f, 1f); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Input"); _mechanicalPart.MovementInput = movementInput; MarkSceneAlteration(); } EditorGUI.BeginChangeCheck(); MovingMode movingMode = (MovingMode)EditorGUILayout.EnumPopup("Moving Mode", _mechanicalPart.MovingMode); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Moving Mode"); _mechanicalPart.MovingMode = movingMode; MarkSceneAlteration(); } if (_mechanicalPart.MovingMode == MovingMode.Function) { EditorGUI.BeginChangeCheck(); AnimationCurve movementFunction = EditorGUILayout.CurveField("Movement Function", _mechanicalPart.MovementFunction); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Movement Function"); _mechanicalPart.MovementFunction = movementFunction; MarkSceneAlteration(); } } EditorGUI.BeginChangeCheck(); Vector3 minRotation = EditorGUILayout.Vector3Field("Min Rotation", _mechanicalPart.Min); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Input"); _mechanicalPart.Min = minRotation; MarkSceneAlteration(); } EditorGUI.BeginChangeCheck(); Vector3 maxRotation = EditorGUILayout.Vector3Field("Max Rotation", _mechanicalPart.Max); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Input"); _mechanicalPart.Max = maxRotation; MarkSceneAlteration(); } EditorGUI.BeginChangeCheck(); Vector3 defaultRotation = EditorGUILayout.Vector3Field("Default Rotation", _mechanicalPart.Default); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(_mechanicalPart, "Changed Input"); _mechanicalPart.Default = defaultRotation; MarkSceneAlteration(); } GUILayout.Label("SETTINGS OPERATIONS", EditorStyles.boldLabel); GUILayout.BeginHorizontal(); GUILayout.BeginVertical(); if (GUILayout.Button("Set Current as Min")) { _mechanicalPart.SetCurrentAsMin(); MarkSceneAlteration(); } if (GUILayout.Button("Reset to Min")) { _mechanicalPart.ResetToMin(); MarkSceneAlteration(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); if (GUILayout.Button("Set Current as Max")) { _mechanicalPart.SetCurrentAsMax(); MarkSceneAlteration(); } if (GUILayout.Button("Reset to Max")) { _mechanicalPart.ResetToMax(); MarkSceneAlteration(); } GUILayout.EndVertical(); GUILayout.BeginVertical(); if (GUILayout.Button("Set Current as Default")) { _mechanicalPart.SetCurrentAsDefault(); MarkSceneAlteration(); } if (GUILayout.Button("Reset to Default")) { _mechanicalPart.ResetToDefault(); MarkSceneAlteration(); } GUILayout.EndVertical(); GUILayout.EndHorizontal(); } else if (_toolbarMenuOptions[_selectedMenuIndex] == "Events") { GUILayout.Label("EVENTS", EditorStyles.boldLabel); serializedObject.Update(); _reachedMin = serializedObject.FindProperty("_reachedMin"); _reachedMax = serializedObject.FindProperty("_reachedMax"); _startedMovement = serializedObject.FindProperty("_startedMovement"); _finishedMovement = serializedObject.FindProperty("_finishedMovement"); EditorGUILayout.PropertyField(_reachedMin, new GUIContent("Reached Min")); EditorGUILayout.PropertyField(_reachedMax, new GUIContent("Reached Max")); EditorGUILayout.PropertyField(_startedMovement, new GUIContent("Started Movement")); EditorGUILayout.PropertyField(_finishedMovement, new GUIContent("Finished Movement")); serializedObject.ApplyModifiedProperties(); } GUILayout.EndVertical(); }
//以下はギャラリーキャラクターの該当キャラの動き void updateHero() { hero.SetActive(true); kakashi.SetActive(false); boss.SetActive(false); title.GetComponent <Text>().text = "Gallely:Character:Hero"; charaname.GetComponent <Text>().text = "レヴナント"; main.GetComponent <Text>().text = "この物語の主人公で記憶喪失の青年\n彼の求める記憶とは一体\nなんなのだろうか…"; from.GetComponent <Text>().text = "出会えるところ:Childishi Knight"; if (InputTime == 0) { if (Input.GetKeyDown("p") || 1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Kakashi; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } else if (Input.GetKeyDown("q") || -1 == Input.GetAxisRaw("Horizontal")) { mode = MovingMode.Boss; InputTime = 100; GetComponents <AudioSource> ()[0].Play(); } } if (InputTime > 0) { if (Input.GetAxisRaw("Vertical") == 0 && Input.GetAxisRaw("Horizontal") == 0) { InputTime = 0; } else { InputTime -= 5; } } if (Input.GetKeyDown("a") || Input.GetButtonDown("Attack")) { action_type = Random.Range(0, 7); if (action_type > 5) { voice = Random.Range(0, 2); if (voice == 0) { audioSource.PlayOneShot(audioClip[0]); //ボイス } else { audioSource.PlayOneShot(audioClip[1]); //ボイス } hero.GetComponent <Animator> ().SetTrigger("attack"); } else if (action_type > 4) { hero.GetComponent <Animator> ().SetTrigger("attack2"); audioSource.PlayOneShot(audioClip[2]); //ボイス } else if (action_type > 3) { hero.GetComponent <Animator> ().SetTrigger("jump"); audioSource.PlayOneShot(audioClip[5]); //ボイス } else if (action_type > 2) { voice = Random.Range(0, 2); if (voice == 0) { audioSource.PlayOneShot(audioClip[8]); //ボイス } else { audioSource.PlayOneShot(audioClip[9]); //ボイス } hero.GetComponent <Animator> ().SetTrigger("Dodge"); } else if (action_type > 1) { hero.GetComponent <Animator> ().SetTrigger("Dead"); voice = Random.Range(0, 2); if (voice == 0) { audioSource.PlayOneShot(audioClip[10]); //ボイス } else { audioSource.PlayOneShot(audioClip[11]); //ボイス } } else if (action_type > 0) { hero.GetComponent <Animator> ().SetTrigger("walk"); } } }