public static EffectGunFIreSub CreateObject(Vector3 current, Vector3 target, CharacterDirection dir) { //var obj = GameObject.Instantiate(ResourceInformation.Effect.transform.FindChild("GunFire").gameObject); //obj.transform.SetParent(ResourceInformation.Effect.transform, false); //EffectGunFIreSub d = obj.AddComponent<EffectGunFIreSub>(); //obj.transform.localEulerAngles = CommonFunction.EulerAngles[dir]; EffectGunFIreSub d = GetGameObject <EffectGunFIreSub>(false, "GunFireSub", ResourceInformation.Effect.transform); d.Parent.transform.localEulerAngles = CommonFunction.EulerAngles[dir]; d.Direction = dir; //目標位置の取得 d.TargetPoint = target; //現在位置の取得 d.Parent.transform.localPosition = current; //発射位置を多少ずらすS float loc = (float)UnityEngine.Random.Range(-30, 30) / 100; d.Parent.transform.localPosition += new Vector3(loc, 0, 0); return(d); }
private void Update() { if (time > wait) { //終了 EffectDamage d = EffectDamage.CreateObject(Target); Target = null; d.SetText(Damage, atst); d.Play(); End(); } else if (time % interval == 0) { EffectGunFIreSub.CreateObject(current, TargetPoint, this.Direction).Play(); } time++; }