//My note: if the skill can be s-ed, you use PreCastCo() and override OnFail and OnSuccess protected override void CommonOnCastSuccessfully() { base.CommonOnCastSuccessfully(); GameObject bullet = ShowSkillBullet(mc.transform.position + mc.transform.forward * 0.75f, Quaternion.LookRotation(mc.transform.forward)) as GameObject; //Procudurally do these |OR| manually set up the bullet effect prefab if (bullet.GetComponent <SkillBullet>() == null) { SkillBullet sb = bullet.AddComponent <SkillBullet>(); sb.InitBullet(this); } else { bullet.GetComponent <SkillBullet>().InitBullet(this); } if (bullet.GetComponent <SphereCollider>() == null) { SphereCollider sc = bullet.AddComponent <SphereCollider>(); sc.isTrigger = true; sc.radius = 0.3f; sc.gameObject.layer = LayerMask.NameToLayer("SkillBullet"); } if (bullet.GetComponent <Rigidbody>() == null) { Rigidbody rb = bullet.AddComponent <Rigidbody>(); rb.isKinematic = true; rb.useGravity = false; } }
protected override void CommonOnCastSuccessfully() { base.CommonOnCastSuccessfully(); GameObject bullet = ShowSkillBullet(mc.transform.position + mc.transform.forward * 0.75f, Quaternion.LookRotation(mc.transform.forward)) as GameObject; //Procudurally do these |OR| manually set up the bullet effect prefab sb = bullet.GetComponent <SkillBullet>(); sb.InitBullet(this, ToxicArrow); }
void Fire() { fireTimer = 0f; ads.PlayOneShot(shootClip); for (int i = 0; i < dirs.Count; i++) { SkillBullet chilly = bulletPool.GetPooledObj().GetComponent <SkillBullet>(); if (!chilly) { Debug.LogWarning("Add bullet behaviour to PepperCrossbow - Carolina Reaper - Reaper bar's chilly bullet!"); return; } chilly.transform.position = this.transform.position + dirs[i] * 1.7f; chilly.transform.forward = dirs[i]; //TODO multiple hit effect problem chilly.InitBullet(belongedSkill); } }