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; }
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; }