//パラメータセット public virtual void SetParameter(GameObject owner, float velocity, float damage, float barrelBonus, float caliberBonus, Color color) { //持ち主設定 this.owner = owner; //パラメータ設定 this.velocity = velocity; this.damage = damage; this.barrelBonus = barrelBonus; this.caliberBonus = caliberBonus; //色設定 sprite.color = color; //軌跡エフェクト生成 if (trailEffectPrefab) { GameObject trail = (GameObject)Instantiate(trailEffectPrefab); trail.transform.parent = transform; trail.transform.localPosition = Vector3.zero; trailEffect = trail.GetComponent <ParticleSystem>(); if (trailEffect) { trailEffect.startColor = FuncBox.SetColorAlpha(color, 0.75f); } trail.AddComponent <ParticleEndWithDestroy>(); } //ボーナス効果設定 SetBonusEffect(); }
/// <summary> /// フェードアウト用コルーチン /// </summary> protected IEnumerator FadeOutCoroutine(float fadeTime) { if (label) { flagFade = true; float measureTime = fadeTime; while (true) { yield return(0); measureTime -= Time.deltaTime; float alpha = measureTime / fadeTime; //透明度設定 label.color = FuncBox.SetColorAlpha(label.color, alpha); if (measureTime < 0) { break; } //物理風挙動 if (flagPhysics) { Vector3 translate = new Vector3(xMove, yForce, 0f); transform.position += translate * Time.deltaTime; yForce -= gravity * Time.deltaTime; } } label.color = FuncBox.SetColorAlpha(label.color, 0f); flagFade = false; //無効にする gameObject.SetActive(false); } }
protected void Update() { if (measureTime > 0) { measureTime -= Time.deltaTime; //徐々に透明に sprite.color = FuncBox.SetColorAlpha(sprite.color, measureTime / time); if (measureTime <= 0) { Destroy(gameObject); return; } } }
public BoosterInfo(GameObject boost, GameObject highBoost, GameObject quickBoost, Color color) { //色は半透明に color = FuncBox.SetColorAlpha(color, 0.75f); if (boost) { this.boost = boost.GetComponent <ParticleSystem>(); this.boost.startColor = color; } if (highBoost) { this.highBoost = highBoost.GetComponent <ParticleSystem>(); this.highBoost.startColor = color; } if (quickBoost) { this.quickBoost = quickBoost.GetComponent <ParticleSystem>(); this.quickBoost.startColor = color; } }