Ejemplo n.º 1
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     varname  = Utility.ToVarname(parameters["var"]);
     varscope = (EScope)Utility.ToEnumInt(parameters["scope"]);
     func     = Utility.ToFunc(parameters["func"]);
     value    = Utility.ToVar(missionVars, parameters["value"]);
 }
Ejemplo n.º 2
0
 public static Var FunctionVar(Var lhs, Var rhs, EFunc func)
 {
     if (func == EFunc.SetTo)
     {
         return(rhs);
     }
     if (lhs.isInteger && rhs.isInteger)
     {
         return(Function((int)lhs, (int)rhs, func));
     }
     if (lhs.isNumber && rhs.isNumber)
     {
         return(Function((double)lhs, (double)rhs, func));
     }
     if (lhs.isString && rhs.isString)
     {
         return(Function((string)lhs, (string)rhs, func));
     }
     if (lhs.isBool && rhs.isBool)
     {
         return(Function((bool)lhs, (bool)rhs, func));
     }
     if (lhs.isBool && rhs.isInteger)
     {
         return(Function((bool)lhs, ((int)rhs != 0), func));
     }
     if (lhs.isInteger && rhs.isBool)
     {
         return(Function(((int)lhs != 0), (bool)rhs, func));
     }
     return(lhs);
 }
Ejemplo n.º 3
0
        OBJECT player;          // PLAYER

        // 在此初始化参数
        protected override void OnCreate()
        {
            item   = Utility.ToObject(parameters["item"]);
            func   = Utility.ToFunc(parameters["func"]);
            count  = Utility.ToInt(missionVars, parameters["count"]);
            player = Utility.ToObject(parameters["player"]);
        }
Ejemplo n.º 4
0
        Vector3 pos;    // NPOBJECT

        // 在此初始化参数
        protected override void OnCreate()
        {
            obj  = Utility.ToObject(parameters["object"]);
            cmd  = (ECommand)Utility.ToEnumInt(parameters["command"]);
            func = Utility.ToFunc(parameters["func"]);
            pos  = Utility.ToVector(missionVars, parameters["vector"]);
        }
Ejemplo n.º 5
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     obj  = Utility.ToObject(parameters["object"]);
     stat = (AttribType)Utility.ToEnumInt(parameters["stat"]);
     func = Utility.ToFunc(parameters["func"]);
     amt  = Utility.ToSingle(missionVars, parameters["amount"]);
 }
Ejemplo n.º 6
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     obj      = Utility.ToObject(parameters["object"]);
     func_pos = Utility.ToFunc(parameters["funcp"]);
     pos      = Utility.ToVector(missionVars, parameters["point"]);
     func_rot = Utility.ToFunc(parameters["funcr"]);
     rot      = Utility.ToVector(missionVars, parameters["euler"]);
 }
Ejemplo n.º 7
0
 // 在此初始化参数
 protected override void OnCreate()
 {
     id         = Utility.ToInt(missionVars, parameters["id"]);
     name       = Utility.ToText(missionVars, parameters["string"]);
     func_time  = Utility.ToFunc(parameters["funct"]);
     amt        = Utility.ToDouble(missionVars, parameters["amount"]);
     func_speed = Utility.ToFunc(parameters["funcs"]);
     speed      = Utility.ToSingle(missionVars, parameters["speed"]);
 }
Ejemplo n.º 8
0
        public static string Function(string lhs, string rhs, EFunc func)
        {
            switch (func)
            {
            case EFunc.SetTo: return(rhs);

            case EFunc.Plus: return(lhs + rhs);

            default: return(rhs);
            }
        }
Ejemplo n.º 9
0
        public void SetStopwatch(int id, string name, EFunc func_time, double amount_time, EFunc func_speed, float amount_speed)
        {
            if (!stopwatches.ContainsKey(id))
            {
                stopwatches[id] = new Stopwatch();
            }
            Stopwatch sw = stopwatches[id];

            sw.name              = name;
            sw.timer.Second      = Utility.Function(sw.timer.Second, amount_time, func_time);
            sw.timer.ElapseSpeed = Utility.Function(sw.timer.ElapseSpeed, amount_speed, func_speed);
        }
Ejemplo n.º 10
0
 private Vector3 Calculate(Vector3 lhs, Vector3 rhs, EFunc func)
 {
     if (func == EFunc.Plus)
     {
         return(lhs + rhs);
     }
     else if (func == EFunc.Minus)
     {
         return(lhs - rhs);
     }
     else
     {
         return(rhs);
     }
 }
Ejemplo n.º 11
0
        const int radius = 2;   //若点不是合法的站立点,将在一定区域内搜索合法站立点,这是此区域的半径
        private Vector3 LocalToWorld(Pathea.PeTrans trans, Vector3 local, EFunc func)
        {
            Vector3 world = Vector3.Cross(Vector3.up, trans.forward) * pos.x + Vector3.up * pos.y + trans.forward * pos.z;

            if (func == EFunc.Plus)
            {
                world = PETools.PEUtil.GetRandomPositionOnGround(trans.position + world, 0, radius);
            }
            else if (func == EFunc.Minus)
            {
                world = PETools.PEUtil.GetRandomPositionOnGround(trans.position - world, 0, radius);
            }
            else if (func == EFunc.SetTo)
            {
                world = local;
            }
            return(world);
        }
Ejemplo n.º 12
0
        public static double Function(double lhs, double rhs, EFunc func)
        {
            switch (func)
            {
            case EFunc.SetTo: return(rhs);

            case EFunc.Plus: return(lhs + rhs);

            case EFunc.Minus: return(lhs - rhs);

            case EFunc.Multiply: return(lhs * rhs);

            case EFunc.Divide: return(rhs == 0 ? 0 : lhs / rhs);

            case EFunc.Mod: return(rhs == 0 ? 0 : lhs % rhs);

            case EFunc.Power: return(lhs == 0 ? 0 : System.Math.Pow(lhs, rhs));

            case EFunc.XOR: return((int)lhs ^ (int)rhs);

            default: return(rhs);
            }
        }
Ejemplo n.º 13
0
        public static int Function(int lhs, int rhs, EFunc func)
        {
            switch (func)
            {
            case EFunc.SetTo: return(rhs);

            case EFunc.Plus: return(lhs + rhs);

            case EFunc.Minus: return(lhs - rhs);

            case EFunc.Multiply: return(lhs * rhs);

            case EFunc.Divide: return(rhs == 0 ? 0 : lhs / rhs);

            case EFunc.Mod: return(rhs == 0 ? 0 : lhs % rhs);

            case EFunc.Power: return(lhs == 0 ? 0 : (int)System.Math.Pow(lhs, rhs));

            case EFunc.XOR: return(lhs ^ rhs);

            default: return(rhs);
            }
        }
Ejemplo n.º 14
0
        public static bool Function(bool lhs, bool rhs, EFunc func)
        {
            switch (func)
            {
            case EFunc.SetTo: return(rhs);

            case EFunc.Plus: return(lhs | rhs);

            case EFunc.Minus: return(lhs ^ rhs);

            case EFunc.Multiply: return(lhs & rhs);

            case EFunc.Divide: return(lhs & rhs);

            case EFunc.Mod: return(false);

            case EFunc.Power: return(lhs);

            case EFunc.XOR: return(lhs ^ rhs);

            default: return(rhs);
            }
        }
 private void OnGUI()
 {
     #region On GUI Loaded `Home activated`
     if (_pInfor)
     {
         if (m_Scen != null)
         {
             GUI.Label(new Rect(1f, 1f, 100f, 20f), ".");
             if (m_Scen.isLoaded)
             {
                 if (m_Scen_name != "EnvironmentUIScene" && m_Scen_name != "MenuUIScene")
                 {
                     if (AllowEFunc == false)
                     {
                         AllowEFunc = true;
                     }
                     GUI.color = Color.red;
                     EDS.P(new Vector2(1f, 1f), Color.red, 1f);
                     // Update Main Struct
                     if (AllowEFunc == true && Time.time >= _plyR)
                     {
                         if (_ply != FindObjectsOfType <Player>())
                         {
                             _ply = null;
                             _ply = FindObjectsOfType <Player>();
                         }
                         _plyR = Time.time + __plyUpdate;
                     }
                     // Update GLPB
                     if (AllowEFunc == true && _ply != null && Time.time >= _lpR)
                     {
                         LPBFunc.GLPB(_ply, ref _lP);
                         _lpR = Time.time + __lPUpdate;
                     }
                     // recoil controller draw blue if ON
                     if (_rec && _lP != null)
                     {
                         GUI.color = Color.blue;
                         EDS.P(new Vector2(2f, 1f), Color.blue, 1f);
                         _lP.ProceduralWeaponAnimation.Shootingg.Intensity = 0.5f;
                     }
                     else
                     {
                         _lP.ProceduralWeaponAnimation.Shootingg.Intensity = 1.0f;
                     }
                     // draw yellow dotter if in ads
                     if (_cH && _lP != null)
                     {
                         if (!_lP.ProceduralWeaponAnimation.IsAiming)
                         {
                             GUI.color = Color.yellow;
                             EDS.P(new Vector2(Screen.width / 2f - 1f, Screen.height / 2f - 1f), Color.yellow, 2f);
                         }
                     }
                     EFunc.DrawError(_ply, _lP, _viewdistance);
                 }
                 else
                 {
                     if (AllowEFunc == true)
                     {
                         _pInfor = false;
                         _lP.ProceduralWeaponAnimation.Shootingg.Intensity = 1.0f;
                         Clear();
                         AllowEFunc = false;
                     }
                 }
             }
         }
     }
     else
     {
         GUI.color = Color.white;
         EDS.P(new Vector2(1f, 1f), Color.white, 1f);
     }
     #endregion
     #region Log is off? FLAG
     if (Debug.logger.logEnabled == false)
     {
         GUI.Label(new Rect(1f, 5f, 100f, 20f), "off");
     }
     #endregion
 }