protected void ControlEnemy(int indexOfEnemy, float atk, GameObject hitEffect, string type, float time, float height = 2.0f) { if (indexOfEnemy > targets.Count) { return; } LookAtTarget(targets[indexOfEnemy].transform); BaseData data = targets[indexOfEnemy].GetComponent <BaseData>(); Controlled ctrled = targets[indexOfEnemy].GetComponent <Controlled>(); if (data != null) { // add a "get hit" effect to this enemy DoHitEffect(indexOfEnemy, hitEffect); m_hasAtked = true; // may be the character only control enemy but not attack it if (atk > 0) { data.Damaged(atk, PlayerData.GetInstance().armPieRate); if (ctrled != null) { if (ctrled.controller == null) { ctrled.controller = gameObject; } StartCoroutine(ctrled.controlFuncDic[type](time, height)); } if (data.curLife <= 0) { DoDefeatEnemyByPhyatk(indexOfEnemy, data.valueExp, data.valueGold); } } } }
protected void Damage(Transform target) { BaseData data = target.GetComponent <BaseData>(); if (data != null) { data.Damaged(atk); // the shooting may launch some adnormal stat on enemy if (data.curLife <= 0) { PlayerData.GetInstance().GainExp(data.valueExp); PlayerData.GetInstance().gold += data.valueGold; } } }
public void OnTriggerEnter(Collider collider) { if (collider.tag.Equals("Enemy")) { BaseData data = collider.GetComponent <BaseData>(); if (data != null) { data.Damaged(PlayerData.GetInstance().GetAttributeValue(fuckRPGLib.GameCode.BasicAttributeName.Intelligence) * 2 + baseAtk); if (data.curLife < 0) { PlayerData.GetInstance().GainExp(data.valueExp); PlayerData.GetInstance().gold += data.valueGold; } } } }
protected void Damage(int indexOfEnemy, float atk, GameObject hitEffect) { if (indexOfEnemy > targets.Count) { return; } LookAtTarget(targets[indexOfEnemy].transform); BaseData data = targets[indexOfEnemy].GetComponent <BaseData>(); if (data != null) { // add a "get hit" effect to this enemy DoHitEffect(indexOfEnemy, hitEffect); data.Damaged(atk, PlayerData.GetInstance().armPieRate); m_hasAtked = true; if (data.curLife <= 0) { DoDefeatEnemyByPhyatk(indexOfEnemy, data.valueExp, data.valueGold); } } }
public IEnumerator Firing(float time, float d) { if (isAntiCtrl) { time = 0; } for (float i = 0; i < time; i += Time.deltaTime) { if (m_data.curLife > 0) { m_data.Damaged(d + Time.deltaTime * PlayerData.GetInstance().GetAttributeValue(GameCode.BasicAttributeName.Intelligence) * 5); if (m_data.curLife <= 0) { PlayerData.GetInstance().GainExp(m_data.valueExp); PlayerData.GetInstance().gold += m_data.valueGold; } } yield return(0); } }
static public void OnLaunch() { for (int i = 0; i < m_skillMng.cds.Length; i++) { m_skillMng.cds[i] -= m_cdDecrease; } for (int i = 0; i < m_action.targets.Count; i++) { GameObject thunder = PoolManager.GetInstance().GetPool(m_action.thunderPrefab).GetObject(m_action.targets[i].transform.position); thunder.transform.SetParent(m_action.targets[i].transform); BaseData data = m_action.targets[i].GetComponent <BaseData>(); if (data != null) { data.Damaged(m_baseAtk + PlayerData.GetInstance().GetAttributeValue(fuckRPGLib.GameCode.BasicAttributeName.Intelligence) * 2); if (data.curLife < 0) { PlayerData.GetInstance().GainExp(data.valueExp); PlayerData.GetInstance().gold += data.valueGold; } } } }