private void InitParam() { m_UseParam.SetTo(m_OriginParam); mBuffSystem.Init(m_UseParam); mAgent.speed = m_UseParam.MoveSpeed; //mAgent.speed = Random.Range(10f, 20f); mAgent.enabled = true; mRigid.velocity = Vector3.zero; mRigid.angularVelocity = Vector3.zero; mRigid.useGravity = false; mAttackPoint = Vector3.zero; mMonsterHUD = HUDManager.Instance.Obtain("MonsterHUD"); mMonsterHUD.SetEnable(); mMonsterHUD.SetTarget(mTs); mMonsterHUD.SetHealth(GetPercentHP()); SetMonsterAction(MonsterAction.Spawn); RunLoop(); }
public override void SetDisable() { base.SetDisable(); HUDManager.Retrieve(mMonsterHUD); mMonsterHUD = null; }
protected override void OnEnable() { my = gameObject.GetComponent<Transform>(); monsterCollider = gameObject.GetComponent<BoxCollider2D>(); _monsterData = DataManager.Instance.monsterData.list[no - 1]; //monsterLevel = PlayerManager. playerlevel +- 5; maxHp = (_monsterData.maxHP)*monsterLevel*elite; monsterName = _monsterData.name; if (isSplit) { maxHp *= 0.5f; monsterName = monsterName + "Split"; } currentHp = maxHp; moveSpeed = _monsterData.moveSpeed;//(elite); feature1 = _monsterData.feature1; feature2 = _monsterData.feature2; KnockbackTime /= elite; my.localScale *= elite; KnockbackTime /= (elite * elite); if (elite >= 3) { KnockbackTime = 0; } healHP = maxHp * feature2; currentSP = 0; monsterSprite = gameObject.GetComponentInChildren<SpriteRenderer>(); base.OnEnable(); StartCoroutine(MonsterAnimation()); monsterHUD = GameObject.FindGameObjectWithTag("MonsterUI").GetComponent<MonsterHUD>(); imagePath = ("Monsters/Level" + elite.ToString() + "/monster_" + (no * 2).ToString()).ToString(); }