Beispiel #1
0
 public static GameObject GetProjectilePrefab(ProjectilePrefabs name)
 {
     if (name != ProjectilePrefabs.NONE)
     {
         return(ProjectilePrefabCache[name]);
     }
     else
     {
         return(null);
     }
 }
Beispiel #2
0
 protected override void Start()
 {
     base.Start();
     ProjectilePrefabs.Add("Q", ProjectilePrefabs["Q1"]);
 }
Beispiel #3
0
        public override void SerializeEffect <T>(T effect)
        {
            base.SerializeEffect(effect);

            var comp = effect as ShootProjectile;

            AddDirection             = comp.AddDirection;
            AddRotationForce         = comp.AddRotationForce;
            AutoTarget               = comp.AutoTarget;
            AutoTargetMaxAngle       = comp.AutoTargetMaxAngle;
            AutoTargetRange          = comp.AutoTargetRange;
            IgnoreShooterCollision   = comp.IgnoreShooterCollision;
            ProjectileForce          = comp.ProjectileForce;
            TargetCountPerProjectile = comp.TargetCountPerProjectile;
            TargetingMode            = comp.TargetingMode;
            TargetRange              = comp.TargetRange;
            YMagnitudeAffect         = comp.YMagnitudeAffect;
            YMagnitudeForce          = comp.YMagnitudeForce;
            InstantiatedAmount       = comp.IntanstiatedAmount;
            CameraAddYDirection      = comp.CameraAddYDirection;

            var prefabEnum = GetProjectilePrefabEnum(comp.BaseProjectile);

            if (prefabEnum != ProjectilePrefabs.NONE)
            {
                var proj = comp.BaseProjectile;

                BaseProjectile            = prefabEnum;
                DefenseLength             = proj.DefenseLength;
                DefenseRange              = proj.DefenseRange;
                DisableOnHit              = proj.DisableOnHit;
                EffectsOnlyIfHitCharacter = proj.EffectsOnlyIfHitCharacter;
                EndMode             = proj.EndMode;
                ImpactSoundMaterial = proj.ImpactSoundMaterial;
                LateShootTime       = proj.LateShootTime;
                Lifespan            = proj.Lifespan;
                LightIntensityFade  = proj.LightIntensityFade;
                PointOffset         = proj.PointOffset;
                TrailEnabled        = proj.TrailEnabled;
                TrailTime           = proj.TrailTime;
                Unblockable         = proj.Unblockable;

                var list = new List <SL_EffectTransform>();
                foreach (Transform child in proj.transform)
                {
                    var effectsChild = SL_EffectTransform.ParseTransform(child);

                    if (effectsChild.HasContent)
                    {
                        list.Add(effectsChild);
                    }
                }
                ProjectileEffects = list.ToArray();
            }
            else if (comp.BaseProjectile)
            {
                SL.Log("Couldn't parse blast prefab to enum: " + comp.BaseProjectile.name);
            }

            var shots = new List <SL_ProjectileShot>();

            foreach (var shot in comp.ProjectileShots)
            {
                shots.Add(new SL_ProjectileShot()
                {
                    RandomLocalDirectionAdd = shot.RandomLocalDirectionAdd,
                    LocalDirectionOffset    = shot.LocalDirectionOffset,
                    LockDirection           = shot.LockDirection,
                    MustShoot = shot.MustShoot,
                    NoBaseDir = shot.NoBaseDir
                });
            }
            ProjectileShots = shots.ToArray();
        }