void Start() { if (textAnimator == null) { textAnimator = GetComponent <TextAnimator>(); } }
private void Awake() { if (animator == null) { animator = this.gameObject.GetComponent <TextAnimator>(); } }
// a message before games starts private void GameStarting() { TextAnimator.AnimateText("Welsome to dungeons of Doom\nKill all monsters!\nObtain items\n", 50); TextAnimator.AnimateText("Good luck Hero", 50); Console.ReadKey(); Console.Clear(); }
// prints the different scenarios depending on what the player faces inside the room private void EnterRoom() { Room currentRoom = world[player.X, player.Y]; Monster monster = currentRoom.Monster; if (monster != null) { AttackResult result = monster.Attack(player); TextAnimator.AnimateText($"({monster.Name}) Health ({result.Attacker.Health}) damage player by {result.Damage}", 50); // Console.WriteLine($"({monster.Name}) Health ({result.Attacker.Health}) damage player by {result.Damage}"); Console.ReadKey(true); //skeleton wont attack player if player are to healty, it will insted deal no damage and try to run away if (result.Damage == 0) { TextAnimator.AnimateText("\nSkeleton tries to run away", 50); Console.ReadKey(); } // if player survived the attack or the skeleton tries to run away the player will fight back if (player.IsAlive) { result = player.Attack(monster); foreach (var item in player.Backpack) { if (item.Name == "Sword") { result.Damage += 5; } } TextAnimator.AnimateText($"\nPlayer Damage Monster by {result.Damage}", 50); //Console.WriteLine($"\nPlayer Damage Monster by {result.Damage}"); Console.ReadKey(); } // if the monster died, the monster will be added to the backpack if (!monster.IsAlive) { TextAnimator.AnimateText($"\n{currentRoom.Monster.Name} added to backpack", 50); Console.ReadKey(); player.Backpack.Add(currentRoom.Monster); currentRoom.Monster = null; } } // if there is a item in the current room the player steps into the item will be added to the backpack // however the item will be used on pickup, so in this case its more of a notice that the item have been picked up // might fix later if (currentRoom.Item != null) { TextAnimator.AnimateText($"{currentRoom.Item.Name} added to backpack", 50); player.Backpack.Add(currentRoom.Item); currentRoom.Item.Use(player); currentRoom.Item = null; } }
// the gameOver method prints a player wins message if there is no more monsters on the map // prits You Died if player died and the game is over... // if key is pressed the game restarts private void GameOver() { Console.Clear(); if (Monster.MonsterCount == 0) { TextAnimator.AnimateText("You have defeted all mosnters", 50); TextAnimator.AnimateText("Hero wins!", 50); Console.ReadKey(); Play(); } else if (!player.IsAlive) { TextAnimator.AnimateText("You Died", 50); } Console.ReadKey(); Play(); }
void FindTextAnimator() { Transform targetTrans = this.transform; _dialogueCanvas = GameObject.FindGameObjectWithTag("Dialogue"); _audioSource = _dialogueCanvas.GetComponentInChildren <AudioSource>(); _dialogueHistory = _dialogueCanvas.GetComponentInChildren <DialogueHistory>(); //Looks for the GameObject with the DialogueController.cs attached (First part of acquiring the TextAnimator and TextAnimatorPlayer) foreach (Transform child in _dialogueCanvas.transform) { if (child.GetComponent <DialogueController>()) { //Gets the child of the GameObject that has the DialogueController.cs attached to it targetTrans = child.transform.GetChild(0); } } //Second part of acquiring the TextAnimator and TextAnimatorPlayer if (targetTrans != null) { //Looks for the GameObject with the TextAnimator and TextAnimatorPlayer attached foreach (Transform child2 in targetTrans) { if (child2.GetComponent <TextAnimator>()) { _textAnimator = child2.GetComponent <TextAnimator>(); } if (child2.GetComponent <TextAnimatorPlayer>()) { _textAnimatorPlayer = child2.GetComponent <TextAnimatorPlayer>(); } } if (_textAnimatorPlayer != null) { _textAnimator.timeScale = TextAnimator.TimeScale.Scaled; } } }
/// <summary> /// 生成時処理 /// </summary> private void Awake() { instance = this; }
/// <summary> /// Load graphics content for the game. /// </summary> public override void Activate(bool instancePreserved) { if (!instancePreserved) { if (content == null) { content = new ContentManager(ScreenManager.Game.Services, "Content"); } kinectRGBVideo.Texture = new Texture2D(ScreenManager.GraphicsDevice, 640, 480, false, SurfaceFormat.Color); kinectRuntime = new Runtime(); kinectRuntime.Initialize(RuntimeOptions.UseColor | RuntimeOptions.UseSkeletalTracking | RuntimeOptions.UseDepthAndPlayerIndex); kinectRuntime.VideoStream.Open(ImageStreamType.Video, 2, ImageResolution.Resolution640x480, ImageType.Color); kinectRuntime.VideoFrameReady += VideoFrameReady; kinectRuntime.SkeletonFrameReady += SkeletonFrameReady; kinectRGBVideo.Position = new Vector2(183, 225); UI_KinectFrameOffset = new Vector2(183, 225); // Game Set inits. //Game Level is initiated which has all the number of sets game and instruction gameLevelManager = new GameLevelManager(this.currentLevel, ref content); generateGameSet(); // Load sounds correct_snd = new GameSFX(content.Load <SoundEffect>("kling")); //Loads the background music and plays it GameMusic background = new GameMusic(content.Load <Song>("background_music3")); background.PlayLooping(); particleEffect = new ParticleEffect(); particleRenderer = new SpriteBatchRenderer { GraphicsDeviceService = (IGraphicsDeviceService)ScreenManager.Game.Services.GetService(typeof(IGraphicsDeviceService)) }; particleRenderer.LoadContent(content); particleEffect = content.Load <ParticleEffect>(("BasicExplosion")); particleEffect.LoadContent(content); particleEffect.Initialise(); //Interface Layer UI_FrameLayer = content.Load <Texture2D>("frame"); UI_FrameLayerPosition = new Vector2(0, 0); UI_Font_Instruction = content.Load <SpriteFont>("SpriteFont"); UI_FontPosition_Instruction = new Vector2(500, 90); UI_Font_Score = content.Load <SpriteFont>("SpriteFont"); UI_FontPosition_Score = new Vector2(500, 22); UI_Font_Level = content.Load <SpriteFont>("SpriteFont"); UI_FontPosition_Level = new Vector2(80, 22); UI_Font_Time = content.Load <SpriteFont>("SpriteFont"); UI_FontPosition_Time = new Vector2(850, 22); //Interactive Elements textAnim_GoodJob = new TextAnimator(content.Load <SpriteFont>("SpriteFont")); textAnim_GameOver = new TextAnimator(content.Load <SpriteFont>("SpriteFont")); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); // Debugger if (debuggerOn) { skeletonDebugger = new SkeletonOverlayDebugger(kinectRuntime); shapeDebugger.init(ScreenManager.GraphicsDevice); } } }
private void Start() { animator = GetComponent <TextAnimator>(); animator.StartAnimation(); }
public void Show() { bool notLongEnough = !TextAnimator.IsTagLongEnough(effectTag.stringValue); //tag is short if (notLongEnough) { GUI.backgroundColor = errorColor; } EditorGUI.BeginChangeCheck(); if (Application.isPlaying) { GUI.enabled = false; } EditorGUILayout.PropertyField(effectTag); if (notLongEnough) { EditorGUILayout.LabelField("[!] This tag is too short.", EditorStyles.miniLabel); } if (Application.isPlaying) { EditorGUILayout.LabelField("(You can't edit the tag IDs while in playmode.)", EditorStyles.centeredGreyMiniLabel); GUI.enabled = true; } GUI.backgroundColor = Color.white; if (EditorGUI.EndChangeCheck()) { effectTag.stringValue = effectTag.stringValue.Replace(" ", ""); } if (!isAppearance) { EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("--Emission--", EditorStyles.centeredGreyMiniLabel); emission.Show(); EditorGUILayout.EndVertical(); } EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("--Movement--", EditorStyles.centeredGreyMiniLabel); movementX.Show(); movementY.Show(); movementZ.Show(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("--Scale--", EditorStyles.centeredGreyMiniLabel); scaleX.Show(); scaleY.Show(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("--Rotation--", EditorStyles.centeredGreyMiniLabel); rotX.Show(); rotY.Show(); rotZ.Show(); EditorGUILayout.EndVertical(); EditorGUILayout.BeginVertical(EditorStyles.helpBox); EditorGUILayout.LabelField("--Color--", EditorStyles.centeredGreyMiniLabel); color.Show(); EditorGUILayout.EndVertical(); }
private void Awake() { textAnimator = GetComponent <TextAnimator>(); namePlateAnimator.onEvent += OnEvent; textAnimator.onEvent += OnEvent; }
protected override void LoadContent() { // Rendering inits. spriteBatch = new SpriteBatch(GraphicsDevice); kinectRGBVideo.Texture = new Texture2D(GraphicsDevice, gameWidth, gameHeight, false, SurfaceFormat.Color); kinectRGBVideo.Position = new Vector2(183, 228); //Ryan --- changed position this.kinectFrameOffset = new Vector2(183, 228); // Game Set inits. initGameSetList(); generateGameSet(); // Load sounds correct_snd = new GameSFX(Content.Load <SoundEffect>("kling")); //Loads the background music and plays it GameMusic background = new GameMusic(Content.Load <Song>("background_music3")); background.PlayLooping(); particleRenderer.LoadContent(Content); particleEffect = Content.Load <ParticleEffect>(("BasicExplosion")); particleEffect.LoadContent(Content); particleEffect.Initialise(); //Handling Interface Layer on the screen UI_FrameLayer = Content.Load <Texture2D>("frame"); UI_FrameLayerPosition = new Vector2(0, 0); //Handling Font Sprite on the screen font = Content.Load <SpriteFont>("SpriteFont"); fontPos = new Vector2(535, 25); // Interactive elements (text animator) textAnimator = new TextAnimator(Content.Load <SpriteFont>("SpriteFont")); // Debug inits shapeDebugger.init(GraphicsDevice); /* * //skeleton right hand * GameTextureInstance texture = GameTextureInstance.CreateBlank(GraphicsDevice, 20, 20); * texture.Position = new Vector2(0, 0); * texture.Alpha = 1; * texture.Color = Color.Orange; * skeletonSpots.Add(texture); * * //Left hand * texture = GameTextureInstance.CreateBlank(GraphicsDevice, 20, 20); * texture.Position = new Vector2(0, 0); * texture.Alpha = 1; * texture.Color = Color.BlueViolet; * skeletonSpots.Add(texture); * * //hotspots * texture = GameTextureInstance.CreateBlank(GraphicsDevice, HotSpotSizes, HotSpotSizes); * texture.Position = new Vector2(EdgeOffset); * texture.Alpha = HotSpotAlpha; * hotSpots.Add(texture); * * texture = GameTextureInstance.CreateBlank(GraphicsDevice, HotSpotSizes, HotSpotSizes); * texture.Position = new Vector2(GraphicsDevice.Viewport.Width - texture.Texture.Width - EdgeOffset, EdgeOffset); * texture.Alpha = HotSpotAlpha; * hotSpots.Add(texture); * * texture = GameTextureInstance.CreateBlank(GraphicsDevice, HotSpotSizes, HotSpotSizes); * texture.Position = new Vector2(10, GraphicsDevice.Viewport.Height - texture.Texture.Height - EdgeOffset); * texture.Alpha = HotSpotAlpha; * hotSpots.Add(texture); * * texture = GameTextureInstance.CreateBlank(GraphicsDevice, HotSpotSizes, HotSpotSizes); * texture.Position = new Vector2(GraphicsDevice.Viewport.Width - texture.Texture.Width - EdgeOffset, GraphicsDevice.Viewport.Height - texture.Texture.Height - EdgeOffset); * texture.Alpha = HotSpotAlpha; * hotSpots.Add(texture); * * //debug textures * GameTextureInstance texture = GameTextureInstance.CreateBlank(GraphicsDevice, 80, 80); * texture.Alpha = 0.3f; * texture.Color = Color.HotPink; * debugSpots.Add(texture); * * texture = GameTextureInstance.CreateBlank(GraphicsDevice, 80, 80); * texture.Alpha = 0.3f; * texture.Color = Color.HotPink; * debugSpots.Add(texture); * * * ResetSquareColors(); */ }
void Awake() { _textAnimator = GetComponent <TextAnimator>(); }