Example #1
0
        public void SetPrimitiveParams(AnArray.MarkEnumerator enumerator)
        {
            PrimitiveParamsType paramtype = ParamsHelper.GetPrimParamType(enumerator);

            switch (paramtype)
            {
            case PrimitiveParamsType.Name:
                Name = ParamsHelper.GetString(enumerator, "PRIM_NAME");
                break;

            case PrimitiveParamsType.Desc:
                Description = ParamsHelper.GetString(enumerator, "PRIM_DESC");
                break;

            case PrimitiveParamsType.Position:
                Position = ParamsHelper.GetVector(enumerator, "PRIM_POSITION");
                break;

            case PrimitiveParamsType.PosLocal:
                LocalPosition = ParamsHelper.GetVector(enumerator, "PRIM_POS_LOCAL");
                break;

            case PrimitiveParamsType.Rotation:
                GlobalRotation = ParamsHelper.GetRotation(enumerator, "PRIM_ROTATION").Normalize();
                break;

            case PrimitiveParamsType.RotLocal:
                LocalRotation = ParamsHelper.GetRotation(enumerator, "PRIM_ROT_LOCAL").Normalize();
                break;

            default:
                if (Enum.IsDefined(typeof(PrimitiveParamsType), (int)paramtype))
                {
                    throw new LocalizedScriptErrorException(this, "PRIM0NotAllowedForAgents", "{0} not allowed for agents", paramtype.GetLslName());
                }
                else
                {
                    throw new LocalizedScriptErrorException(this, "PRIMInvalidParameterType0", "Invalid primitive parameter type {0}", paramtype.GetLslName());
                }
            }
        }
Example #2
0
        public void GetPrimitiveParams(IEnumerator <IValue> enumerator, AnArray paramList)
        {
            PrimitiveParamsType paramtype = ParamsHelper.GetPrimParamType(enumerator);

            switch (paramtype)
            {
            case PrimitiveParamsType.Name:
                paramList.Add(Name);
                break;

            case PrimitiveParamsType.Desc:
                paramList.Add(Description);
                break;

            case PrimitiveParamsType.Position:
                paramList.Add(Position);
                break;

            case PrimitiveParamsType.PosLocal:
                paramList.Add(LocalPosition);
                break;

            case PrimitiveParamsType.Rotation:
                paramList.Add(GlobalRotation);
                break;

            case PrimitiveParamsType.RotLocal:
                paramList.Add(LocalRotation);
                break;

            case PrimitiveParamsType.Size:
                paramList.Add(Size);
                break;

            default:
                if (Enum.IsDefined(typeof(PrimitiveParamsType), (int)paramtype))
                {
                    throw new LocalizedScriptErrorException(this, "PRIM0NotAllowedForAgents", "{0} not allowed for agents", paramtype.GetLslName());
                }
                else
                {
                    throw new LocalizedScriptErrorException(this, "PRIMInvalidParameterType0", "Invalid primitive parameter type {0}", paramtype.GetLslName());
                }
            }
        }