public void Create(Transform parent) { ProjectileData data = ProjectileData.GetProjectileData(m_ID); if (data == null || m_Caster == null) { return; } GameObject go = Resources.Load(data._path) as GameObject; if (go != null) { GameObject obj = Instantiate(go) as GameObject; obj.transform.parent = parent; obj.transform.position = GetPosition(); obj.transform.rotation = GetRotation(); SkProjectile projectile = obj.GetComponent <SkProjectile>(); if (projectile != null) { projectile.SetData(data, m_Caster, m_Emitter, GetTargetTrans(), GetTargetPosition(), m_Index); } EffectLateupdateHelper helper = obj.GetComponent <EffectLateupdateHelper>(); if (null != helper) { helper.Init(m_Emitter); } } }
public void Register(int id, Transform caster, Transform target, int index = 0, bool immediately = false) { ProjectileData projectileData = ProjectileData.GetProjectileData(id); if (projectileData == null || caster == null) { return; } Transform emitter = null; if (!string.IsNullOrEmpty(projectileData._bone) && "0" != projectileData._bone) { PeEntity entity = caster.GetComponent <PeEntity>(); if (null != entity) { emitter = entity.GetChild(projectileData._bone); } else { emitter = PETools.PEUtil.GetChild(caster, projectileData._bone); } } ProjectileRequest req = new ProjectileRequest(id, caster, emitter, Vector3.zero, Quaternion.identity, target, Vector3.zero, index); if (immediately) { req.Create(transform); } else { m_ReqList.Add(req); } }
public void Register(int id, Transform caster, SkRuntimeInfo info, int index = 0, bool immediately = false) { ProjectileData projectileData = ProjectileData.GetProjectileData(id); if (projectileData == null) { return; } Transform emitter = null; if (!string.IsNullOrEmpty(projectileData._bone) && "0" != projectileData._bone) { PeEntity entity = caster.GetComponent <PeEntity>(); if (null != entity) { emitter = entity.GetChild(projectileData._bone); } else { emitter = PETools.PEUtil.GetChild(caster, projectileData._bone); } } Transform trans = null; if (info.Target != null) { PeTrans tr = info.Target.GetComponent <PeTrans>(); if (tr != null) { trans = tr.trans; } } ShootTargetPara shoot = info.Para as ShootTargetPara; SkCarrierCanonPara canon = info.Para as SkCarrierCanonPara; if (shoot != null) { if (emitter != null) { Register(id, caster, emitter, shoot.m_TargetPos, index, immediately); } } else if (canon != null) { WhiteCat.BehaviourController drive = info.Caster.GetComponent <WhiteCat.BehaviourController>(); IProjectileData data = drive.GetProjectileData(canon); if (trans != null) { Register(id, caster, data.emissionTransform, trans, index, immediately); } else { Register(id, caster, data.emissionTransform, data.targetPosition, index, immediately); } } else { if (emitter != null) { if (emitter != null) { Register(id, caster, emitter, trans, index, immediately); } } } }