public void CreateTrackingProjectile(BaseEntity source, BaseAbility ability, ProjectileItemParams param) { var projectile = new ProjectileItem(source, ability, param); projectile.ProjectileType = ProjectileType.Tracking; projectiles.Add(projectile); }
protected override bool ExeOnTarget(BaseEntity tar) { var info = new ProjectileItemParams(); info.distance = fixedDistance; info.startRadius = startRadius; info.endRadius = endRadius; info.effectName = effectName; ProjectileManager.Instance.CreateLinearProjectile(owner, null, info); return(true); }
public ProjectileItem(BaseEntity source, BaseAbility ability, ProjectileItemParams infoParams, EntityTarget target) { this.source = source; this.ability = ability; this.infoParams = infoParams; this.target = target; this.projectileID = ProjectileManager.Instance.GernerateProjectileID(); this.velocity = infoParams.velocity; this.position = infoParams.spawnOrigin; this.expireTime = infoParams.expireTime; this.particleItem = new ParticleItem(this.infoParams.effectName, this.source); var obj = new GameObject("projectile"+projectileID); obj.AddComponent<BoxCollider>(); shellObj = obj.transform; CObjectsPool.Instance.Instantiate("", infoParams.effectName, (_obj,uid)=>{ var tmp = _obj as Transform; if(tmp != null) tmp.parent = shellObj; } ,ObjectType.Effect); }
public ProjectileItem(BaseEntity source, BaseAbility ability, ProjectileItemParams infoParams) { this.source = source; this.ability = ability; this.infoParams = infoParams; this.projectileID = ProjectileManager.Instance.GernerateProjectileID(); this.velocity = infoParams.velocity; this.position = infoParams.spawnOrigin; this.expireTime = infoParams.expireTime; this.particleItem = new ParticleItem(this.infoParams.effectName, this.source); //碰撞的部分还需要特别写,为了服务器验证计算。 var obj = new GameObject("projectile"+projectileID); collider = obj.AddComponent<CapsuleCollider>(); collider.radius = this.infoParams.startRadius; shellObj = obj.transform; CObjectsPool.Instance.Instantiate("", infoParams.effectName, (_obj,uid)=>{ var tmp = _obj as Transform; if(tmp != null) tmp.parent = shellObj; } ,ObjectType.Effect); }