Inheritance: MonoBehaviour
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
     {
         if (TheGame.ShootEnemy(e.KeyCode.ToString().ToUpper()))
         {
             lblHit.Text   = (int.Parse(lblHit.Text) + 1).ToString();
             currentScore += TheGame.gameLevel.POINTS_HIT;
             //lblScore.Text = (int.Parse(lblScore.Text) + TheGame.gameLevel.POINTS_HIT).ToString();
             lblScore.Text = currentScore.ToString();
         }
         else
         {
             lblMiss.Text  = (int.Parse(lblMiss.Text) + 1).ToString();
             currentScore -= TheGame.gameLevel.POINTS_MISS;
             // lblScore.Text = (int.Parse(lblScore.Text) - TheGame.gameLevel.POINTS_MISS).ToString();
             lblScore.Text = currentScore.ToString();
             if (int.Parse(lblScore.Text) < 0)
             {
                 currentScore = 0;
             }
             lblScore.Text = "0";
         }
     }
 }
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            if (was_spawned && selectable.IsActive())
            {
                PlayerData      pdata        = PlayerData.Get();
                DroppedItemData dropped_item = pdata.GetDroppedItem(GetUID());
                if (dropped_item != null)
                {
                    if (data.HasDurability() && dropped_item.durability <= 0f)
                    {
                        DestroyItem(); //Destroy item from durability
                    }
                }
            }

            if (auto_collect_range > 0.1f)
            {
                PlayerCharacter player = PlayerCharacter.GetNearest(transform.position, auto_collect_range);
                if (player != null)
                {
                    player.Inventory.AutoTakeItem(this);
                }
            }
        }
Beispiel #3
0
        protected override void Update(GameTime time)
        {
            if (TheGame.GameStatus == GameManager.Status.RUNNING)
            {
                if (GameInput.Self.KeyPressed(Keys.Escape))
                {
                    Exit();
                }
            }

            camera.ViewportWidth  = GraphicsDevice.PresentationParameters.BackBufferWidth;
            camera.ViewportHeight = GraphicsDevice.PresentationParameters.BackBufferHeight;

            if (TheGame.Debugging)
            {
                if (GameInput.Self.KeyDown(Keys.OemPlus))
                {
                    camera.AdjustZoom(0.02f);
                }
                if (GameInput.Self.KeyDown(Keys.OemMinus))
                {
                    camera.AdjustZoom(-0.02f);
                }
            }

            // TODO: Add your update logic here
            world.Update(time);

            TheGame.Update(time);
            GameInput.Self.Update();
            gsm.Update(time);
            TimerManager.Self.Update(time);

            base.Update(time);
        }
Beispiel #4
0
        void Update()
        {
            pause_panel.SetVisible(TheGame.Get().IsPausedByPlayer());

            foreach (PlayerControls controls in PlayerControls.GetAll())
            {
                if (controls.IsPressPause() && !TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Pause();
                }
                else if (controls.IsPressPause() && TheGame.Get().IsPausedByPlayer())
                {
                    TheGame.Get().Unpause();
                }
            }

            //Gamepad auto focus
            UISlotPanel focus_panel = UISlotPanel.GetFocusedPanel();

            if (focus_panel != pause_panel && TheGame.Get().IsPausedByPlayer() && PlayerControls.IsAnyGamePad())
            {
                pause_panel.Focus();
            }
            if (focus_panel == pause_panel && !TheGame.Get().IsPausedByPlayer())
            {
                UISlotPanel.UnfocusAll();
            }
        }
Beispiel #5
0
    /// <summary>
    /// Переключение состояний
    /// </summary>
    public void ChangeState(AnimState pState)
    {
        if (curState != pState)
        {
            //animator.ResetTrigger (curState.ToString());
            //Debug.Log (pState.ToString ());
            curState = pState;

            if (curState == AnimState.Jump)
            {
                animator.SetTime(0);
                animator.enabled = false;
            }
            else
            {
                animator.Play(pState.ToString());
                //animator.SetTrigger (pState.ToString ());
                animator.enabled = true;
                if ((pState == AnimState.FalL || pState == AnimState.FalR) && PlaySound)
                {
                    TheGame.PlaySound(AnimState.Falling);
                }
            }
        }
    }
Beispiel #6
0
    void Update()
    {
        if (!Active)
        {
            return;
        }

        if ((rt.anchoredPosition - TheGame.thePlayer.rt.anchoredPosition).magnitude < 55)
        {
            Debug.Log((rt.anchoredPosition - TheGame.thePlayer.rt.anchoredPosition).magnitude);
            TheGame.Sink(TheGame.thePlayer, false);
        }

        float dist = cell == null ? 555 : (rt.anchoredPosition - cell.cell.rt.anchoredPosition).magnitude;

        if (dist < 5 || dist > 90)
        {
            CalcMove();
        }
        else if (base.speed.Empty)        // && !base.flying)
        {
            CalcMove();
        }

        AfterUpdate();
        if (flying && offset.Y == 0)         // костыль
        {
            offset.Y = -1;
        }
    }
        private void OnMouseHold(Vector3 pos)
        {
            if (!controls_enabled)
            {
                return;
            }

            if (TheGame.IsMobile())
            {
                return; //On mobile, use joystick instead, no mouse hold
            }
            //Stop auto target if holding
            PlayerControlsMouse mcontrols = PlayerControlsMouse.Get();

            if (auto_move && mcontrols.GetMouseHoldDuration() > 1f)
            {
                StopAutoMove();
            }

            //Only hold for normal movement, if interacting dont change while holding
            if (character_craft.GetCurrentBuildable() == null && auto_move_select == null && auto_move_attack == null)
            {
                UpdateMoveTo(pos);
            }
        }
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            if (character.IsDead())
            {
                return;
            }

            //Swim
            if (!is_swimming && PhysicsTool.IsAnyLayerIsInLayerMask(cground_layers, water_layer))
            {
                StartSwim();
            }
            else if (is_swimming && !PhysicsTool.IsAnyLayerIsInLayerMask(cground_layers, water_layer))
            {
                StopSwimming();
            }

            //Swim adjust offset
            if (swim_mesh_offset != null)
            {
                swim_mesh_offset.transform.localPosition = Vector3.Lerp(swim_mesh_offset.transform.localPosition, swim_mesh_tpos, 20f * Time.deltaTime);
            }
        }
Beispiel #9
0
    void Update()
    {
        if (TheGame.Get().IsPaused())
        {
            return;
        }

        float game_speed  = GameData.Get().game_time_mult;
        float hour_to_sec = game_speed / 3600f;

        item_progress += hour_to_sec * Time.deltaTime;
        if (item_progress > item_spawn_time)
        {
            item_progress = 0f;
            nb_item      += 1;
            nb_item       = Mathf.Min(nb_item, item_max);

            PlayerData.Get().SetUniqueID(GetAmountUID(), nb_item);
        }

        for (int i = 0; i < item_models.Length; i++)
        {
            bool visible = (i < nb_item);
            if (item_models[i].activeSelf != visible)
            {
                item_models[i].SetActive(visible);
            }
        }
    }
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            if (IsDead())
            {
                return;
            }

            //Attack when target is in range
            if (!character.IsDoingAction())
            {
                attack_timer += Time.deltaTime;
            }

            Destructible auto_move_attack = character.GetAutoAttackTarget();

            if (auto_move_attack != null && !character.IsDoingAction() && IsAttackTargetInRange(auto_move_attack))
            {
                character.FaceTorward(auto_move_attack.transform.position);
                character.PauseAutoMove(); //Reached target, dont keep moving

                if (attack_timer > GetAttackCooldown())
                {
                    DoAttack(auto_move_attack);
                }
            }
        }
Beispiel #11
0
 void Update()
 {
     if (TheGame.Get().IsPaused())
     {
         return;
     }
 }
Beispiel #12
0
    void LateUpdate()
    {
        if (!Active)
        {
            return;
        }

        switch (TheField.getType(position))
        {
        case EntityType.Girl:
            TheGame.Friend(position);
            break;

        case EntityType.Fruit:
            TheField.Catch(position);
            break;

        case EntityType.Water:
            TheGame.Sink(this, true);
            break;

        default:
            break;
        }
    }
Beispiel #13
0
 public TheHallGame()
     : base(200, 200)
 {
     World.SetStartingLayerType <TheHallLayer>();
     Title  = "The Hall";
     m_game = new TheGame(this);
 }
Beispiel #14
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Space)
            {
                PauseTheGame();
                return;
            }

            if (!IsPaused && e.KeyCode >= Keys.A && e.KeyCode <= Keys.Z)
            {
                if (TheGame.ShootEnemy(e.KeyCode.ToString().ToUpper()))
                {
                    CurrentScore += TheGame.gameLevel.POINTS_HIT;
                }
                else
                {
                    CurrentScore -= TheGame.gameLevel.POINTS_MISS;
                    if (CurrentScore < 0)
                    {
                        CurrentScore = 0;
                    }
                }
                UpdateScore();
            }
        }
Beispiel #15
0
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            if (HasItem())
            {
                float game_speed = TheGame.Get().GetGameTimeSpeedPerSec();
                timer += game_speed * Time.deltaTime;
                if (timer > duration)
                {
                    FinishItem();
                }

                if (progress != null)
                {
                    progress.manual_value = timer / duration;
                }

                if (active_fx != null && active_fx.activeSelf != HasItem())
                {
                    active_fx.SetActive(HasItem());
                }
            }
        }
Beispiel #16
0
        void Awake()
        {
            PlayerData.LoadLast(); //Make sure the game is loaded

            TheGame          the_game  = FindObjectOfType <TheGame>();
            NarrativeManager narrative = FindObjectOfType <NarrativeManager>();

            if (narrative != null)
            {
                narrative.onPauseGameplay   += OnPauseGameplay;
                narrative.onUnpauseGameplay += OnUnpauseGameplay;
                narrative.onPlaySFX         += OnPlaySFX;
                narrative.onPlayMusic       += OnPlayMusic;
                narrative.onStopMusic       += OnStopMusic;
                narrative.use_custom_audio   = true;
            }
            else
            {
                Debug.LogError("Dialogue Quests: Integration failed - Make sure to add the DQManager and SurvivalEngine Manager to the scene");
            }

            if (the_game != null)
            {
                the_game.beforeSave += SaveDQ;
                LoadDQ();
            }
        }
 private void OnMouseRelease(Vector3 pos)
 {
     if (TheGame.IsMobile())
     {
         character_craft.TryBuildAt(pos);
     }
 }
Beispiel #18
0
    void Update()
    {
        if (TheGame.Get().IsPaused())
        {
            return;
        }

        //Remove null
        for (int i = spawn_list.Count - 1; i >= 0; i--)
        {
            if (spawn_list[i] == null || !spawn_list[i].activeSelf)
            {
                spawn_list.RemoveAt(i);
            }
        }

        if (!IsFull())
        {
            float game_speed  = GameData.Get().game_time_mult;
            float hour_to_sec = game_speed / 3600f;

            spawn_timer += hour_to_sec * Time.deltaTime;
            if (spawn_timer > spawn_interval)
            {
                spawn_timer = 0f;
                Spawn();
            }
        }
    }
        /// <summary>
        /// Creates a new in-game screen object
        /// </summary>
        /// <param name="game">game object</param>
        public IngameScreen(TheGame game)
            : base(game)
        {
            this.viewModel = new IngameViewModel(game);

            this.InitUserInterface(game);
        }
Beispiel #20
0
        public static void Main()
        {
            var canvasSize = new IntSize(400, 800);

            var div = new HTMLDivElement();

            div.style.width  = $"{canvasSize.Width}px";
            div.style.height = $"{canvasSize.Height}px";
            document.body.appendChild(div);

            var button = new HTMLButtonElement();

            button.innerHTML             = "Click on game area to start it!";
            button.style.width           = "100%";
            button.style.height          = "100%";
            button.style.backgroundColor = "#6495ED";
            button.style.color           = "#ffffff";
            button.style.fontSize        = "20px";
            div.appendChild(button);

            button.onclick = (ev) =>
            {
                div.removeChild(button);

                var canvas = new HTMLCanvasElement();
                canvas.style.width  = "100%";
                canvas.style.height = "100%";
                canvas.id           = "monogamecanvas";
                div.appendChild(canvas);

                game = new TheGame(canvasSize, Platform.Desktop);
                game.Run();
            };
        }
Beispiel #21
0
    protected override void LateUpdate()
    {
        base.LateUpdate();

        for (int i = 0; i < m_HeartImage.Count; ++i)
        {
            if (m_HitPoints >= i + 1)
            {
                m_HeartImage[i].sprite = m_FullHeart;
            }
            else if (m_HitPoints > i)
            {
                m_HeartImage[i].sprite = m_HalfHeart;
            }
            else
            {
                m_HeartImage[i].sprite = m_EmptyHeart;
            }
        }

        if (m_HitPoints <= 0)
        {
            TheGame.GameOver();
        }
    }
Beispiel #22
0
        void Update()
        {
            if (TheGame.Get().IsPaused())
            {
                return;
            }

            float game_speed = TheGame.Get().GetGameTimeSpeedPerSec();

            item_progress += game_speed * Time.deltaTime;
            if (item_progress > item_spawn_time)
            {
                item_progress = 0f;
                nb_item      += 1;
                nb_item       = Mathf.Min(nb_item, item_max);

                PlayerData.Get().SetCustomValue(GetAmountUID(), nb_item);
            }

            for (int i = 0; i < item_models.Length; i++)
            {
                bool visible = (i < nb_item);
                if (item_models[i].activeSelf != visible)
                {
                    item_models[i].SetActive(visible);
                }
            }
        }
Beispiel #23
0
    /// <summary>
    /// Слопать яблоко
    /// </summary>
    public static void Catch(Point pPoint)
    {
        TheCell cell = instance.field[pPoint.X, pPoint.Y];

        if (cell.sprite != 0)
        {
            fruitCount--;
            Debug.Log("Fruits: " + fruitCount.ToString());
            cell.sprite = 0;
            RectTransform ert = Instantiate(instance.catchEffect).GetComponent <RectTransform> ();

            ert.transform.parent = cell.transform;
            ert.anchoredPosition = Vector2.zero;

            if (fruitCount <= 0)
            {
                TheGame.theGirl.ChangeState(GirlMode.Ready);
                TheGame.PlaySound(AnimState.Done);
            }
            else
            {
                TheGame.PlaySound(AnimState.Eat);
            }
        }
    }
Beispiel #24
0
        public void StartBuild(PlayerCharacter character)
        {
            building_mode      = true;
            position_set       = false;
            building_character = character;

            if (selectable != null)
            {
                selectable.enabled = false;
            }
            if (destruct)
            {
                destruct.enabled = false;
            }

            foreach (Collider collide in colliders)
            {
                collide.isTrigger = true;
            }

            if (TheGame.IsMobile()) //Hide on mobile
            {
                SetBuildVisible(false);
            }
        }
Beispiel #25
0
 void TimerMoveEnemies_Tick(object sender, EventArgs e)
 {
     if (!IsPaused)
     {
         TheGame.MoveEnemies();
         Invalidate();
     }
 }
Beispiel #26
0
 public Splash(TheGame game)
     : base(game)
 {
     _infoText.Append(
         "This is the port of the formely popular game LAND. It was originally developed by ASP corp. on 1986 and ran under PDP-11 compatible computers.\r\n");
     _infoText.Append(
         "Ported using MonoGame framework by Andriy S'omak ([email protected]), April 2014. Game sources at https://github.com/semack/land");
 }
Beispiel #27
0
 void TimerCreateLetter_Tick(object sender, EventArgs e)
 {
     if (!IsPaused)
     {
         TheGame.AddEnemy();
         lblLevel.Text = TheGame.gameLevel.LEVEL.ToString();
     }
 }
Beispiel #28
0
        private IEnumerator NewRoutine()
        {
            BlackPanel.Get().Show();

            yield return(new WaitForSeconds(1f));

            TheGame.NewGame();
        }
Beispiel #29
0
 protected BaseActor(TheGame game, Room room, int speedCoef)
     : base(game)
 {
     Room = room;
     Visible = false;
     Enabled = false;
     _speedCoef = speedCoef;
 }
Beispiel #30
0
        public Sprite(Dictionary <string, Animation> animations, TheGame game)
        {
            _animations = animations;
            var animation = _animations.First().Value;

            _animationManager = new AnimationManager(animation);
            TMD = game;
        }
Beispiel #31
0
 public void MarkValue(int i, int j)
 {
     TheGame.MarkValue(i, j);
     if (TheGame.Status != (short)TicTacToeGameStatus.PLAYING)
     {
         EndGame();
     }
 }
Beispiel #32
0
 public void QuitGame()
 {
     if (IsReady)
     {
         TheGame.QuitGame();
         EndGame();
     }
 }
Beispiel #33
0
 public GameController(Memory memory)
 {
     Memory = memory;
     Area = new AreaController(this);
     EntityListWrapper = new EntityListWrapper(this);
     Window = new GameWindow(memory.Process);
     Game = new TheGame(memory);
     Files = new FsController(memory);
 }
Beispiel #34
0
 public Room(TheGame game)
     : base(game)
 {
     _bullet = new Bullet(Game, this);
     _hero = new Hero(Game, this, _bullet);
     _hero.OnChestHappened += OnHeroChestHappened;
     _hero.OnLifeFired += OnHeroLifeFired;
     _hero.OnRoomFinished += OnHeroRoomFinished;
     _biomass = new Biomass(Game, this);
     _wall = new Wall(Game, this);
     _devil1 = new Devil(Game, this, _hero, DevilNumberEnum.First);
     _devil2 = new Devil(Game, this, _hero, DevilNumberEnum.Second);
     _devil1.OnLifeFired += OnHeroLifeFired;
     _devil2.OnLifeFired += OnHeroLifeFired;
     _hero.OnReportPostion += OnCheckCollision;
     Reset();
 }
Beispiel #35
0
 public Bullet(TheGame game, Room room)
     : base(game)
 {
     _room = room;
 }
 public BaseDrawableGameComponent(TheGame game)
     : base(game)
 {
 }
Beispiel #37
0
 public BaseGameComponent(TheGame game)
     : base(game)
 {
 }
Beispiel #38
0
 public Wall(TheGame game, Room room)
     : base(game)
 {
     _moveInterval = new TimeSpan();
     _room = room;
 }
		public StartSelectorUiBlock(Rct _rct, TheGame _game)
			: base(_rct, Frame.Frame1, FColor.DarkGray)
		{
			m_game = _game;
		}
Beispiel #40
0
 static void Main(string[] args)
 {
     TheGame myAdventure = new TheGame();
     myAdventure.Greeting();
     myAdventure.adventure();
 }
Beispiel #41
0
 public Hero(TheGame game, Room room, Bullet bullet)
     : base(game, room, 1)
 {
     _bullet = bullet;
 }
Beispiel #42
0
 public Devil(TheGame game, Room room, Hero hero, DevilNumberEnum number)
     : base(game, room, 3)
 {
     Number = number;
     _hero = hero;
 }