Ejemplo n.º 1
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
         return;
     }
 }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        //Damage Object
        _fireDamage = GetComponentsInChildren <FireDamage>();
        //UNity Containers
        GameObject _PlayerContainer   = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <SpawnManager>().PlayerContainer;
        GameObject _LaserContainer    = GameObject.FindGameObjectWithTag("SpawnManager").GetComponent <SpawnManager>().LaserContainer;
        GameObject holdLaserContainer = GameObject.Find("Player Container");

        SetContainer(_PlayerContainer, _LaserContainer);
        //Thrusters
        _uiManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UIManager>();
        //LivesCard
        _LivesCard = GameObject.FindGameObjectWithTag("LivesCard").GetComponent <LivesCard>();
        _LivesCard.RestSprite(true);
        //Default Shield OFF and Defaults
        this.gameObject.transform.GetChild(0).gameObject.SetActive(false);
        _shieldLive = _shieldMax;
        _ShieldBar  = GameObject.FindGameObjectWithTag("ShieldBar").GetComponent <ShieldBar>();
        _ShieldBar.ShieldReset();
        //Set play start position
        _livesHold = _playerInfo[0].playerLives;
        _speedHold = _playerInfo[0].playerSpeed;

        if (holdLaserContainer != null)
        {
            for (int i = 0; i < _laserTypes.Count; i++)
            {
                _laserTypes[i].LaserContainer = GameObject.Find("Player Container");
            }
        }
        else
        {
            Debug.Log("Startup Bug LaserContainer");
        }

        GameObject holdPowerContainer = GameObject.Find("Powerup Container");

        if (holdPowerContainer != null)
        {
            for (int i = 0; i < _laserTypes.Count; i++)
            {
                _powerupTypes[i].powerupContainer = GameObject.Find("Powerup Container");
            }
        }
        else
        {
            Debug.Log("Startup Bug PowerContainer");
        }
    }
Ejemplo n.º 3
0
        public override void Draw(SpriteBatch spriteBatch)
        {
            base.Draw(spriteBatch);

            if (SceneManager.CurrentScene == SceneManager.mapScene)
            {
                ShieldBar.Draw(spriteBatch);
            }

            // Description
            if (Globals.MRectangle.Intersects(Box) && SceneManager.CurrentScene == SceneManager.mapScene)
            {
                Text.TextDifferentColor(spriteBatch, Description, new Vector2(Position.X + Texture.Width / 2 + 84, Position.Y - Texture.Height / 2), 1f, TextureManager.SpriteFont15, false);
            }
        }
Ejemplo n.º 4
0
        public void DrawGUI()
        {
            // HP bar
            Engine.Instance.SpriteBatch.Draw(BarEmpty, BarLocation, Color.White);
            HPBar.Draw(Engine.Instance.SpriteBatch);
            // Shield bar
            Engine.Instance.SpriteBatch.Draw(BarEmpty, ShieldBarLoc, Color.White);
            ShieldBar.Draw(Engine.Instance.SpriteBatch);
            // Heart
            Engine.Instance.SpriteBatch.Draw(Heart, BarHeartAddition, Color.White);

            // Weapons
            for (int i = 0; i < 5; i++)
            {
                // BG
                if (AquiredWeapons[i] == 0)
                {
                    Engine.Instance.SpriteBatch.Draw(WpnTextures[0], new Vector2(WpnLoc.X + i * 23, WpnLoc.Y), Color.White);
                }
                else if (AquiredWeapons[i] == 1)
                {
                    Engine.Instance.SpriteBatch.Draw(WpnTextures[1], new Vector2(WpnLoc.X + i * 23, WpnLoc.Y), Color.White);
                }
                else
                {
                    Engine.Instance.SpriteBatch.Draw(WpnTextures[7], new Vector2(WpnLoc.X + i * 23, WpnLoc.Y), Color.White);
                }

                Engine.Instance.SpriteBatch.Draw(WpnTextures[2 + i], new Vector2(WpnLoc.X + i * 23, WpnLoc.Y), Color.White);
            }

            // Kills
            Engine.Instance.SpriteBatch.Draw(KillSkull, KillSkullloc, Color.White);
            Engine.Instance.SpriteBatch.DrawString(KillFont, KillsSB, KillLoc, Color.White);

            // Nuclear
            for (int i = 0; i < Ship.NuclearCnt; i++)
            {
                Engine.Instance.SpriteBatch.Draw(NuclearIcon, NuclearLoc + new Vector2(i * 31, 0), Color.White);
            }
            ;

            // Score
            Engine.Instance.SpriteBatch.DrawString(ScoreFont, ScoreSB, ScoreLoc, Color.White);
        }
Ejemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        if (Tank.isPlayer(gameObject))
        {
            sp = FindObjectOfType <ShieldBar>();
            hp = FindObjectOfType <HealthBar>();
            am = FindObjectOfType <Ammo>();
        }

        //int playerHP1 = playerHP;
        currentHP = playerHP;
        //int playerSP1 = playerSP;
        currentSP = playerSP;
        sp?.SetMaxHP(playerSP);
        hp?.SetMaxHP(playerHP);
        am.AmmoStart = playerAM;
        am.AmmoV     = playerAM;
    }
Ejemplo n.º 6
0
 private void Awake()
 {
     instance     = this;
     shieldSlider = gameObject.GetComponent <Slider>();
 }
Ejemplo n.º 7
0
 public float Change(float value)
 {
     return(ShieldBar.Change(value));
 }