Ejemplo n.º 1
0
    private IEnumerable <ExecutionMessage> PlayerLocation(List <SExpression> args, Environment e)
    {
        var pv   = Player.self.transform.position;
        var head = new SInt((int)Math.Round(pv.x, 0));
        var tail = new SInt((int)Math.Round(pv.y, 0));

        yield return(new ExecutionMessage(ExecStatus.DONE, new SPair(head, tail)));
    }
Ejemplo n.º 2
0
    protected override void Read()
    {
        Type t = this.GetType();

        FieldInfo[] infos = t.GetFields();
        SBase       tmp   = null;

        for (int i = 0; i < infos.Length; i++)
        {
            FieldInfo fi = infos[i];

            if (fi.FieldType == typeof(SInt))
            {
                tmp = new SInt();
                SDefAttribute ca = GetAttr(fi);
                if (ca != null)
                {
                    (tmp as SInt).Def = ca.intv;
                }
            }
            else if (fi.FieldType == typeof(SFloat))
            {
                tmp = new SFloat();
                SDefAttribute ca = GetAttr(fi);
                if (ca != null)
                {
                    (tmp as SFloat).Def = ca.floatv;
                }
            }
            else if (fi.FieldType == typeof(SString))
            {
                tmp = new SString();
                SDefAttribute ca = GetAttr(fi);
                if (ca != null)
                {
                    (tmp as SString).Def = ca.stringv;
                }
            }
            else if (IsBaseType(fi.FieldType, typeof(SBase)))
            {
                tmp = Activator.CreateInstance(fi.FieldType) as SBase;
            }
            else
            {
                Debug.LogError(string.Format("{0} no suppot!", fi.Name));
                continue;
            }
            tmp.Init(sb, string.Format(ConnctFormat, key, fi.Name));
            fi.SetValue(this, tmp);
        }
    }
Ejemplo n.º 3
0
 // 値型に対しては1個1個完全展開。
 // object 版に値型を渡してしまうと box 化(そこそこのコスト)を起こすので、JITがそれぞれの型専用のコードに展開してしまう。
 public static SInt MaxSInt(SInt x, SInt y) => x.Value > y.Value ? x : y;
Ejemplo n.º 4
0
 public void SwitchState(SInt gameObjectStateID)
 {
     SwitchState(gameObjectStateID.Value);
 }