Beispiel #1
0
    public void Stop()
    {
        if (flyEffect_ != null)
        {
            if (property.bulletType == 0)
            {
                XBoxSystem.GetSingleton().UnRegisterBullet(this);
            }

            flyEffect_.gameObject.SetActive(false);
        }

        if (hitEffect_ != null)
        {
            hitEffect_.gameObject.SetActive(true);
            hitEffect_.Initialize(gameObject, transform.position, transform.rotation, hitEffectPrefab, 0);
            hitEffect_.transform.SetParent(transform);
        }
        else
        {
            XEffectManager.Instance.AddDestroyBullet(this);
        }
        _hasDelayFlying = false;
        _isStop         = true;
    }
Beispiel #2
0
    void OnDestroy()
    {
        if (property.bulletType == 0)
        {
            XBoxSystem.GetSingleton().UnRegisterBullet(this);
        }

#if UNITY_EDITOR || UNITY_STANDALONE
        DestroyHitBoxShowStuff();
#endif
    }
Beispiel #3
0
 public void UnRegisterFromBoxes()
 {
     XBoxSystem.GetSingleton().UnRegisterFlexibleHurtBox(this);
 }
Beispiel #4
0
    void Init()
    {
        transform.SetParent(null);

        destPos_.z = 0;

        Vector3 deltaPos = destPos_ - transform.position;

        _flip = deltaPos.x < 0 ? -1 : 1;
        float time = property.time;

        velocity_.x = Mathf.RoundToInt(deltaPos.x / time * XBoxComponent.FLOAT_CORRECTION) / XBoxComponent.FLOAT_CORRECTION;

        if (!_isPvp)
        {
            velocity_.x *= property.pveSpeedScale;
        }

        velocity_.z       = Mathf.RoundToInt(deltaPos.z / time * XBoxComponent.FLOAT_CORRECTION) / XBoxComponent.FLOAT_CORRECTION;
        property.gravity *= 0.01f;

        velocity_.y    = Mathf.RoundToInt((deltaPos.y / time + 0.5f * property.gravity * time) / time * XBoxComponent.FLOAT_CORRECTION) / XBoxComponent.FLOAT_CORRECTION;
        elapseTime_    = .0f;
        elapseinterval = .0f;
        inTraceMode_   = false;

        isGoingNormal = false;
        isReturn      = false;
        isAbsorb      = false;
        //isBeginFire = true;
        isLift       = true;
        fireVec      = Vector3.zero;
        originHeight = 0f;

        checkEnable = true;
        isHit       = false;
        minHeight   = property.minHeight;

        if (hitTargets != null && hitTargets.Length > 0)
        {
            //Transform trans = hitTargets[0];
        }

        if (fireEffect_ != null)
        {
            fireEffect_.Initialize(gameObject, transform.position, transform.rotation, fireEffectPrefab, 0);
            fireEffect_.gameObject.SetActive(true);
            fireEffect_.transform.SetParent(transform);
        }

        if (flyEffect_ != null)
        {
            flyEffect_.Initialize(gameObject, flyEffectPrefab, XEffectComponent.LOOP_TIME);
            flyEffect_.gameObject.SetActive(true);

            if (property.bulletType == 0)
            {
                XBoxSystem.GetSingleton().RegisterBullet(this);
            }
        }

        if (hitEffect_ != null)
        {
            hitEffect_.gameObject.SetActive(false);
        }

        _isStop = false;

        fireVector3     = property.fireVector3;
        fireVector3Temp = property.fireVector3;
    }
Beispiel #5
0
 public void RegisterInBoxes()
 {
     XBoxSystem.GetSingleton().RegisterFlexibleHurtBox(this);
 }