void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment, float aFallDistance) { //重さが2で if (aWeight == WeightManager.Weight.heavy) { //水中か、地上に着地したら if (aEnviroment == LandImpact.CEnviroment.cWater || aEnviroment == LandImpact.CEnviroment.cGround) { //既にコルーチンが走っているなら、止める if (mShakeCoroutine != null) { StopCoroutine(mShakeCoroutine); } //落下した高さが一定以下なら if (mShakeDisHeight >= aFallDistance) { mShakeCoroutine = StartCoroutine(Shake(mShakeTime, mShakeMagnitude / 2.0f, 0.25f)); //カメラを揺らす(弱い) } else { mShakeCoroutine = StartCoroutine(Shake(mShakeTime, mShakeMagnitude * 3.0f, 0.25f)); //カメラを揺らす(強い) } //プレイヤーなら、移動不可にする SetPlayerCanMove(false); StopPlayerMove(); //慣性をなくす } } }
void Init() { mWeightManager = GetComponent <WeightManager>(); mBeforeWeight = mWeightManager.WeightLvSeem; //見かけの重さでエフェクトを出す if (OnWeightChange != null) { OnWeightChange(mBeforeWeight); } }
// Update is called once per frame void Update() { //見かけの重さが変更されていたら、イベントを呼び出す WeightManager.Weight lWeight = mWeightManager.WeightLvSeem; if (mBeforeWeight != lWeight) { OnWeightChange(lWeight); mBeforeWeight = lWeight; } }
void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment) { //重さが2で if (aWeight == WeightManager.Weight.heavy) { //水中か、地上に着地したら if (aEnviroment == LandImpact.CEnviroment.cWater || aEnviroment == LandImpact.CEnviroment.cGround) { ShakeCamera.ShakeAll(mShakeTime); //カメラを揺らす } } }
//光る色を返す Color GetColor(WeightManager.Weight aWeight) { switch (aWeight) { case WeightManager.Weight.flying: return(mFlyingColor * mFlyingColorPower); case WeightManager.Weight.light: return(mLightColor * mLightColorPower); case WeightManager.Weight.heavy: return(mHeavyColor * mHeavyColorPower); } Debug.Log("重さが不正です"); return(Color.black); }
void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment, float aFallDistance) { //水面に落ちたなら if (aEnviroment == LandImpact.CEnviroment.cWaterSurface) { //重さが2なら if (aWeight == WeightManager.Weight.heavy) { SoundManager.SPlay(mLandImpactWaterHeavySE); //音を鳴らす } else if (aWeight == WeightManager.Weight.light) { SoundManager.SPlay(mLandImpactWaterLightSE); } } //地上で落ちたなら else if (aEnviroment == LandImpact.CEnviroment.cGround) { if (aWeight == WeightManager.Weight.heavy) { SoundManager.SPlay(mLandImpactHeavySE); } else if (aWeight == WeightManager.Weight.light) { SoundManager.SPlay(mLandImpactLightSE); } } //水中で落ちたなら else if (aEnviroment == LandImpact.CEnviroment.cWater) { if (aWeight == WeightManager.Weight.heavy) { SoundManager.SPlay(mLandImpactHeavySE); } else { SoundManager.SPlay(mLandImpactLightSE); } } }
void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment) { //水面に落下したなら if (aEnviroment == LandImpact.CEnviroment.cWaterSurface) { if (aWeight == WeightManager.Weight.heavy) { var g = Instantiate(mLandImpactWaterHeavyPrefab, transform); g.transform.localPosition = mWaterEffectOffset; g.transform.parent = null; //オブジェクトに追従しない } if (aWeight == WeightManager.Weight.light) { var g = Instantiate(mLandImpactWaterLightPrefab, transform); g.transform.localPosition = mWaterEffectOffset; g.transform.parent = null; //オブジェクトに追従しない } } //地上に落下したなら else if (aEnviroment == LandImpact.CEnviroment.cGround) { if (aWeight == WeightManager.Weight.heavy) { var g = Instantiate(mLandImpactGroundHeavyPrefab, transform); g.transform.localPosition = mDownEffectOffset; } if (aWeight == WeightManager.Weight.light) { var g = Instantiate(mLandImpactGroundLightPrefab, transform); g.transform.localPosition = mDownEffectOffset; } if (aWeight == WeightManager.Weight.flying) { var g = Instantiate(mLandImpactGroundFlyingPrefab, transform); g.transform.localPosition = mUpEffectOffset; } } }
void ChangeParticle(WeightManager.Weight aWeight) { if (aWeight == WeightManager.Weight.flying) { PlayParticle(mFlyingParticle); StopParticle(mHeavyParticle); StopParticle(mLightParticle); } if (aWeight == WeightManager.Weight.light) { PlayParticle(mLightParticle); StopParticle(mHeavyParticle); StopParticle(mFlyingParticle); } if (aWeight == WeightManager.Weight.heavy) { PlayParticle(mHeavyParticle); StopParticle(mLightParticle); StopParticle(mFlyingParticle); } }
void OnLand(WeightManager.Weight aWeight, LandImpact.CEnviroment aEnviroment, float aFallDistance) { //水面に落下したなら if (aEnviroment == LandImpact.CEnviroment.cWaterSurface) { if (aWeight == WeightManager.Weight.heavy) { var g = Instantiate(mLandImpactWaterHeavyPrefab); //オブジェクトに追従しない g.transform.position = WaterEffectPosition(); } if (aWeight == WeightManager.Weight.light) { var g = Instantiate(mLandImpactWaterLightPrefab); g.transform.position = WaterEffectPosition(); } } //地上に落下したなら else if (aEnviroment == LandImpact.CEnviroment.cGround) { if (aWeight == WeightManager.Weight.heavy) { var g = Instantiate(mLandImpactGroundHeavyPrefab); g.transform.position = DownEffectPosition(); } if (aWeight == WeightManager.Weight.light) { var g = Instantiate(mLandImpactGroundLightPrefab); g.transform.position = DownEffectPosition(); } if (aWeight == WeightManager.Weight.flying) { //var g = Instantiate(mLandImpactGroundFlyingPrefab); //g.transform.position = UpEffectPosition(); } } }
void ChangeLightColor(WeightManager.Weight aWeight) { //Utility.ChangeMaterialColor(mLightModel, mLightMaterial, "_EmissionColor", GetColor(aWeight)); Utility.ChangeMaterialColor(mLightModel, mLightMaterial, "_Color", GetColor(aWeight)); }
// Use this for initialization void Start() { mWeightManager = GetComponent <WeightManager>(); mBeforeWeight = mWeightManager.WeightLvSeem; //見かけの重さでエフェクトを出す OnWeightChange(mBeforeWeight); }