Exemplo n.º 1
0
        public override float Get(Simulation.Actor actor)
        {
            switch (Type)
            {
            case ActorMemberType.x:
                return(actor.X);

            case ActorMemberType.y:
                return(actor.Y);

            case ActorMemberType.vx:
                return(actor.VX);

            case ActorMemberType.vy:
                return(actor.VY);

            case ActorMemberType.rz:
                return(actor.Rotation);

            case ActorMemberType.sx:
                return(actor.ScaleX);

            case ActorMemberType.sy:
                return(actor.ScaleY);

            case ActorMemberType.alpha:
                return(actor.Alpha);
            }
            return(0);
        }
Exemplo n.º 2
0
 private static void RunEffects(this IEnumerable <Pat.Effect> effectList, Simulation.Actor actor)
 {
     foreach (var e in effectList)
     {
         e.Run(actor);
     }
 }
Exemplo n.º 3
0
 public override void Run(Simulation.Actor actor)
 {
     foreach (var effect in Effects)
     {
         effect.Run(actor);
     }
 }
 public override void Run(Simulation.Actor actor)
 {
     PlayerChangeFreeMoveEffect.Instance.Run(actor);
     actor.SetMotion(Simulation.SystemAnimationType.Stand, 0);
     actor.IsInAir = false;
     actor.VX      = 0;
 }
Exemplo n.º 5
0
 public override void Run(Simulation.Actor actor)
 {
     if (Filter.Test(actor))
     {
         Effect.Run(actor);
     }
 }
Exemplo n.º 6
0
        public override void Run(Simulation.Actor actor)
        {
            var owner = actor.Owner;

            if (owner != null && !owner.IsReleased)
            {
                if (CheckInstance != null && CheckInstance.Length != 0)
                {
                    if (!owner.Variables.ContainsKey(CheckInstance) ||
                        owner.Variables[CheckInstance].Value as Simulation.Actor != actor)
                    {
                        actor.Release();
                        return;
                    }
                }

                actor.X = owner.X + owner.VX;
                actor.Y = owner.Y + owner.VY;

                if (!IgnoreRotation)
                {
                    actor.Rotation = owner.Rotation;
                }
            }
            else
            {
                actor.Release();
            }
        }
Exemplo n.º 7
0
        public static void SetupActor(this Sprite sprite, Texture txt, Simulation.Actor actor, EditingPoint editing)
        {
            //TODO do not use Setup (which only supports Scale but not Size)
            var frame = actor.CurrentFrame;

            //handle invalid frame
            if (frame == null)
            {
                sprite.Texture = null;
                return;
            }

            var dirScale = actor.InversedDirection ? -1.0f : 1.0f;

            sprite.Setup(txt,
                         OriginX: frame.OriginX + editing.OffsetX + 0.5f,
                         OriginY: frame.OriginY + editing.OffsetY + 0.5f,
                         ScaleX: frame.ScaleX / 100.0f * actor.ScaleX * dirScale,
                         ScaleY: frame.ScaleY / 100.0f * actor.ScaleY);
            sprite.SetupPosition(actor.X, actor.Y, frame.Rotation / 180.0f * 3.1415926f + actor.Rotation);
            sprite.SetupColor(actor.Alpha * frame.Alpha,
                              actor.Red * frame.Red,
                              actor.Green * frame.Green,
                              actor.Blue * frame.Blue);
        }
Exemplo n.º 8
0
 public override void Run(Simulation.Actor actor)
 {
     actor.Variables[Name] = new Simulation.ActorVariable()
     {
         Type  = Simulation.ActorVariableType.Float,
         Value = Value.Get(actor),
     };
 }
 public override void Run(Simulation.Actor actor)
 {
     PlayerChangeFreeMoveEffect.Instance.Run(actor);
     //TODO use child actions
     actor.SetMotion(Simulation.SystemAnimationType.Fall, 0);
     actor.SitLabel = PlayerBeginStandEffect.Instance.Run;
     actor.IsInAir  = true;
 }
Exemplo n.º 10
0
 public override void Run(Simulation.Actor actor)
 {
     actor.Variables.Add(CheckInstance, new Simulation.ActorVariable
     {
         Type  = Simulation.ActorVariableType.Actor,
         Value = actor,
     });
 }
Exemplo n.º 11
0
        public override void Run(Simulation.Actor actor)
        {
            var s = Speed.Get(actor);
            var r = Rotation.Get(actor);

            actor.Rotation = r;
            actor.VX       = (float)Math.Cos(r) * s;
            actor.VY       = (float)Math.Sin(r) * s;
        }
Exemplo n.º 12
0
        public override float Get(Simulation.Actor actor)
        {
            var val = actor.Variables[Name];

            if (val.Type == Simulation.ActorVariableType.Float)
            {
                return((float)val.Value);
            }
            return(0);
        }
Exemplo n.º 13
0
        public override void Run(Simulation.Actor actor)
        {
            actor.UpdateLabel      = null;
            actor.SitLabel         = null;
            actor.FallLabel        = null;
            actor.EndKeyFrameLabel = new Simulation.ActorLabel[0];
            actor.HitEvent         = null;

            actor.Variables.Clear();
        }
Exemplo n.º 14
0
 public override void Run(Simulation.Actor actor)
 {
     if (actor.Alpha < Value)
     {
         actor.Release();
     }
     else
     {
         actor.Alpha -= Value;
     }
 }
Exemplo n.º 15
0
 public override void Run(Simulation.Actor actor)
 {
     if (IsInAir)
     {
         actor.Y = -150.0f;
     }
     else
     {
         actor.Y = 0.0f;
     }
 }
Exemplo n.º 16
0
        public override float Get(Simulation.Actor actor)
        {
            var level = (int)Math.Ceiling((Max - Min) / Step) + 1;
            var ret   = Min + Step * actor.World.Random.Next(level);

            if (ret > Max)
            {
                ret = Max;
            }
            return(ret);
        }
Exemplo n.º 17
0
 public override void Run(Simulation.Actor actor)
 {
     PlayerChangeFreeMoveEffect.Instance.Run(actor);
     //TODO warikomi
     if (actor.IsInAir)
     {
         PlayerBeginFallEffect.Instance.Run(actor);
     }
     else
     {
         PlayerBeginStandEffect.Instance.Run(actor);
     }
 }
Exemplo n.º 18
0
        public override void Run(Simulation.Actor actor)
        {
            var rs = ReduceSpeed;

            if (Math.Abs(actor.VX) < rs)
            {
                actor.VX = 0;
            }
            else
            {
                actor.VX -= actor.VX > 0 ? rs : -rs;
            }
        }
Exemplo n.º 19
0
        public override void Run(Simulation.Actor actor)
        {
            switch (Label)
            {
            case Simulation.ActorLabelType.Fall:
                actor.FallLabel = Effect.Run;
                break;

            case Simulation.ActorLabelType.Sit:
                actor.SitLabel = Effect.Run;
                break;

            case Simulation.ActorLabelType.Hit:
                actor.HitEvent = Effect.Run;
                break;
            }
        }
Exemplo n.º 20
0
        public override float Get(Simulation.Actor actor)
        {
            switch (Operator)
            {
            case BinaryOperator.Add:
                return(Left.Get(actor) + Right.Get(actor));

            case BinaryOperator.Minus:
                return(Left.Get(actor) - Right.Get(actor));

            case BinaryOperator.Multiply:
                return(Left.Get(actor) * Right.Get(actor));

            case BinaryOperator.Divide:
                return(Left.Get(actor) / Right.Get(actor));
            }
            return(0.0f);
        }
Exemplo n.º 21
0
        public override bool Test(Simulation.Actor actor)
        {
            switch (Operator)
            {
            case CompareOperator.Equal:
                return(Left.Get(actor) == Right.Get(actor));

            case CompareOperator.Greater:
                return(Left.Get(actor) > Right.Get(actor));

            case CompareOperator.GreaterOrEqual:
                return(Left.Get(actor) >= Right.Get(actor));

            case CompareOperator.NotEqual:
                return(Left.Get(actor) != Right.Get(actor));

            default:
                return(false);
            }
        }
Exemplo n.º 22
0
        public override FramePoint GetPointForActor(Simulation.Actor actor)
        {
            if (Index < 0 || Index >= actor.CurrentFrame.Points.Count)
            {
                return(new FramePoint());
            }
            var p = actor.CurrentFrame.Points[Index];

            float scaleX = actor.ScaleX, scaleY = actor.ScaleY;

            //TODO IMPORTANT check if point should be scaled
            scaleX *= actor.CurrentFrame.ScaleX / 100.0f;
            scaleY *= actor.CurrentFrame.ScaleY / 100.0f;

            return(new FramePoint
            {
                X = (int)(actor.X + (AdjustSpeed ? actor.VX : 0) + scaleX * p.X),
                Y = (int)(actor.Y + (AdjustSpeed ? actor.VY : 0) + scaleY * p.Y),
            });
        }
Exemplo n.º 23
0
        public override void Run(Simulation.Actor actor)
        {
            var bullet = new Simulation.BulletActor(actor.World,
                                                    actor.Animations.SetDefault(ActionName), null, actor.Actions);
            var point = Position.GetPointForActor(actor);

            bullet.Owner             = actor;
            bullet.X                 = point.X;
            bullet.Y                 = point.Y;
            bullet.InversedDirection = Direction == CreateBulletDirection.Same ?
                                       actor.InversedDirection : !actor.InversedDirection;

            var action = actor.Actions.GetActionByID(ActionName);

            if (action != null)
            {
                Simulation.ActionSetup.SetupActorForAction(bullet, action, true);
                actor.World.Add(bullet);
            }
        }
Exemplo n.º 24
0
        public override void Run(Simulation.Actor actor)
        {
            var val = Value.Get(actor);

            switch (Type)
            {
            case ActorMemberType.x:
                actor.X = val;
                break;

            case ActorMemberType.y:
                actor.Y = val;
                break;

            case ActorMemberType.vx:
                actor.VX = val;
                break;

            case ActorMemberType.vy:
                actor.VY = val;
                break;

            case ActorMemberType.rz:
                actor.Rotation = val;
                break;

            case ActorMemberType.sx:
                actor.ScaleX = val;
                break;

            case ActorMemberType.sy:
                actor.ScaleY = val;
                break;

            case ActorMemberType.alpha:
                actor.Alpha = val;
                break;
            }
        }
Exemplo n.º 25
0
 public override bool Test(Simulation.Actor actor)
 {
     return((actor.ActionCount % Divisor.GetInt(actor)) == Mod.GetInt(actor));
 }
Exemplo n.º 26
0
 //TODO allow control in editor
 public override bool Test(Simulation.Actor actor)
 {
     return(false);
 }
Exemplo n.º 27
0
 public override bool Test(Simulation.Actor actor)
 {
     return(actor.ActionCount > Count.GetInt(actor));
 }
Exemplo n.º 28
0
 public override bool Test(Simulation.Actor actor)
 {
     return(actor.CurrentSegmentIndex == Segment);
 }
Exemplo n.º 29
0
 public int GetInt(Simulation.Actor actor)
 {
     return((int)Get(actor));
 }
Exemplo n.º 30
0
 public override void Run(Simulation.Actor actor)
 {
 }