void Awake() { instance = this; name = transform.Find("Name").GetComponent <UILabel>(); hpBar = transform.Find("HP").GetComponent <UISlider>(); mpBar = transform.Find("MP").GetComponent <UISlider>(); hpLabel = transform.Find("HP/Thumb/Label").GetComponent <UILabel>(); mpLabel = transform.Find("MP/Thumb/Label").GetComponent <UILabel>(); }
private void Awake() { _Instance = this; playerStatus = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerStatus>(); headName = transform.Find("Name").GetComponent <UILabel>(); hpBar = transform.Find("Hp").GetComponent <UISlider>(); mpBar = transform.Find("Mp").GetComponent <UISlider>(); hpLabel = transform.Find("Hp/Thumb/Label").GetComponent <UILabel>(); mpLabel = transform.Find("Mp/Thumb/Label").GetComponent <UILabel>(); }
public BigSnake(object sprite, Vector2 speed, Vector2 locate, float enemySize, float enemySize2, AIBase.ID id) : base(sprite, speed, locate, 0, enemySize, enemySize2, 0, id) { CurrentStatus = HeadStatus.Good; Head = new List<Texture2D>(); HeadHP = new List<Texture2D>(); BodyNodeList = new List<BodyNode>(); this.Name = AIBase.BossID.SnakeBoss; this.CurrentSnakeStatus = SnakeStatus.Chase; this.CurrentCharge = 0; this.CurrentFreeze = 0; }
/// <summary> /// 设置或更新头顶名字 /// </summary> /// <param name="entity"></param> /// <param name="headStatus"></param> /// <param name="pvpCamp">阵营[PVP专用]</param> public void SetHead(EntityParent entity, HeadStatus headStatus = HeadStatus.Normal, PVPCamp pvpCamp = PVPCamp.CampOwn) { if (!m_heads.ContainsKey(entity.ID)) { return; } var head = m_heads[entity.ID] as PlayerHead; // [玩家自己] if (entity is EntityMyself) { // 玩家自己名称前加等级 if (MogoUIManager.IsShowLevel) { switch (headStatus) { case HeadStatus.Normal: head.SetName(string.Concat("[5ef5ff]", "LV", entity.level, "[-]") + " " + string.Concat("[13C5D9]", entity.name, "[-]")); break; case HeadStatus.PVP: break; default: break; } } // 不显示等级 else { switch (headStatus) { case HeadStatus.Normal: head.SetName(string.Concat("[13C5D9]", entity.name, "[-]")); break; case HeadStatus.PVP: break; default: break; } } head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } } // [其他玩家] else if (entity is EntityPlayer) { // 别的玩家名称前加等级 if (MogoUIManager.IsShowLevel) { switch (headStatus) { case HeadStatus.Normal: head.SetName(string.Concat("[84e747]", "LV", entity.level, "[-]") + " " + string.Concat("[11AE21]", entity.name, "[-]")); break; case HeadStatus.PVP: { // 自己阵营玩家(绿色) if (pvpCamp == PVPCamp.CampOwn) { head.SetName(string.Concat("[84e747]", "LV", entity.level, "[-]") + " " + string.Concat(HeadNameColor.Green, entity.name, "[-]")); } // 其他阵营玩家(红色) else { head.SetName(string.Concat("[84e747]", "LV", entity.level, "[-]") + " " + string.Concat(HeadNameColor.Red, entity.name, "[-]")); } } break; default: break; } } // 不显示等级 else { switch (headStatus) { case HeadStatus.Normal: head.SetName(string.Concat("[11AE21]", entity.name, "[-]")); break; case HeadStatus.PVP: { // 自己阵营玩家(绿色) if (pvpCamp == PVPCamp.CampOwn) { head.SetName(string.Concat(HeadNameColor.Green, entity.name, "[-]")); } // 其他阵营玩家(红色) else { head.SetName(string.Concat(HeadNameColor.Red, entity.name, "[-]")); } } break; default: break; } } head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } } else if (entity is EntityDummy) { head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } } else if (entity is EntityMercenary) { // 小伙伴 if (entity.ID == MogoWorld.theLittleGuyID) { head.SetName(HeadNameColor.Green + entity.name + "[-]"); head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } } else { MonsterData.MonsterType type = MonsterData.MonsterType.bigBoss; if ((entity as EntityMercenary).IsMonster()) { type = (MonsterData.MonsterType)(entity as EntityMercenary).MonsterData.monsterType; } else if ((entity as EntityMercenary).IsPVP()) { type = MonsterData.MonsterType.PVP; } switch (type) { case MonsterData.MonsterType.bigBoss: head.SetName("[FFD200]" + entity.name + "[-]"); head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } break; case MonsterData.MonsterType.smallBoss: head.SetName("[FF7E00]" + entity.name + "[-]"); head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } break; case MonsterData.MonsterType.PVP: if (MogoUIManager.IsShowLevel) { head.SetName(("[FF7E00]" + "LV" + entity.level + " " + entity.name + "[-]")); } else { head.SetName(("[FF7E00]" + entity.name + "[-]")); } head.SetTestInfo(entity.ID.ToString()); if (IsShowTestInfo) { head.ShowTestInfo(true); } break; default: break; } } } else if (entity is EntityNPC) { head.SetName("[FFD200]" + entity.name + "[-]"); } //head.SetBillboardBlood((float)entity.hp / (float)entity.maxHp); }
public override void Update(GameTime gameTime) { switch (CurrentSnakeStatus) { case SnakeStatus.Dead: if (this.Color.A != 0) this.Color.A -= 15; else { GameCommands.Enqueue( "clear" ); AIBase.EnemyList.Remove( this ); } break; case SnakeStatus.Notail: this.Speed = AIBase.Player.Locate - this.Locate; this.Speed.Length = this.Speed.Length/3 + 320; this.PostionGenerate(gameTime); this.LocateConfirm(); if ((this.Locate - AIBase.Player.Locate).Length() < 180) { this.CurrentSnakeStatus = SnakeStatus.NotailCharge; } break; case SnakeStatus.NotailCharge: if(this.CurrentCharge <= BigSnake.FreezeTime) { this.Speed = AIBase.Player.Locate - this.Locate; this.Speed.Length = this.Speed.Length/2; this.PostionGenerate(gameTime); this.LocateConfirm(); this.CurrentCharge++; }else { this.CurrentFreeze = 0; this.CurrentSnakeStatus = SnakeStatus.NotailAttack; } break; case SnakeStatus.NotailAttack: if (this.AttackIndex < SnakeAttackRange.Length) { this.Postion += CoreUtilities.GetVector(this.SnakeAttackRange[this.AttackIndex], this.Speed.Radian); this.AttackIndex++; if (!AIBase.SenceManager.IntersectPixels(this.Postion, 40)) this.LocateConfirm(); } else { this.AttackIndex = 0; this.CurrentSnakeStatus = SnakeStatus.NotailFreeze; AlreadyAttacked = true ; } if ((this.Locate - AIBase.Player.Locate).Length() <= 80) { if (AIBase.Player.Status != AIBase.Status.Freeze) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = this.Rotation; } } break; case SnakeStatus.NotailFreeze: if ((this.Postion - AIBase.Player.Postion).Length() < 80 && AIBase.Player.Status == AIBase.Status.Attck) { if (AlreadyAttacked) { if (this.CurrentStatus == HeadStatus.Good) { this.CurrentStatus = HeadStatus.Weak; AlreadyAttacked = false; } else if (this.CurrentStatus == HeadStatus.Weak) { this.CurrentStatus = HeadStatus.Bad; AlreadyAttacked = false; } else if (this.CurrentStatus == HeadStatus.Bad) { this.CurrentSnakeStatus = SnakeStatus.Dead; AlreadyAttacked = false; } } } if (this.CurrentFreeze < 2 * BigSnake.FreezeTime) { this.CurrentFreeze++; } else { this.CurrentFreeze = 0; if (this.CurrentSnakeStatus != SnakeStatus.Dead) this.CurrentSnakeStatus = SnakeStatus.Notail; } break; case SnakeStatus.AttackII: if (this.AttackIndex < this.SnakeAttackRange.Length - 1) { this.AttackIndex++; this.Postion += CoreUtilities.GetVector(this.SnakeAttackRange[this.AttackIndex], this.Speed.Radian); this.LocateConfirm(); if ((this.Locate - AIBase.Player.Locate).Length() <= 50) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = this.Rotation; } } else { this.AttackIndex = 0; this.CurrentSnakeStatus = SnakeStatus.Freeze; } break; case SnakeStatus.Chase: this.Speed = AIBase.Player.Locate - this.Locate; this.Speed.Length = this.Speed.Length / 3 + 320; this.Postion = AIBase.SenceManager.MoveTest(this.Locate, this.Speed, (float)gameTime.ElapsedGameTime.TotalSeconds); this.LocateConfirm(); this.m_rotate = Speed.Radian; if ((this.Locate - AIBase.Player.Locate).Length() >= 260) { this.CurrentSnakeStatus = SnakeStatus.Charge; } if ((this.Locate - AIBase.Player.Locate).Length() <= 180) { this.CurrentSnakeStatus = SnakeStatus.AttackII; } break; case SnakeStatus.Charge: if (this.CurrentCharge <= BigSnake.ChargeTime) { this.CurrentCharge++; this.Speed = AIBase.Player.Locate - this.Locate; this.m_rotate = Speed.Radian; this.Rotate = m_rotate; } else { this.CurrentCharge = 0; this.CurrentSnakeStatus = SnakeStatus.Attack; this.Speed = AIBase.Player.Locate - this.Locate; this.Speed.Length = this.Speed.Length / 3 + 320; } break; case SnakeStatus.Attack: this.PostionGenerate(gameTime); if (!AIBase.SenceManager.IntersectPixels(this.Postion, (int)(this.EnemySize * 100 / 2))) { this.LocateConfirm(); } else { this.CurrentSnakeStatus = SnakeStatus.Freeze; } if ((this.Locate - AIBase.Player.Locate).Length() < 80) { AIBase.Player.Status = AIBase.Status.Freeze; AIBase.Player.BeAttackedRadian = this.Rotation; } break; case SnakeStatus.Freeze: if (this.CurrentFreeze <= BigSnake.FreezeTime) { this.CurrentFreeze++; } else { this.CurrentFreeze = 0; this.CurrentSnakeStatus = SnakeStatus.Chase; } break; } foreach (var ptr in BodyNodeList) { ptr.Update(gameTime, this.Locate, this.BodyNodeList, this); ptr.RightGlass.GeneratePostion(ptr.Postion, ptr.Rotation); ptr.LeftGlass.GeneratePostion(ptr.Postion, ptr.Rotation); if (ptr.NodeStatus != NodeStatus.Bad) { ptr.LeftGlass.Update(gameTime); ptr.RightGlass.Update(gameTime); } } }