void DrawEditUI() { GUILayout.Label("事件类型 : " + mCurEvet.ToString()); mCurEvet.eventName = EditorGUILayout.TextField("事件名称", mCurEvet.eventName); mCurEvet.triggerTime = EditorGUILayout.FloatField("触发时间", mCurEvet.triggerTime); if (mCurEvet is ShowEffectEvent) { ShowEffectEvent effectEvent = (ShowEffectEvent)mCurEvet; effectEvent.effectName = EditorGUILayout.TextField("特效资源名", effectEvent.effectName); effectEvent.startPosition = EditorGUILayout.Vector3Field("初始位置", effectEvent.startPosition); } else if (mCurEvet is PlayAudioEvent) { PlayAudioEvent mAudioEvent = mCurEvet as PlayAudioEvent; mAudioEvent.audioName = EditorGUILayout.TextField("音效资源名", mAudioEvent.audioName); } else if (mCurEvet is SetVelocityEvent) { SetVelocityEvent velocityEvent = mCurEvet as SetVelocityEvent; velocityEvent.velocity = EditorGUILayout.Vector3Field("设置速度", velocityEvent.velocity); } else if (mCurEvet is AiActionEvent) { AiActionEvent actionEvent = mCurEvet as AiActionEvent; actionEvent.actiomType = (EAiActionType)EditorGUILayout.EnumPopup("AI行为类型", actionEvent.actiomType); } }
private void PlayAudio(PlayAudioEvent paei) { //Change the music type if (paei.musicType == MusicType.MENU) { music.Stream = musicList[0]; music.Play(); } if (paei.uiSoundsType == UISoundsType.CLICK) { //If the target is not the map it must be one of the blobs so we want to play the impactsplat sound soundEffects.Stream = soundEffectsList[1]; soundEffects.Play(); } if (paei.soundEffectType == SoundEffectType.HIT) { if (playerReference == null) { playerReference = GetNode <Node>("../RedBlob"); } soundEffects.Position = ((Node2D)playerReference).Position; //Check the target is not the map if (!paei.AudioTarget.IsInGroup("Map")) { //If the target is not the map it must be one of the blobs so we want to play the impactsplat sound soundEffects.Stream = soundEffectsList[0]; soundEffects.Play(); } } }
private void PressSound() { PlayAudioEvent paei = new PlayAudioEvent(); paei.uiSoundsType = UISoundsType.CLICK; paei.FireEvent(); }
public void RigidBody2DBodyEntered(Node body) { if (body.IsInGroup("RedBlob")) { HitEvent hei = new HitEvent(); hei.target = (Node2D)body; hei.attacker = (Node2D)GetParent(); hei.damage = 50; hei.FireEvent(); } if (body.IsInGroup("BlueBlob")) { if (((BlueBlobCollision)body).Infected()) { HitEvent hei = new HitEvent(); hei.target = (Node2D)GetParent(); hei.attacker = (Node2D)body; hei.damage = 100; hei.FireEvent(); } } PlayAudioEvent paei = new PlayAudioEvent(); paei.soundEffectType = SoundEffectType.HIT; paei.AudioTarget = (Node2D)GetParent(); paei.FireEvent(); }
private void ShowMenu() { PlayAudioEvent paei = new PlayAudioEvent(); paei.musicType = MusicType.MENU; paei.FireEvent(); menu.Show(); }
// Declare member variables here. Examples: // private int a = 2; // private string b = "text"; // Called when the node enters the scene tree for the first time. public void BodyEntered(Node body) { if (body.IsInGroup("Map")) { PlayAudioEvent paei = new PlayAudioEvent(); paei.soundEffectType = SoundEffectType.HIT; paei.AudioTarget = (Node2D)GetParent(); paei.FireEvent(); } }
// Called when the node enters the scene tree for the first time. public override void _Ready() { PlayAudioEvent.RegisterListener(PlayAudio); DeathEvent.RegisterListener(OnDeathEvent); //Create the audio stream players and add them as children tot the sound manager soundEffects.Name = "SoundEffects"; soundEffects.VolumeDb = -30; AddChild(soundEffects); music.Name = "Music"; music.VolumeDb = -30; AddChild(music); //Load a few audio samples soundEffectsList.Add(ResourceLoader.Load("res://Sounds/Effects/impactsplat.wav") as AudioStream); soundEffectsList.Add(ResourceLoader.Load("res://Sounds/Effects/ButtonClick.wav") as AudioStream); musicList.Add(ResourceLoader.Load("res://Sounds/Music/the_kings_forgotten_medallion.ogg") as AudioStream); }
private void InstatiateScenes() { //Init needed background sytems //Instance the input manager and set it as a child of the main scene inputManager = inputManagerScene.Instance(); //Set the input manager as the child of the main scene AddChild(inputManager); //Instance the map and set it as a child of the main scene camera = cameraScene.Instance(); ((Node2D)camera).Position = new Vector2(640, 360); //Set the camera as the child of the main scene AddChild(camera); //Set the camera back to the main scene CameraEvent cei = new CameraEvent(); //cei.target = (Node2D)redBlob.GetParent(); cei.target = (Node2D)this; cei.FireEvent(); //Instance the UI manager and set it as a child of the main scene uiManager = uiManagerScene.Instance(); //Set the UI manager as the child of the main scene AddChild(uiManager); //Instance the sound manager and set it as a child of the main scene soundManager = soundManagerScene.Instance(); //Set the sound manager as the child of the main scene AddChild(soundManager); //Create the background and set it as a child of the main scene background = backgroundScene.Instance(); AddChild(background); //Instance the fullscreenshader and set it as a child of the main scene fullscreenShader = fullscreenShaderScene.Instance(); //Set the map as the child of the main scene AddChild(fullscreenShader); SetShaderEvent ssei = new SetShaderEvent(); ssei.showBlurAndWater = true; ssei.FireEvent(); PlayAudioEvent paei = new PlayAudioEvent(); paei.musicType = MusicType.MENU; paei.FireEvent(); }
public void BodyEntered(Node body) { if (body.IsInGroup("RedBlob")) { //Set the infected bool to true to change the sprite infected = true; //Fire the convert event to notify the cell list in main to remove the cell from the unconverted list CellConvertEvent ccei = new CellConvertEvent(); ccei.CovertedCell = this; ccei.FireEvent(); //Swap out sprites to the red converted sprite blueSprite.Hide(); redSprite.Show(); } PlayAudioEvent paei = new PlayAudioEvent(); paei.soundEffectType = SoundEffectType.HIT; paei.AudioTarget = (Node2D)this; paei.FireEvent(); }