Example #1
0
    void Start()
    {
        TextAsset bindata= Resources.Load("JSON/damageData") as TextAsset;
        damageData = new JSONObject(bindata.ToString());

        inputHandler = transform.root.GetComponent<Input_Handler>();
    }
Example #2
0
    void Start()
    {
        TextAsset bindata = Resources.Load("JSON/damageData") as TextAsset;

        damageData = new JSONObject(bindata.ToString());

        inputHandler = transform.root.GetComponent <Input_Handler>();
    }
Example #3
0
 void Start()
 {
     if (!m_CharCtrl)
     {
         this.enabled = false;
     }
     if (!m_Ani)
     {
         this.enabled = false;
     }
     inputHandler = gameObject.GetComponent <Input_Handler>();
 }
Example #4
0
        public override void Draw(GameTime gameTime)
        {
            GameRef.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend);
            if (Input_Handler.KeyReleased(Keys.Escape))
            {
                GameRef.Exit();
            }

            objManager.Draw(GameRef.spriteBatch);

            GameRef.spriteBatch.End();
            base.Draw(gameTime);
        }
Example #5
0
 public override void Update(GameTime gameTime)
 {
     //whenever the title screen updates, it updates the ControlManager
     if (Enabled)
     {
         objManager.Update(gameTime);
         base.Update(gameTime);
         if (Input_Handler.KeyDown(Microsoft.Xna.Framework.Input.Keys.F11) && KeyDown == false)
         {
             KeyDown = true;
         }
         if (KeyDown == true && Input_Handler.KeyReleased(Microsoft.Xna.Framework.Input.Keys.F11))
         {
             KeyDown = false;
         }
         if (loadBar.CurrentLoad == 100)
         {
             StateManager.AddLoaded(GameRef.GamePlayScreen);
         }
     }
 }
Example #6
0
 public Attack_1(Input_Handler input)
 {
     mainInput = input;
 }
Example #7
0
 private void OnEnable()
 {
     rb    = GetComponent <Rigidbody>();
     cam   = GetComponentInChildren <Camera>();
     input = GetComponentInChildren <Input_Handler>();
 }
Example #8
0
 void Start()
 {
     input = GetComponentInParent <Input_Handler>();
 }
Example #9
0
 public void enter(Input_Handler input)
 {
     mainInput = input;
 }
Example #10
0
 public void enter(Input_Handler input)
 {
     mainInput = input;
 }
Example #11
0
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);
            if (this.isPop)
            {
                if (!keepUpdating.IsCompleted)
                {
                    keepUpdating = new Task(new Action(LoadingScreen));
                }
                Reset();
            }
            if (Input_Handler.KeyPressed(Keys.F11))
            {
                if (!DevelopmentMode)
                {
                    DevelopmentMode = true;
                }
                else
                {
                    DevelopmentMode = false;
                }
            }
            if (DevelopmentMode)
            {
                if (Input_Handler.KeyPressed(Keys.P))
                {
                    if (plotTexture == false)
                    {
                        GameRef.MousePointer = GameRef.Content.Load <Texture2D>(@"UI Content\Flag");
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = true;
                    }
                    else
                    {
                        GameRef.MousePointer = Game.Content.Load <Texture2D>(@"UI Content\Pointer");
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = false;
                    }
                }
                if (Mouse.GetState().LeftButton == ButtonState.Pressed && placeLock == false)
                {
                    cPlotPosition.Position.Add(new Vector2(Mouse.GetState().X, Mouse.GetState().Y));



                    placeLock = true;
                }
                if (Keyboard.GetState().IsKeyDown(Keys.O))
                {
                    writer = new StreamWriter(@"Txt\Map.txt", true);
                    foreach (Vector2 pos in cPlotPosition.Position)
                    {
                        writer.Write(pos.X.ToString() + '#' + pos.Y.ToString() + '-');
                    }

                    writer.Close();
                }
                if (placeLock == true && Mouse.GetState().LeftButton == ButtonState.Released)
                {
                    placeLock = false;
                }
            }
            if (keepUpdating.IsCompleted)
            {
                //this.Hide();

                StateManager.AddLoaded(GameRef.GamePlayScreen);
            }
            objManager.Update(gameTime);
        }
Example #12
0
        public override void Update(GameTime gameTime)
        {
            if (hasPopped)
            {
                Reset();
                hasPopped = false;
            }

            StoryTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
            if (StatusBar.Health <= 0)
            {
                GameOver(this, null);
            }
            if (Input_Handler.KeyReleased(Keys.Escape))
            {
                GameRef.Exit();
            }

            if (ObjManager.MoneyGain > 0)
            {
                Gold                += ObjManager.TakeMoney();
                StatusBar.Gold      += Gold;
                GameRef.player.gold += Gold;
                Gold                 = 0;
            }
            if (ObjManager.DamageGiven > 0)
            {
                Damage            = ObjManager.TakeDamage();
                StatusBar.Health -= Damage;
                Damage            = 0;
            }
            if (counter != 5)
            {
                time += gameTime.ElapsedGameTime.TotalMilliseconds;
            }

            if (Input_Handler.KeyPressed(Keys.F11))
            {
                if (DevelopmentMode == false)
                {
                    DevelopmentMode = true;
                }
                else
                {
                    DevelopmentMode = false;
                }
            }

            #region Development
            if (DevelopmentMode)
            {
                if (Input_Handler.KeyPressed(Keys.I))
                {
                    //Waypoints.Enqueue(new Vector2(Mouse.GetState().X, Mouse.GetState().Y));
                }
                if (Input_Handler.KeyPressed(Keys.P))
                {
                    if (plotTexture == false)
                    {
                        GameRef.MousePointer = texTeleport;
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = true;
                    }
                    else
                    {
                        GameRef.MousePointer = Game.Content.Load <Texture2D>(@"UI Content\Pointer");
                        //gamePlayMouse.Update(gameTime, arrowTexture);
                        plotTexture = false;
                    }
                }
                if (Mouse.GetState().LeftButton == ButtonState.Pressed && placeLock == false)
                {
                    //save plot position
                    if (level == 0)
                    {
                        writer = new StreamWriter(@"GameData\Plot.txt", true);
                    }
                    else if (level == 1)
                    {
                        writer = new StreamWriter(@"GameData\Plot1.txt", true);
                    }
                    else if (level == 2)
                    {
                        writer = new StreamWriter(@"GameData\Plot2.txt", true);
                    }
                    else if (level == 3)
                    {
                        writer = new StreamWriter(@"GameData\Plot3.txt", true);
                    }

                    writer.WriteLine(Mouse.GetState().X.ToString() + "_" + Mouse.GetState().Y.ToString());
                    writer.Close();

                    ObjManager.AddLst.Add(new Plot(Content.Load <Texture2D>(@"UI Content\teleport_128"), new Vector2(Mouse.GetState().X, Mouse.GetState().Y), 5, 1, 0f, 0, 0, 0));

                    placeLock = true;
                }
                if (placeLock == true && Mouse.GetState().LeftButton == ButtonState.Released)
                {
                    placeLock = false;
                }
                if (Input_Handler.KeyPressed(Keys.O))
                {
                    writer = new StreamWriter(@"GameData\Plot.txt", true);
                    writer.Dispose();
                    writer.Close();
                    for (int x = 0; x < ObjManager.Count - 1; x++)
                    {
                        if (ObjManager[x].Type == "Plot")
                        {
                            ObjManager.RemoveAt(x);
                        }
                    }
                }
                #endregion
            }

            ObjManager.Update(gameTime);


            base.Update(gameTime);
        }
Example #13
0
 void Start()
 {
     if (!m_CharCtrl) this.enabled = false;
     if (!m_Ani) this.enabled = false;
     inputHandler = gameObject.GetComponent<Input_Handler>();
 }
Example #14
0
 public Attack_1(Input_Handler input)
 {
     mainInput = input;
 }