private static LSProjectile NewProjectile(ProjectileCode projCode) { ProjectileDataItem projData = CodeDataMap[projCode]; curProj = ((GameObject)GameObject.Instantiate <GameObject> (projData.Prefab)).GetComponent <LSProjectile> (); curProj.Setup(projData); return(curProj); }
public static LSProjectile Create(ProjectileCode projCode, LSAgent source, LSAgent target, long damage) { if (Enum.IsDefined(typeof (ProjectileCode), projCode) == false) { throw new System.MissingMemberException("The specified ProjectileCode does not exist"); } FastStack<LSProjectile> pool = ProjectilePool[projCode]; if (pool.Count > 0) { curProj = pool.Pop (); } else { curProj = NewProjectile (projCode); } int id = GenerateID (); ProjectileBucket[id] = curProj; ProjectileActive[id] = true; curProj.Initialize (id, source,target); curProj.Damage = damage; return curProj; }
public static LSProjectile Create(ProjectileCode projCode, LSAgent source, LSAgent target, long damage) { if (Enum.IsDefined(typeof(ProjectileCode), projCode) == false) { throw new System.MissingMemberException("The specified ProjectileCode does not exist"); } FastStack <LSProjectile> pool = ProjectilePool[projCode]; if (pool.Count > 0) { curProj = pool.Pop(); } else { curProj = NewProjectile(projCode); } int id = GenerateID(); ProjectileBucket[id] = curProj; ProjectileActive[id] = true; curProj.Initialize(id, source, target); curProj.Damage = damage; return(curProj); }
private static LSProjectile NewProjectile(ProjectileCode projCode) { ProjectileDataItem projData = CodeDataMap[projCode]; curProj = ((GameObject)GameObject.Instantiate<GameObject> (projData.Prefab)).GetComponent<LSProjectile> (); curProj.Setup (projData); return curProj; }