예제 #1
0
    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);
                }
            }
        }
    }
예제 #2
0
    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;
            }
        }
    }
예제 #3
0
 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;
             }
         }
     }
 }
예제 #4
0
    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);
            }
        }
    }
예제 #5
0
    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);
        }
    }
예제 #6
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;
             }
         }
     }
 }