public virtual void SetExpProgressBar() { if (!isMyShip()) { return; } GameObject exp_bar = Trans.FindObj(Camera.main.gameObject, "expIcon"); if (exp_bar == null) { Debug.LogError("exp_bar not found!!"); return; } if (_attri.EXP_Max >= _attri.Exp && _attri.EXP_Max > 0) { // Debug.Log(name + "::Hp :" + Hp + ",HP_MAX:" + HP_MAX); float exp_percent = _attri.Exp / (_attri.EXP_Max * 1.0f) * ExpBar.expbar_count; ExpBar exp_script = exp_bar.GetComponent <ExpBar>(); exp_script.SetExpProcessBar((int)exp_percent); } }
public void DropFruit() { if (stage == "stage5") { int countEv = UnityEngine.Random.Range(mincountFruit, maxcountFruit); Inv.GetHarvestToInventory(countEv, fruitId, "harvest"); ExpBar.AddExp(countExpiriens); if (iterationFruit >= 1) { iterationFruit--; stage = "stage3"; shangeSprite("stage3"); stageThree = buffStageThree; stageFour = buffStageFour; growing = true; } else { if (stage != "stage6") { stage = "stage6"; shangeSprite("stage6"); } } } }
private void Start() { _instance = this; slider = GetComponent <Slider>(); expText = transform.Find("expText").GetComponent <Text>(); pi = GameObject.FindGameObjectWithTag(Tags.Player.ToString()).GetComponent <PlayerInfo>(); }
public override void Initialize() { base.Initialize(); ExpBar.Initialize(); Stats.Initialize(); for (int i = 0; i < Spells.Length; i++) { Spells[i].Initialize(); } }
void Start() { playerStatus = FindObjectOfType <Status>(); playerController = FindObjectOfType <Controller>(); question = FindObjectOfType <Qeustion>(); health = FindObjectOfType <HealthBar>(); exp = FindObjectOfType <ExpBar>(); menuButton = FindObjectOfType <Menu>(); combatManager = GetComponent <CombatManager>(); }
public override void Update(GameTime gameTime) { base.Update(gameTime); ExpBar.Update(gameTime); for (int i = 0; i < Spells.Length; i++) { Spells[i].Update(gameTime); } Stats.Update(gameTime); }
void Start() { // init UI UIManager = UIBrain.GetComponent <UIManager>(); // init health and exp bar HealthBarController = UIBrain.GetComponent <HealthBar>(); ExpBarController = UIBrain.GetComponent <ExpBar>(); // remove spawn point from edit mode SpawnPoint.GetComponent <SpriteRenderer>().enabled = false; // set the player to the spawn point location Player.transform.position = SpawnPoint.position; }
private void draw_ranking_data(SpriteBatch sprite_batch, Vector2 offset) { sprite_batch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); // Windows RankingWindow.draw(sprite_batch, offset); // Labels RankingLabel.draw(sprite_batch, offset); TurnsRankLabel.draw(sprite_batch, offset); CombatRankLabel.draw(sprite_batch, offset); ExpRankLabel.draw(sprite_batch, offset); // Data TurnsBar.draw(sprite_batch, offset); CombatBar.draw(sprite_batch, offset); ExpBar.draw(sprite_batch, offset); TotalRankLetter.draw(sprite_batch, offset); TurnsRankLetter.draw(sprite_batch, offset); CombatRankLetter.draw(sprite_batch, offset); ExpRankLetter.draw(sprite_batch, offset); sprite_batch.End(); }
private void init() { int gridCount = _chessBoard.gridCount; _grids = new Pawn[gridCount]; _gridFlags = new GridFlag[2, gridCount]; _lastPutPawns[(int)Side.Self] = new ArrayList(); _lastPutPawns[(int)Side.Opposite] = new ArrayList(); _scoreText = gameObject.transform.Find("ScoreLabel/Score").GetComponent<AnimateNumber>(); _comboText = gameObject.transform.Find("ComboLabel/Combo").GetComponent<Text>(); _backChanceText = gameObject.transform.Find("TitleLayer/Backwards/Count").GetComponent<Text>(); _trashChanceText = gameObject.transform.Find("TitleLayer/TrashCount").GetComponent<Text>(); _backButton = gameObject.transform.Find("TitleLayer/Backwards").GetComponent<Button>(); _trashButton = gameObject.transform.Find("TitleLayer/Trash").GetComponent<Button>(); _levelText = gameObject.transform.Find("TitleLayer/Level").GetComponent<Text>(); _expBar = gameObject.transform.Find("TitleLayer/ExpBar").GetComponent<ExpBar>(); _titleLayer = gameObject.transform.Find("TitleLayer").GetComponent<MainTitleLayer>(); _nextPawnBoard = gameObject.transform.Find("NextPawnBoard").GetComponent<NextPawnBoard>(); initTraverseIndice(); prepareNextPawn(); }
public override void Draw(GameTime gameTime) { int TailleGlobe = TextureVie.Width; Rectangle rectangleSourceVie = new Rectangle(0, (int)(TailleGlobe * (1 - Joueur.PtsVie / Joueur.PtsVieMax)), TailleGlobe, (int)(TailleGlobe * Joueur.PtsVie / Joueur.PtsVieMax)); Rectangle rectangleSourceRessource = new Rectangle(0, (int)(TailleGlobe * (1 - Joueur.PtsRessource / Joueur.PtsRessourceMax)), TailleGlobe, (int)(TailleGlobe * Joueur.PtsRessource / Joueur.PtsRessourceMax)); Jeu.GestionSprites.Begin(); Jeu.GestionSprites.Draw(TextureVie, new Vector2(POSITION_VIE_X * ScèneJeu.Scale.X, (POSITION_VIE_Y + (TailleGlobe * (1 - Joueur.PtsVie / Joueur.PtsVieMax))) * ScèneJeu.Scale.Y), rectangleSourceVie, Color.White, 0, new Vector2(TailleGlobe / 2, TailleGlobe / 2), ScèneJeu.Scale, SpriteEffects.None, 0f); Jeu.GestionSprites.Draw(TextureRessource, new Vector2(POSITION_RESSOURCE_X * ScèneJeu.Scale.X, (POSITION_RESSOURCE_Y + (TailleGlobe * (1 - Joueur.PtsRessource / Joueur.PtsRessourceMax))) * ScèneJeu.Scale.Y), rectangleSourceRessource, Color.White, 0, new Vector2(TailleGlobe / 2, TailleGlobe / 2), ScèneJeu.Scale, SpriteEffects.None, 0f); Jeu.GestionSprites.Draw(GUI, new Rectangle(0, 0, Jeu.Window.ClientBounds.Width, Jeu.Window.ClientBounds.Height), Color.White); Jeu.GestionSprites.End(); ExpBar.Draw(gameTime); for (int i = 0; i < Spells.Length; i++) { Spells[i].Draw(gameTime); } for (int i = 0; i < Spells.Length; i++) { Spells[i].DrawText(gameTime); } Stats.Draw(gameTime); Stats.DrawText(gameTime); base.Draw(gameTime); }
public static async Task <MemoryStream> DrawProfileImageAsync(uint level, string name, uint exp, ulong pen, uint rank, byte theme, ExpBar expBar, string avatarUrl) { bool isAnimated = false; if (theme == 11) { isAnimated = true; } string extension = !isAnimated ? ".png" : ".gif"; var image = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\Profile" + theme + extension); var avatar = await GetAvatarAsync(avatarUrl); var icon = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\Level" + level.ToString() + ".png"); var expbar = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\ExpBar" + theme + ".png"); uint frameCount = 1; var frames = new Bitmap[1]; if (isAnimated) { frameCount = (uint)image.GetFrameCount(FrameDimension.Time); frames = new Bitmap[frameCount]; } using (var bottomFont = new Font("Arial", 9)) { using (var nameFont = new Font("Arial", 18, FontStyle.Bold)) { for (uint i = 0; i < frameCount; i++) { image.SelectActiveFrame(FrameDimension.Time, (int)(i)); frames[i] = new Bitmap(285, 192); using (var g = Graphics.FromImage(frames[i])) { g.DrawImage(image, new Point(0, 0)); g.DrawImage(avatar, 20, 20, 55, 55); g.DrawImage(icon, 89, 35, 26, 26); g.DrawImage(expbar, 42, 100, 200 * expBar.Percentage, 11); g.DrawString(level.ToString(), bottomFont, Brushes.White, 135 - MeasureString(level.ToString(), bottomFont).Width, 164); g.DrawString(exp.ToString(), bottomFont, Brushes.White, 135 - MeasureString(exp.ToString(), bottomFont).Width, 142); g.DrawString(pen.ToString(), bottomFont, Brushes.White, 262 - MeasureString(pen.ToString(), bottomFont).Width, 142); g.DrawString(rank.ToString(), bottomFont, Brushes.White, 262 - MeasureString(rank.ToString(), bottomFont).Width, 164); g.DrawString(((uint)(expBar.Percentage * 100)).ToString() + "%", bottomFont, Brushes.White, 275 - MeasureString(((uint)(expBar.Percentage * 100)).ToString() + "%", bottomFont).Width, 97); g.DrawString("Exp:", bottomFont, Brushes.White, 16, 97); g.DrawString("/", bottomFont, Brushes.White, 142, 114); g.DrawString(expBar.CurrentExp.ToString(), bottomFont, Brushes.White, 144 - MeasureString(expBar.CurrentExp.ToString(), bottomFont).Width, 114); g.DrawString(expBar.NextLevelExp.ToString(), bottomFont, Brushes.White, 147, 114); g.DrawString(name, nameFont, Brushes.White, 125, 33); } } } } avatar.Dispose(); if (!isAnimated) { return(frames[0].ToStream()); } return(await frames.ToStream()); }
public static async Task <MemoryStream> DrawRankImageAsync(uint level, string name, uint rank, byte theme, ExpBar expBar, string avatarUrl) { bool isAnimated = false; if (theme == 11) { isAnimated = true; } string extension = !isAnimated ? ".png" : ".gif"; var image = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\Rank" + theme + extension); var avatar = await GetAvatarAsync(avatarUrl); var icon = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\Level" + level.ToString() + ".png"); var expbar = ImageCache.GetOrAdd(AppDomain.CurrentDomain.BaseDirectory + "resources\\ExpBar" + theme + ".png"); uint frameCount = 1; var frames = new Bitmap[1]; if (isAnimated) { frameCount = (uint)image.GetFrameCount(FrameDimension.Time); frames = new Bitmap[frameCount]; } using (var bottomFont = new Font("Arial", 9)) using (var nameFont = new Font("Arial", 18, FontStyle.Bold)) { for (uint i = 0; i < frameCount; i++) { image.SelectActiveFrame(FrameDimension.Time, (int)(i)); frames[i] = new Bitmap(285, 96); using (var g = Graphics.FromImage(frames[i])) { g.DrawImage(image, new Point(0, 0)); g.DrawImage(avatar, 19, 19, 40, 40); g.DrawImage(icon, 73, 26, 26, 26); g.DrawImage(expbar, 38, 64, 200 * expBar.Percentage, 11); g.DrawString("Rank: #" + rank.ToString(), bottomFont, Brushes.White, 115, 47); g.DrawString(((uint)(expBar.Percentage * 100)).ToString() + "%", bottomFont, Brushes.White, 270 - MeasureString(((uint)(expBar.Percentage * 100)).ToString() + "%", bottomFont).Width, 61); if (theme != 0) { g.DrawString("Exp:", bottomFont, Brushes.White, 13, 61); } g.DrawString(name, nameFont, Brushes.White, 111, 20); } } } avatar.Dispose(); if (!isAnimated) { return(frames[0].ToStream()); } return(await frames.ToStream()); }
// Use this for initialization void Awake() { instance = this; exp_slider = this.GetComponent <Slider> (); exp_text = transform.Find("Fill Area/exp_text").GetComponent <Text> (); }
public void AcquireIfMissing() { if (!hud) { hud = gameObject.GetComponent <HUD>(); } if (localUser == null) { localUser = LocalUserManager.GetFirstLocalUser(); } if (userProfile == null) { userProfile = localUser.userProfile; } if (!characterMaster) { characterMaster = localUser.cachedMaster; if (characterMaster) { lastMoneyAmount = characterMaster.money; } lastCoinAmount = userProfile.coins; } if (!moneyRoot || !coinRoot) { var moneyTexts = UnityEngine.GameObject.FindObjectsOfType <MoneyText>(); foreach (var a in moneyTexts) { if (a.name == "MoneyRoot") { moneyRoot = (RectTransform)a.transform; valueText = a.targetText.rectTransform; } else if (a.name == "LunarCoinRoot") { coinRoot = (RectTransform)a.transform; valueTextLunar = a.targetText.rectTransform; } } } if (!characterBody) { if (characterMaster) { characterBody = characterMaster.GetBody(); } if (characterBody) { if (!healthComponent) { healthComponent = characterBody.healthComponent; lastHealth = (int)healthComponent.health; lastBarrier = (int)healthComponent.barrier; lastShield = (int)healthComponent.shield; } } } if (!expBar) { expBar = FindObjectOfType <ExpBar>(); } if (lastExperience == -1) { if (characterBody) { lastExperience = (int)characterBody.experience; //Application.targetFrameRate = 30; //QualitySettings.vSyncCount } else if (TeamManager.instance) { var teamIndex = TeamIndex.Player; lastExperience = (int)TeamManager.instance.GetTeamCurrentLevelExperience(teamIndex); } } }
void Awake(){ _instance = this; Expslider = this.GetComponent<UISlider> (); }
void Awake() { instance = this; }
void OnTriggerEnter2D(Collider2D collision) { if (collision.CompareTag("Slime")) { critico = Random.Range(1, 101); Slime_Stats Slime = collision.GetComponent <Slime_Stats>(); if (Slime.morreu == false) { DropCoin drop = collision.GetComponent <DropCoin>(); if (critico <= sword.SwordCurrentCriticoChance) { calculo = expbar.danoplayer + sword.Sword_CurrentDamage * 2; Slime.Life_Slime -= calculo; } else { calculo = expbar.danoplayer + sword.Sword_CurrentDamage; Slime.Life_Slime -= calculo; } if (Slime.Life_Slime <= 0) { Slime.morreu = true; ExpBar expBar = collision.GetComponent <ExpBar>(); drop.ChanceCoinPotion(); //expBar.Experiencia(); GameManager gamemanager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); gamemanager.monstrosMortos++; gamemanager.monstrosMortos2++; gamemanager.monstrosMortos3++; } else { Slime.gameObject.GetComponent <Animator>().SetTrigger("Hit"); } } } if (collision.CompareTag("Tronco")) { critico = Random.Range(1, 101); Tronco_Stats Tronco = collision.GetComponent <Tronco_Stats>(); if (Tronco.morreu == false) { DropCoin drop = collision.GetComponent <DropCoin>(); if (critico <= sword.SwordCurrentCriticoChance) { Tronco.Life_Tronco -= sword.Sword_CurrentDamage * 2; } else { Tronco.Life_Tronco -= sword.Sword_CurrentDamage; } if (Tronco.Life_Tronco <= 0) { Tronco.morreu = true; drop.ChanceCoinPotion(); //expBar.Experiencia(Tronco.xpMin, Tronco.xpMax); GameManager gamemanager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <GameManager>(); gamemanager.monstrosMortos++; gamemanager.monstrosMortos2++; gamemanager.monstrosMortos3++; } else { Tronco.gameObject.GetComponent <Animator>().SetTrigger("Hit"); } } } if (collision.CompareTag("Boss")) { critico = Random.Range(1, 101); ScriptBoss boss = collision.GetComponent <ScriptBoss>(); if (critico <= sword.SwordCurrentCriticoChance) { boss.Life -= sword.Sword_CurrentDamage * 2; } else { boss.Life -= sword.Sword_CurrentDamage; } } }
//ExpBar expBar; public void Start() { expbar = GameObject.FindGameObjectWithTag("ExpBar").GetComponent <ExpBar>(); }
void Update() { if (Regeneration) { regenCount += Time.deltaTime; if (regenCount > 3) { targetHealth += regenAmount; regenCount = 0; Instantiate(regenEffect, faceeffectlocation.transform); Soundmanager.instance.PlaySoundOneShot(Soundmanager.instance.SpellHeal, .5f); } } if (targetHealth > 100) { targetHealth = 100; } if (targetHealth < 0) { targetHealth = 0; } if (targetHealth <= 0) { SceneManager.LoadScene(4); } Vector3 currentPos = transform.position; if (currentPos != lastPos && !Sword.GetComponent <SwordController>().isWalking) { Sword.SendMessage("Walking"); } else if (currentPos == lastPos && Sword.GetComponent <SwordController>().isWalking) { Sword.SendMessage("StoppedWalking"); } lastPos = currentPos; HealthBar.GetComponent <RectTransform>().sizeDelta = new Vector2(health, 99); ExpBar.GetComponent <RectTransform>().sizeDelta = new Vector2(expCalc, 99); groundedPlayer = controller.isGrounded; if (groundedPlayer && playerVelocity.y < 0) { playerVelocity.y = 0f; } Vector2 movement = inputManager.GetPlayerMovement(); Vector3 move = new Vector3(movement.x, 0f, movement.y); move = cameraTransform.forward * move.z + cameraTransform.right * move.x; controller.Move(move * Time.deltaTime * playerSpeed); //if (move != Vector3.zero) //{ // gameObject.transform.forward = move; //} // Changes the height position of the player.. if (inputManager.PlayerJumped() && groundedPlayer) { playerVelocity.y += Mathf.Sqrt(jumpHeight * -3.0f * gravityValue); } playerVelocity.y += gravityValue * Time.deltaTime; controller.Move(playerVelocity * Time.deltaTime); }
void Awake() { _instance = this; progressBar = this.GetComponent <UISlider>(); }
// Use this for initialization void Start() { anim = GetComponent <Animator>(); inimigo = GetComponent <EnemySlime>(); experiencia = GameObject.FindGameObjectWithTag("ExpBar").GetComponent <ExpBar>(); }
private void Awake() { _instanceExp = this; }
private void Awake() { _Instance = this; slider = GetComponent <UISlider>(); }