コード例 #1
0
 public ISitcomResult Dom_Print(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     if (args[0] != null)
     {
         Debug.Log(args[0]);
     }
     if (!string.IsNullOrEmpty(content))
     {
         Debug.Log(content);
     }
     return(new SitcomDelay(args == null || args.Length < 1 ? 1 : SitcomUtil.ParseAsNumber(args[1])));
 }
コード例 #2
0
        public ISitcomResult Dom_Spawn(SitcomContext runtime, SitcomHeap target, string content, object[] args)
        {
            var names = new List <string>();

            if (!StringUtil.ParseArray(content, names, '\n') || names.Count == 0)
            {
                return(new SitcomValue(false));
            }
            var ret = new SitcomAsyncOperator();

            AssetsUtil.GetAssetAsync <GameObject>(args[0].ToString(), (x) =>
            {
                float f;
                if (args[3] != null)
                {
                    f = SitcomUtil.AsNumber(args[3]);
                }
                else
                {
                    f = 0;
                }
                Vector3 pos   = args[1] == null ? Vector3.zero : StringUtil.ParseVector3(args[1].ToString());
                Vector3 euler = args[2] == null ? Vector3.zero : StringUtil.ParseVector3(args[2].ToString());
                for (int i = 0; i < names.Count; i++)
                {
                    var go  = GameObject.Instantiate(x);
                    go.name = names[i];
                    var rad = Random.insideUnitCircle * f;
                    go.transform.position         = pos + new Vector3(rad.x, 0, rad.y);
                    go.transform.localEulerAngles = euler;
                    ret.Result = go;
                }
                ret.State = ESitcomState.Success;
            }, (error) =>
            {
                ret.Result = error;
                ret.State  = ESitcomState.Failed;
            });
            return(ret);
        }
コード例 #3
0
 public ISitcomResult Dom_Delay(SitcomContext runtime, SitcomHeap target, string content, object[] args)
 {
     return(new SitcomDelay((float)SitcomUtil.ParseAsNumber(args[0])));
 }
コード例 #4
0
 public virtual float AsNumber(object target)
 {
     return(SitcomUtil.ParseAsNumber(target));
 }
コード例 #5
0
 public virtual bool AsBool(object target)
 {
     return(SitcomUtil.ParseAsBool(target));
 }