Пример #1
0
    //Vector2 mousePos;

    // Update is called once per frame

    void Start()
    {
        speed = 5f;
        invincibilityTimer = 1f;
        doorTimer          = 10f;
        attackPotionTimer  = attackPotionSetTimer;
        speedPotionTimer   = speedPotionSetTimer;

        invincibilityOn = false;
        doorOn          = false;
        attackPotionOn  = false;
        speedPotionOn   = false;

        gameManager    = FindObjectOfType <GameManager>();
        levelGenerator = FindObjectOfType <LevelGenerator>();

        attackImage = FindObjectOfType <AttackImage>();
        attackImage.gameObject.SetActive(false);

        speedImage = FindObjectOfType <SpeedImage>();
        speedImage.gameObject.SetActive(false);

        door = FindObjectOfType <Door>();
        door.gameObject.SetActive(false);

        currentHealth = maxHealth;
        healthBar     = FindObjectOfType <HealthBar>();
        healthBar.SetMaxHealth(maxHealth);
        healthBar.SetHealth(maxHealth);
        //.GetComponent<HealthBar>().SetMaxHealth(maxHealth);
        //healthBar.SetMaxHealth(maxHealth);
        //.GetComponent<HealthBar>().SetMaxHealth(maxHealth);
        //healthBar.SetMaxHealth(maxHealth);
    }
Пример #2
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            ScreenService.Instance.GraphicsDevice.Viewport = ScreenService.Instance.DefaultScreenCamera.CurrentViewport;
            spriteBatch.Begin(
                SpriteSortMode.FrontToBack, // this is also the order for building the screen.
                null,
                SamplerState.PointClamp,
                null,
                null,
                null,
                ScreenService.Instance.DefaultScreenCamera.TransformMatrix);
            base.Draw(spriteBatch);

            if (!Images.Any())
            {
                Messages.Add("no image received from server");
            }
            foreach (var img in Images.ToList())
            {
                img.Draw(spriteBatch);
            }

            if (!InventoryImages.Any())
            {
                Messages.Add("no inventory image received from server");
            }
            foreach (var img in InventoryImages.ToList())
            {
                img.Draw(spriteBatch);
            }

            MultiplayerText.Draw(spriteBatch);
            HealthImage.Draw(spriteBatch);
            SpeedImage.Draw(spriteBatch);
            StrenghImage.Draw(spriteBatch);
            DialogImage.Draw(spriteBatch);
            CursorImage.Draw(spriteBatch);

            //LerpMouseImage.Draw(spriteBatch);

            if (InfoWindow?.IsVisible == true)
            {
                InfoWindow?.Draw(spriteBatch);
            }

            if (DialogWindow?.IsVisible == true)
            {
                DialogWindow?.Draw(spriteBatch);
            }

            if (InventoryWindow?.IsVisible == true)
            {
                InventoryWindow.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                MoneyCount.Draw(spriteBatch);
                CharacterWindow?.Draw(spriteBatch);
            }

            if (CharacterWindow?.IsVisible == true)
            {
                CharacterWindow?.Draw(spriteBatch);
            }

            if (ChatWindow?.IsVisible == true)
            {
                ChatWindow?.Draw(spriteBatch);
            }

            spriteBatch.End();
        }