Ejemplo n.º 1
0
        //===================================
        //  Custscene stuff
        //===================================


        //===================================
        // Objects and Characters
        //===================================
        public object CreateObject(string objtype, string instancename, int x, int y, int w, int h)
        {
            GroundMap map = ZoneManager.Instance.CurrentGround;

            if (map == null)
            {
                DiagManager.Instance.LogInfo(String.Format("ScriptGround.CreateObject({0}, {1}, {2}, {3}, {4}, {5}) : No ground map loaded!", objtype, instancename, x, y, w, h));
                return(null);
            }

            GroundObject groundobject = null;
            var          template     = TemplateManager.Instance.FindTemplate(objtype); //Templates are created by the modders, and stored as data (This is handy, because its pretty certain a lot of characters and entities will be repeated throughout the maps)

            if (template == null)
            {
                return(null);
            }

            groundobject        = (GroundObject)template.create(instancename);
            groundobject.Bounds = new Rect(x, y, w, h);
            groundobject.AddScriptEvent(LuaEngine.EEntLuaEventTypes.Action);
            map.AddObject(groundobject);
            return(groundobject); //Object's properties can be tweaked later on
        }