public void Next(float pastRound, bool tileMatching)//附带判断地形因素 { roundPast++; pastRoundTotal += pastRound; HpBar.Update(); SkillAssistant.CheckAuroState(this, tileMatching); if (pastRoundTotal >= 1) { pastRoundTotal -= 1; HpBar.OnRound(); if (WeaponId > 0) { Weapon.OnRound(); } } BuffManager.BuffCount(); if (SkillManager.CheckSpecial(pastRound)) { return;//特殊技能触发 } aiController.CheckAction(); }
IEnumerator OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { HpBar.hpObject = GameObject.Find("HpBar"); HpBar.decreaseHealth(); if (activateExplosion) { explosion(); } GameObject player = GameObject.Find("Airship"); for (int i = 0; i < 5; i++) { player.GetComponent <Renderer> ().material.color = Color.red; yield return(new WaitForSeconds(0.1f)); player.GetComponent <Renderer> ().material.color = Color.white; yield return(new WaitForSeconds(0.1f)); } Destroy(this.gameObject); } else if (other.gameObject.tag != "ShieldPower" && other.gameObject.tag != "Boss" && other.gameObject.tag != "Laser") { Destroy(this.gameObject); } }
protected ProtoEnemy() { EnemyFrames = new List <Sprite>(); ReloadingClock = new Clock(); animationClock = new Clock(); HpBar = new HpBar(Dimensions); }
public bool BeHited(LiveMonster src) { int hitrate = SkillAssistant.GetHit(src, this); if (hitrate > MathTool.GetRandom(100)) { HitDamage damage = SkillAssistant.GetDamage(src, this); CheckDamageBuffEffect(src, damage); HpBar.OnDamage(damage); SkillAssistant.CheckHitEffectAfter(src, this, damage); if (src.WeaponId > 0) { src.Weapon.OnHit(); } if (WeaponId > 0) { Weapon.OnHited(); } if (damage.Value > 0) { BuffManager.CheckRecoverOnHit(); lastDamagerId = src.Id; peakDamagerLuk = Math.Max(peakDamagerLuk, src.RealLuk); } return(true); } return(false); }
public Boss(Texture bossTexture, Texture backgroundBossTexture) { dimensions = new Vector2f { X = 512 * 0.7f * WindowProperties.ScaleX, Y = 204 * 0.7f * WindowProperties.ScaleY }; bossFrames = new List <Sprite>(); backgroundBossFrames = new List <Sprite>(); for (var i = 0; i < 6; i++) { { var enemyFrame = new Sprite(bossTexture) { Origin = new Vector2f(256f, 192f), Scale = new Vector2f(0.7f * WindowProperties.ScaleX, 0.7f * WindowProperties.ScaleY), Position = new Vector2f(WindowProperties.WindowWidth / 2, WindowProperties.WindowHeight / 7), TextureRect = new IntRect(i * 512, 0, 512, 204) }; bossFrames.Add(enemyFrame); } { var backgroundEnemyFrame = new Sprite(backgroundBossTexture) { Origin = new Vector2f(500f, 104f), Scale = new Vector2f(0.7f * WindowProperties.ScaleX, 0.7f * WindowProperties.ScaleY), Position = new Vector2f(WindowProperties.WindowWidth / 2, WindowProperties.WindowHeight / 7), TextureRect = new IntRect(i * 1000, 0, 1000, 208) }; backgroundBossFrames.Add(backgroundEnemyFrame); } } movementDirection = new DirectionsVector(Directions.Left, Directions.Down); hpBar = new HpBar(new Vector2f(WindowProperties.WindowWidth / 1.3f, WindowProperties.WindowHeight / 15)); changingAttackSound = new Music(Resources.BossWarpSound); changingAttackSound.Stop(); reloadingClock = new Clock(); animationClock = new Clock(); bossClock = new Clock(); random = new Random(); howMuchBossFliedInOneDirection = new Vector2f(WindowProperties.WindowWidth / 4, WindowProperties.WindowHeight / 8); hpMax = 3000; Hp = hpMax; }
public void Inisialize(HpBar Hp, float NewHp, Vector2 StartPosition, Vector2 GorlPosition) { this.Hp = Hp; this.NewHp = NewHp; this.StartPosition = StartPosition; this.GorlPosition = GorlPosition; }
/// <summary> /// バトル用アニメーションクラス作成、初期化 /// </summary> /// <param name="Hp">アニメーションするHP</param> /// <param name="NewHp">アニメーション後HP</param> /// <param name="StartPosition">エフェクトの初期座標</param> /// <param name="GorlPosition">エフェクト後座標</param> public void ButtleAnimationCreate(HpBar Hp, float NewHp, Vector2 StartPosition, Vector2 GorlPosition) { ButtleAnimation buttleAnimation = Instantiate(ButtleAnimation).GetComponent <ButtleAnimation>(); ButtleAnimationList.Add(buttleAnimation); buttleAnimation.Inisialize(Hp, NewHp, StartPosition, GorlPosition); }
public Enemy3(Texture enemyTexture) { Dimensions.X = 255 * 0.3f * WindowProperties.ScaleX; Dimensions.Y = 255 * 0.3f * WindowProperties.ScaleY; for (var i = 0; i < 6; i++) { var enemyFrame = new Sprite(enemyTexture) { Origin = new Vector2f(127.5f, 195.0f), Scale = new Vector2f(0.3f * WindowProperties.ScaleX, 0.3f * WindowProperties.ScaleY), Position = RandomHorizontalPosition(), TextureRect = new IntRect(i * 255, 0, 255, 390) }; EnemyFrames.Add(enemyFrame); } HpBar = new HpBar(Dimensions); cannons = new Cannons(Position, Dimensions); HpMax = 12; Hp = HpMax; }
public void Constructor(int HP, int moveSelect, int speed, float RTF, float bulletSpeed, int damage) { this.HP = HP; this.maxHp = HP; this.hpBar = gameObject.transform.GetChild(1).GetComponent <HpBar>(); onHit = (int)(HP * 0.1); gameObject.GetComponent <Gun>().ConstructorBulletEnemy(RTF, bulletSpeed, damage); switch (moveSelect) { case 1: gameObject.AddComponent <DownMovement>(); gameObject.GetComponent <DownMovement>().SetSpeed(speed); break; case 2: gameObject.AddComponent <ZigZagMovement>(); gameObject.GetComponent <ZigZagMovement>().SetSpeed(speed); gameObject.GetComponent <ZigZagMovement>().SetSpriteWidth(gameObject.GetComponent <SpriteRenderer>().bounds.size.x / 2); break; case 3: gameObject.AddComponent <LeftRightMovement>(); gameObject.GetComponent <LeftRightMovement>().SetSpeed(speed); gameObject.GetComponent <LeftRightMovement>().SetSpriteWidth(gameObject.GetComponent <SpriteRenderer>().bounds.size.x / 2); break; default: break; } }
public void Transform(int monId) { if (IsHero) { NLog.Warn("hero cannot be Transform"); return; } int cardId = Weapon == null ? 0 : Weapon.CardId; var savedWeapon = Weapon == null ? null : Weapon.GetCopy(); DeleteWeapon(); int lifp = Life * 100 / Avatar.Hp; MonsterCoverBox.RemoveAllCover(); SkillManager.CheckRemoveEffect(); OwnerPlayer.State.CheckMonsterEvent(false, this); Avatar = new Monster(monId); Avatar.UpgradeToLevel(Level); OwnerPlayer.State.CheckMonsterEvent(true, this); SetBasicData(); MonsterCoverBox.CheckCover(); SkillManager.CheckInitialEffect(); if (cardId > 0) { AddWeapon(savedWeapon); } HpBar.SetHp(Avatar.Hp * lifp / 100); }
internal override void OnIncreaseScoreHit(IncreaseScoreType ist, double hpIncrease, HitObject h) { if (h == specialMovementNextFruit) { ResetMovementSpeed(); specialMovementNextFruit = null; } if (ist == IncreaseScoreType.FruitTickTiny || hpIncrease <= 0) { return; } ResetMovementSpeed(); //applies hyperdash checkDistanceToNextFruit(h as HitCircleFruits); WiimoteManager.Rumble(Player.KiaiActive ? 64 : 32); HpBar.KiBulge(); if (HpBar.CurrentHp > 180) { HpBar.KiExplode(); } }
private static void Drawing_OnDraw(EventArgs args) { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) { return; } try { if (Sprite.IsDisposed) { return; } foreach (var hero in ObjectManager.Get <Obj_AI_Hero>() .Where(hero => hero != null && hero.IsValid && hero.IsHPBarRendered && (hero.IsEnemy && PUC.Menu.Item("tb_show_enemy").GetValue <bool>() || !hero.IsMe && hero.IsAlly && PUC.Menu.Item("tb_show_friend").GetValue <bool>() || hero.IsMe && PUC.Menu.Item("tb_show_me").GetValue <bool>()))) { Sprite.Begin(); var indicatorsummoner = new HpBar { Unit = hero }; X = (int)indicatorsummoner.Position.X; Y = (int)indicatorsummoner.Position.Y; var k = 0; foreach (var sSlot in SummonerSpellSlots) { var spell = hero.SummonerSpellbook.GetSpell(sSlot); var texture = SummonerTextures[spell.Name]; var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; Sprite.Draw( texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(13 * n, 0, 13, 13), hero.IsMe ? new Vector3(-X - 3 - 13 * k - 100, -Y - 1, 0) : new Vector3(-X - 3 - 13 * k - 75, -Y - 1, 0)); k++; } k = 0; foreach (var sSlot in SpellSlots) { var spell = hero.Spellbook.GetSpell(sSlot); var texture = SpellTextures[spell.Slot.ToString()]; var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; Sprite.Draw( texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(13 * n, 0, 13, 13), hero.IsMe ? new Vector3(-X - 3 - 13 * k - 24, -Y - 1, 0) : new Vector3(-X - 3 - 13 * k + 1, -Y - 1, 0)); k++; } Sprite.Draw(hero.IsMe ? TextureMe : TextureOther, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-X, -Y, 0)); Sprite.End(); } } catch (Exception e) { Console.WriteLine(@"/ff can't draw sprites: " + e); } }
public HpBar AddHpBar(Transform owner, float offset) { Transform h = Instantiate(hpBarPrefab, this.transform) as Transform; HpBar b = h.GetComponent <HpBar>(); b.SetOwner(owner, offset); return(b); }
public void Revive() { GhostTime = 0; BattleManager.Instance.MemMap.GetMouseCell(Position.X, Position.Y).UpdateOwner(Id); HpBar.SetHp(1);//复活给1hp SkillManager.CheckInitialEffect(); }
// Use this for initialization void Start() { StageClearUI.SetActive(false); gameManager = new GameManager(); m_cHpBar = new HpBar(); DungeonInit(); m_bStageClear = false; }
protected override void OnEditorSetting() { base.OnEditorSetting(); this.unitRange = this.FindComponent <UnitRange>("Range"); this.body = this.FindComponent <UnitBody>("Body"); this.hpBar = this.FindComponent <HpBar>("UI/HpBar"); }
public override void Start() { base.Start(); visual.GetComponent <Collider> ().enabled = true; hpBar = Instantiate(HpBarPrefab, visual.transform).GetComponent <HpBar> (); hpBar.transform.localPosition = new Vector3(0, 1.7f, 0); hpBar.UpdateHPBar(currentHP, MaxHP); }
internal override void UpdateHp() { if (HpBar != null && player.DrainTime) { HpBar.ReduceCurrentHp((HpBar.HpDropRate / PASSIVE_DROP_LENIENCE) * (AudioEngine.Time - AudioEngine.TimeLastFrame)); } base.UpdateHp(); }
public void OnMagicDamage(IMonster source, double damage, int element) { var damValue = damage * (1 - FormulaBook.GetMagDefRate(RealMag)); var dam = new HitDamage((int)damValue, (int)damValue, element, DamageTypes.Magic); lastDamagerId = source == null ? 0 : source.Id; CheckMagicDamage(dam); HpBar.OnDamage(dam); }
protected void AddHpBar() { GameObject go = Managers.Resource.Instantiate("UI/HpBar", transform); go.transform.localPosition = new Vector3(0, 0.5f, 0); go.name = "HpBar"; _hpBar = go.GetComponent <HpBar>(); UpdateHpBar(); }
public void SuddenDeath() { if (Avatar.MonsterConfig.IsBuilding) { BattleManager.Instance.FlowWordQueue.Add(new FlowWord("抵抗", Position, 0, "Gold", 26, 0, 0, 1, 15), false); return; } HpBar.SetHp(0); }
public override void Start() { base.Start(); ShipParts = GetComponentsInChildren <ShipPart>(); rb = GetComponent <Rigidbody2D>(); hpbar = FindObjectOfType <HpBar>(); controller = GetComponent <PlayerController>(); originalSpeed = baseMoveSpeed; }
void Awake() { highlightBox = transform.Find("chkHighlight").gameObject; playerRigid = GetComponent <Rigidbody>(); nowRot = transform.localRotation; playerCamera = GameObject.Find("Camera").GetComponent <Camera>(); cameraAni = playerCamera.GetComponent <Animator>(); playerAniCon = GetComponent <AnimationController>(); sceneName = SceneManager.GetActiveScene().name; if (sceneName == "ItemCollectScene") { playerSpeed = 3; s_itemBtn = GameObject.Find("itemBtnCanvas/btn_GetItem").GetComponent <ItemBtn>(); canvas = GameObject.Find("Canvas"); Block = null; } else if (sceneName == "GameScene") { DontDestroyOnLoad(transform.parent); GM = GameObject.Find("GameMgr2/itemFieldCntrl").GetComponent <ItemFieldCntrl>(); sockServObj = GameObject.Find("GameMgr2/MatchingCntrl"); playerInfo = sockServObj.GetComponent <GameEnterScript>(); weaponNum = playerInfo.savCharInfo.weapon; spawnInfo = sockServObj.GetComponent <SpawnScript>(); shotMgr = GetComponentInChildren <ShotManager>(); shotMgr.ShotPosChange(weaponNum); shotMgr.point = GameObject.Find("PointPrefab"); shotMgr.point.SetActive(false); StartCoroutine(MoveDelay()); //플레이어의 정보 전송하는 코루틴 hpText = GameObject.Find("Canvas").transform.GetChild(0).GetComponent <Text>(); playerHPBar = GameObject.Find("Canvas").transform.GetChild(3).GetComponent <HpBar>(); Block = GameObject.Find("Canvas").transform.GetChild(4).gameObject; s_itemSpawn = GameObject.Find("itemSpawnArr").GetComponent <ItemSpawn>(); s_hitEffect = GameObject.Find("HitEffect").GetComponent <hitEffect>(); ChinkEffect = GameObject.Find("ChinkEffect"); ItemImg = new GameObject[4]; ItemImg[(int)eITEM.em_HP_POTION] = GameObject.Find("HpPotionImg").gameObject; ItemImg[(int)eITEM.em_SPEED_POTION] = GameObject.Find("SpdPotionImg").gameObject; ItemImg[(int)eITEM.em_DAMAGE_UP_POTIOM] = GameObject.Find("AtkPotionImg").gameObject; ItemImg[(int)eITEM.em_DEFENCE_UP_POTION] = GameObject.Find("DefPotionImg").gameObject; for (int i = 0; i < 4; i++) { ItemImg[i].SetActive(false); } sound = GameObject.Find("GameMgr").GetComponent <BgmController>(); effSound = gameObject.GetComponentInChildren <EffSoundController>(); } }
internal override void UpdateHp() { if (player.DrainTime) { HpBar.ReduceCurrentHp(HpBar.HpDropRate * (AudioEngine.Time - AudioEngine.TimeLastFrame)); } base.UpdateHp(); }
public void init(AI ai, Environment env, unitData data, HpBar hpbar) { this.ai = ai; this.env = env; this.data = data; this.state = new unitState(); this.hpbar = hpbar; this.data._onLifeChange += hpbarCallBack; this.data._onDeath = onUnitDeath; }
void Start() { Me = this; _hpBar = transform.GetChild(0).gameObject.AddComponent <HpBar>(); _floatButton = transform.GetChild(1).gameObject.AddComponent <FloatButton>(); _win = transform.GetChild(3).gameObject; _lose = transform.GetChild(2).gameObject; _win.gameObject.SetActive(false); _lose.gameObject.SetActive(false); }
public void SetTeam(TeamType teamType) { if (teamType == TeamType.BLUE) { HpBar.SetColor(new Color(0, 0, 255)); } else { HpBar.SetColor(new Color(255, 0, 0)); } }
void Awake() { stageCtrler = GameObject.FindObjectOfType <StageController>(); effectCtrler = GameObject.FindObjectOfType <EffectController>(); hpBar = transform.FindChild("Hp Bar").GetComponent <HpBar>(); animator = GetComponent <Animator>(); defaultAttackCollider = transform.FindChild("Default Attack").GetComponent <Collider2D>(); defaultAttackCollider.enabled = false; startHp = hp; StartCoroutine(FillHp()); }
//加载heroHP GameObject LoadHP(GameObject go, FightPlayerModel player) { GameObject hp = Instantiate(Resources.Load("Prefab/HpBar")) as GameObject; hp.transform.parent = HP; HpBar hpBar = hp.GetComponent <HpBar>(); hpBar.SetTaget(go.transform.Find("headhp")); hpBar.refesh(player); return(hp); }
protected virtual void Awake() { moveSpeed = DefaultMoveSpeed; actionValue = DefaultActionValue; damage = DefaultDamage; startHp = hp; stageCtrler = GameObject.FindObjectOfType <StageController>(); effectCtrler = GameObject.FindObjectOfType <EffectController>(); hpBar = transform.FindChild("Hp Bar").GetComponent <HpBar>(); animator = GetComponent <Animator>(); }
/// <summary> /// 创建血条 /// </summary> /// <param name="parent">父级容器</param> public void createHpBar(Transform parent) { if (this.hpBar == null) { GameObject pf = Resources.Load("Prefabs/hpBar") as GameObject; this.hpBarGo = MonoBehaviour.Instantiate(pf, new Vector3(0, 0), new Quaternion()) as GameObject; this.hpBarGo.transform.SetParent(parent); this.hpBarGo.transform.localScale = new Vector3(1, 1, 1); this.hpBarGo.transform.localPosition = new Vector3(); this.hpBar = this.hpBarGo.GetComponent<HpBar>(); } }
private static void Drawing_OnDraw(EventArgs args) { if (Drawing.Direct3DDevice == null || Drawing.Direct3DDevice.IsDisposed) return; try { if (Sprite.IsDisposed) return; foreach(var hero in ObjectManager.Get<Obj_AI_Hero>() .Where(hero => hero != null && hero.IsValid && hero.IsHPBarRendered && (hero.IsEnemy && PUC.Menu.Item("tb_show_enemy").GetValue<bool>() || !hero.IsMe && hero.IsAlly && PUC.Menu.Item("tb_show_friend").GetValue<bool>() || hero.IsMe && PUC.Menu.Item("tb_show_me").GetValue<bool>() ))) { Sprite.Begin(); var indicatorsummoner = new HpBar {Unit = hero}; X = (int)indicatorsummoner.Position.X; Y = (int)indicatorsummoner.Position.Y; var k = 0; foreach(var sSlot in SummonerSpellSlots) { var spell = hero.SummonerSpellbook.GetSpell(sSlot); var texture = SummonerTextures[spell.Name]; var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; Sprite.Draw( texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(13*n, 0, 13, 13), hero.IsMe ? new Vector3(-X - 3 - 13*k - 100, -Y - 1, 0) : new Vector3(-X - 3 - 13*k - 75, -Y - 1, 0)); k++; } k = 0; foreach(var sSlot in SpellSlots) { var spell = hero.Spellbook.GetSpell(sSlot); var texture = SpellTextures[spell.Slot.ToString()]; var t = spell.CooldownExpires - Game.Time; var percent = (Math.Abs(spell.Cooldown) > float.Epsilon) ? t / spell.Cooldown : 1f; var n = (t > 0) ? (int)(19 * (1f - percent)) : 19; Sprite.Draw( texture, new ColorBGRA(255, 255, 255, 255), new SharpDX.Rectangle(13*n, 0, 13, 13), hero.IsMe ? new Vector3(-X - 3 - 13*k - 24, -Y - 1, 0) : new Vector3(-X - 3 - 13*k +1, -Y - 1, 0)); k++; } Sprite.Draw(hero.IsMe ? TextureMe : TextureOther, new ColorBGRA(255, 255, 255, 255), null, new Vector3(-X, -Y, 0)); Sprite.End(); } } catch(Exception e) { Console.WriteLine(@"/ff can't draw sprites: " + e); } }
/// <summary> /// 销毁 /// </summary> public void destroy() { if (this.timer != null) this.timer.stop(); if (this.roleGo != null) this.roleGo.transform.DOKill(); GameObject.Destroy(this.roleGo); this.roleGo = null; GameObject.Destroy(this.hpBarGo); this.hpBarGo = null; this.hpBar = null; this.timer = null; this.heroVo = null; if(this.targetList != null) this.targetList.Clear(); this.targetList = null; }