public static NGUI_SplashText CreateText(Vector3 pos, float dmg)
    {
        NGUI_SplashText instance = Instantiate(GeneralController.instance.splashTextPrefab).GetComponent <NGUI_SplashText>();

        //pos +=  Vector3.up;
        instance.SetPos(pos);
        instance.SetText(dmg);


        return(instance);
    }
예제 #2
0
    private void OnTriggerEnter(Collider other)
    {
        //AI, projectiles, editor
        if (other.gameObject.layer == 13 || other.gameObject.layer == 14 || other.gameObject.layer == 8)
        {
            Debug.Log("Passed vision");
            return;
        }

        Debug.LogFormat("Bullt hit {0}, tag = {1}.", other.gameObject.name, other.gameObject.tag);

        if (other.tag == "Unit")
        {
            AttrController attr = other.GetComponent <AttrController>();
            if (!attr.isAlive)
            {
                return;
            }

            MotionController mc = other.GetComponent <MotionController>();
            if (mc)
            {
                if (source && mc.teamIndex == source.teamIndex)
                {
                    return;
                }

                AIController ai = other.GetComponentInChildren <AIController>();
                if (ai)
                {
                    ai.targetList.Add(source);
                }
            }


            attr.TakeDamage(damage);

            NGUI_SplashText.CreateText(transform.position, damage);
        }



        Destroy(gameObject);
    }
예제 #3
0
    private void OnTriggerStay(Collider other)
    {
        if (other.tag == "Unit")
        {
            AttrController attr = other.GetComponent <AttrController>();
            if (!attr.isAlive)
            {
                return;
            }

            attr.TakeDamage(main.DPS * Time.deltaTime);

            AIController ai = other.GetComponentInChildren <AIController>();
            if (ai)
            {
                ai.targetList.Add(source);
            }

            if (0 == textCD)
            {
                NGUI_SplashText.CreateText(other.transform.position + 0.5f * Vector3.up, main.DPS * (Time.deltaTime * textCycle));
            }
        }
    }