예제 #1
0
        public override ILineObject Generate(GenerationEnvironment env)
        {
            List <ILineObject> ret = new List <ILineObject>();

            if (CheckInstance != null && CheckInstance.Length != 0)
            {
                ret.Add(new ControlBlock(ControlBlockType.If,
                                         new BiOpExpr(ActorVariableHelper.GenerateGet(CheckInstance), ThisExpr.Instance.MakeIndex("name"), BiOpExpr.Op.NotEqual),
                                         new ILineObject[] {
                    ThisExpr.Instance.MakeIndex("Release").Call().Statement(),
                }).Statement());
            }

            var ownerActor = new IdentifierExpr("ownerActor");
            var x          = Position.GenerateX(ownerActor, env);
            var y          = Position.GenerateY(ownerActor, env);

            var setRotation = ThisExpr.Instance.MakeIndex("rz").Assign(ownerActor.MakeIndex("rz")).Statement();

            ret.AddRange(new ILineObject[] {
                new LocalVarStatement("ownerActor", ActorVariableHelper.GenerateGet("SYS_parent").MakeIndex("wr")),
                new ControlBlock(ControlBlockType.If, "ownerActor != null", new ILineObject[] {
                    ThisExpr.Instance.MakeIndex("x").Assign(x).Statement(),
                    ThisExpr.Instance.MakeIndex("y").Assign(y).Statement(),
                    IgnoreRotation ? new SimpleLineObject("") : setRotation,
                }).Statement(),
                new ControlBlock(ControlBlockType.Else, new ILineObject[] {
                    ThisExpr.Instance.MakeIndex("Release").Call().Statement(),
                }).Statement(),
            });

            return(new SimpleBlock(ret).Statement());
        }
예제 #2
0
        public override ILineObject Generate(GenerationEnvironment env)
        {
            List <ILineObject> ret = new List <ILineObject>();

            if (CheckInstance != null && CheckInstance.Length != 0)
            {
                //TODO fix this: set variable in owner, not this
                ret.Add(ActorVariableHelper.GenerateSet(CheckInstance, ThisExpr.Instance.MakeIndex("name")));
            }

            //get parent actor from table t
            ret.Add(ActorVariableHelper.GenerateSet("SYS_parent", new IdentifierExpr("t").MakeIndex("flag1")));
            return(new SimpleBlock(ret).Statement());
        }
예제 #3
0
 public override ILineObject Generate(GenerationEnvironment env)
 {
     return(ActorVariableHelper.GenerateSet(Name, Value.Generate(env)));
 }
예제 #4
0
 public override Expression Generate(GenerationEnvironment env)
 {
     return(ActorVariableHelper.GenerateGet(Name));
 }