Beispiel #1
0
    void Awake()
    {
        XCameraFight fight = Camera.main.gameObject.GetComponent <XCameraFight>();

        if (fight)
        {
            _isPvp = fight.IsPvp();
        }

        if (fireEffectPrefab != null)
        {
            GameObject obj = GameObject.Instantiate(fireEffectPrefab);
            if (obj != null)
            {
                fireEffect_    = obj.GetComponent <XEffectComponent>();
                fire_collider_ = obj.GetComponent <Collider>();
                if (fire_collider_ != null)
                {
                    fire_collider_.isTrigger = true;
                }
            }
        }

        if (flyEffectPrefab != null)
        {
            GameObject obj = GameObject.Instantiate(flyEffectPrefab);
            if (obj != null)
            {
                flyEffect_ = obj.GetComponent <XEffectComponent>();
                collider_  = obj.GetComponent <Collider>();
                if (collider_ != null)
                {
                    collider_.isTrigger = true;
                }
                hitBox_ = obj.GetComponent <XBoxBulletHit>();
            }
        }

        if (hitEffectPrefab != null)
        {
            GameObject obj = GameObject.Instantiate(hitEffectPrefab);
            if (obj != null)
            {
                hitEffect_ = obj.GetComponent <XEffectComponent>();
                obj.transform.SetParent(transform);
            }
        }

        if (hitEffect_ != null)
        {
            hitEffect_.eventCallBack = delegate(XEffectComponent effect, XEffectComponent.EffectEventType eventType) {
                if (eventType == XEffectComponent.EffectEventType.FINISHED)
                {
                    XEffectManager.Instance.DestroyBullet(this);
                }
            };
        }
    }
Beispiel #2
0
    public bool IsPvp()
    {
        XCameraFight fight = XCameraFight.GetSingleton();

        if (fight)
        {
            return(fight.IsPvp());
        }

        return(true);
    }