public virtual void CopyFrom(DMKBulletShooterController controller)
        {
            this.interval         = controller.interval;
            this.emissionCooldown = controller.emissionCooldown;
            this.emissionLength   = controller.emissionLength;
            this.positionOffset   = controller.positionOffset;
            this.bulletContainer  = controller.bulletContainer;
            this.gameObject       = controller.gameObject;
            this.tag                   = controller.tag;
            this.startFrame            = controller.startFrame;
            this.overallLength         = controller.overallLength;
            this.simulationCount       = controller.simulationCount;
            this.followParentDirection = controller.followParentDirection;
            this.groupId               = controller.groupId;

            if (controller.shooter != null)
            {
                this.shooter = (DMKBulletShooter)ScriptableObject.CreateInstance(controller.shooter.GetType());
                this.shooter.parentController = this;
                this.shooter.CopyFrom(controller.shooter);
            }
            else
            {
                this.shooter = null;
            }

            this.bulletInfo.CopyFrom(controller.bulletInfo);
        }
Exemple #2
0
        public static DMKCurveProperty Copy(DMKCurveProperty p)
        {
            DMKCurveProperty n = new DMKCurveProperty();

            n.value  = p.value;
            n.type   = p.type;
            n.curve  = DMKUtil.CopyCurve(p.curve);
            n.valEnd = p.valEnd;
            n.Update(0, true);
            return(n);
        }
Exemple #3
0
        public static DMKCurveProperty Copy(DMKCurveProperty p, float x)
        {
            DMKCurveProperty n = new DMKCurveProperty();

            n.value  = p.value * x;
            n.valEnd = p.valEnd * x;
            n.type   = p.type;
            n.curve  = DMKUtil.CopyCurve(p.curve, v => {
                return(v * x);
            });
            n.currentVal = p.currentVal * x;
            return(n);
        }
Exemple #4
0
 public override void CopyFrom(DMKBulletShooter shooter)
 {
     if (shooter.GetType() == typeof(DMKNWayShooter))
     {
         DMKNWayShooter cs = shooter as DMKNWayShooter;
         this.accel1       = cs.accel1;
         this.accel2       = cs.accel2;
         this.angleRange   = DMKCurveProperty.Copy(cs.angleRange);
         this.bulletCount  = cs.bulletCount;
         this.radius       = DMKCurveProperty.Copy(cs.radius);
         this.startAngle   = DMKCurveProperty.Copy(cs.startAngle);
         this.targetObject = cs.targetObject;
         this.trackTarget  = cs.trackTarget;
     }
     base.CopyFrom(shooter);
 }
Exemple #5
0
        public void CopyFrom(DMKBulletInfo prototype, float speedMultiplier = 1f)
        {
            this.bulletSprite = prototype.bulletSprite;
            this.damage       = prototype.damage;
            this.speed        = DMKCurveProperty.Copy(prototype.speed, speedMultiplier);
            this.accel        = DMKCurveProperty.Copy(prototype.accel);
            this.angularAccel = DMKCurveProperty.Copy(prototype.angularAccel);
            this.bulletColor  = prototype.bulletColor;
            this.died         = false;

            this.useScaleCurve = prototype.useScaleCurve;
            this.scaleCurveX   = DMKUtil.CopyCurve(prototype.scaleCurveX);
            this.scaleCurveY   = DMKUtil.CopyCurve(prototype.scaleCurveY);

            this.collisionRect = prototype.collisionRect;
            this.maxLifetime   = prototype.maxLifetime;
            this.lifeFrame     = 0;
        }
Exemple #6
0
        public static void MakeCurveControl(ref DMKCurveProperty curve, string label)
        {
            EditorGUILayout.BeginHorizontal();
            switch (curve.type)
            {
            case DMKCurvePropertyType.Constant:
                curve.value = EditorGUILayout.FloatField(label, curve.value);
                break;

            case DMKCurvePropertyType.Curve:
                curve.curve = EditorGUILayout.CurveField(label, curve.curve);
                break;

            case DMKCurvePropertyType.RandomVal:
                EditorGUILayout.BeginVertical();
                curve.value  = EditorGUILayout.FloatField(label, curve.value);
                curve.valEnd = EditorGUILayout.FloatField(" ", curve.valEnd);
                EditorGUILayout.EndVertical();
                break;
            }
            curve.type = (DMKCurvePropertyType)EditorGUILayout.EnumPopup(curve.type, GUILayout.Width(64));
            EditorGUILayout.EndHorizontal();
        }