Esempio n. 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);
                }
            };
        }
    }
Esempio n. 2
0
    public bool IsPvp()
    {
        XCameraFight fight = XCameraFight.GetSingleton();

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

        return(true);
    }
Esempio n. 3
0
    /// <summary>
    ///
    /// </summary>
    private void Awake()
    {
        _instance = this;

        ApplyConfigure(XCameraHelper.confPvp);

        _camera = GetComponent <Camera>();
        if (!_camera)
        {
            throw new System.NullReferenceException();
        }

        _camera.fieldOfView = _fov;
    }