예제 #1
0
        private static LSProjectile NewProjectile(string projCode)
        {
            IProjectileData projData = CodeDataMap[projCode];

            curProj = ((GameObject)GameObject.Instantiate <GameObject> (projData.GetProjectile().gameObject)).GetComponent <LSProjectile> ();
            curProj.Setup(projData);
            return(curProj);
        }
예제 #2
0
 public GunData(string name, bool unlocked, int cooldown, IProjectileData projectileData, bool automatic, int barrelX, int barrelY, int angledBarrelX, int angledBarrelY)
 {
     this.name           = name;
     this.unlocked       = unlocked;
     this.projectileData = projectileData;
     this.cooldown       = cooldown;
     this.automatic      = automatic;
     this.barrelX        = barrelX;
     this.barrelY        = barrelY;
     this.angledBarrelX  = angledBarrelX;
     this.angledBarrelY  = angledBarrelY;
 }
예제 #3
0
 public void Setup(IProjectileData dataItem)
 {
     this.SpawnVersion = 1u;
     this.MyData = dataItem;
     this.MyProjCode = dataItem.Name;
     this.cachedGameObject = base.gameObject;
     this.cachedTransform = base.transform;
     GameObject.DontDestroyOnLoad (this.cachedGameObject);
     if (this.onSetup.IsNotNull ()) {
         this.onSetup.Invoke ();
     }
 }
예제 #4
0
        public Projectile(IProjectileData data, Directions direction, ISprite origin, Vector2 mapCoordinates, double worldX, double worldY, int frameNum, bool mirrorX)
            : base(worldX, worldY, data.GetTexture(), new Vector2((float)worldX - mapCoordinates.X, (float)worldY - mapCoordinates.Y), data.GetNumFrames(), frameNum, mirrorX)
        {
            Random rnd = new Random();

            this.random    = rnd.Next();
            this.data      = data;
            this.origin    = origin;
            this.life      = 0;
            this.damage    = data.GetDamage();
            this.direction = direction;
        }
        public static void Setup()
        {
            IProjectileDataProvider prov;

            if (LSDatabaseManager.TryGetDatabase <IProjectileDataProvider>(out prov))
            {
                IProjectileData[] projectileData = prov.ProjectileData;
                for (int i = 0; i < projectileData.Length; i++)
                {
                    IProjectileData item = projectileData[i];
                    CodeDataMap.Add(item.Name, item);
                    ProjectilePool.Add(item.Name, new FastStack <LSProjectile>());
                }
            }
        }
예제 #6
0
        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);
                    }
                }
            }
        }