public LLEMapFrontLayer(Assets theAssets, string saveSlotName, int windowWidth, int windowHeight)
        {
            assets = theAssets;

            mapObjects = null;

            mapObjects = new List<LLEObject>();

            playerInventory = new List<LLEObject>();

            mapEnemies = new List<LLEEnemy>();

            msgManager = null;

            mPlayerCharacter = null;

            mSaveSlotName = saveSlotName;

            mWindowWidth = windowWidth;

            mWindowHeight = windowHeight;
        }
        public void init()
        {
            msgManager = new LLEMessageManager(assets, this);

            scriptProcessor = new LLEScriptProcessor(assets, mSaveSlotName, this);
        }
        public void release(bool reset)
        {
            releaseMapObjects(reset);

            releaseMapEnemies(reset);

            releasePlayerInventory();

            if (scriptProcessor != null)
            {
                scriptProcessor.release();

                scriptProcessor = null;
            }

            if (msgManager != null)
            {
                msgManager.release();

                msgManager = null;
            }
        }
        public void executeScript(LLEMessageManager msgManager, LLEPlayerData playerData)
        {
            XmlTextReader xmlParser = new XmlTextReader("LemonPlatformEditor/ContentDatabase/Scripts/" + targetObject.getScriptName() + ".xml");

            while (xmlParser.Read())
            {
                if (xmlParser.NodeType == XmlNodeType.Element)
                {
                    tagName = xmlParser.Name;

                    switch (tagName)
                    {
                        case "ScriptScope":
                        case "SetSprite":
                        case "VerifyVariable":
                        case "SetVariable":
                        case "MessageBalloon":
                        case "SetTargetVariable":
                        case "SetTargetSprite":
                        case "SetScriptVisibility":
                        case "GiveItem":
                        case "HasItem":
                        case "RemoveItem":
                        case "PlayerData.HasWeapon":
                        {
                            command = tagName;

                            break;
                        }
                    }
                }

                else if (xmlParser.NodeType == XmlNodeType.EndElement)
                {
                    if (xmlParser.Name == "ScriptScope")
                    {
                        ignoreTags = false;
                    }
                }

                else if (xmlParser.NodeType == XmlNodeType.Text)
                {
                    if (!ignoreTags)
                    {
                        switch (tagName)
                        {
                            case "ObjectName":
                            {
                                externObjectName = xmlParser.Value;

                                break;
                            }

                            case "ObjectVisible":
                            {
                                objectVisible = xmlParser.Value;

                                setObjectVisibility();

                                break;
                            }

                            case "VariableName":
                            {
                                variableName = xmlParser.Value;

                                break;
                            }

                            case "VariableValue":
                            {
                                variableValue = xmlParser.Value;

                                if (command == "SetVariable")
                                {
                                    setScriptVariable();
                                }

                                else if (command == "SetTargetVariable")
                                {
                                    setExternalVariable();
                                }

                                break;
                            }

                            case "TargetSprite":
                            {
                                externSprite = xmlParser.Value;

                                if (command == "SetTargetSprite")
                                {
                                    setExternalSprite();
                                }

                                break;
                            }

                            case "ItemName":
                            {
                                itemName = xmlParser.Value;

                                break;
                            }

                            case "IsTrue":
                                {
                                    trueConditionScope = xmlParser.Value;

                                    break;
                                }

                            case "IsFalse":
                                {
                                    falseConditionScope = xmlParser.Value;

                                    if (command == "VerifyVariable")
                                    {
                                        if (verifyVariableValue())
                                        {
                                            scriptScopeName = trueConditionScope;
                                        }

                                        else
                                        {
                                            scriptScopeName = falseConditionScope;
                                        }
                                    }

                                    else if (command == "HasItem")
                                    {
                                        if(hasItem(itemName))
                                        {
                                            scriptScopeName = trueConditionScope;
                                        }

                                        else
                                        {
                                            scriptScopeName = falseConditionScope;
                                        }
                                    }

                                    break;
                                }

                            case "ScopeName":
                                {
                                    if (command == "ScriptScope")
                                    {
                                        if (scriptScopeName != xmlParser.Value)
                                        {
                                            ignoreTags = true;
                                        }
                                    }

                                    break;
                                }

                            case "SetSprite":
                                {
                                    objectSprite = xmlParser.Value;

                                    setObjectSprite();

                                    break;
                                }

                            case "PlayerData.HasWeapon":
                                {
                                    playerData.mHasWeapon = Convert.ToBoolean(xmlParser.Value);

                                    break;
                                }

                            case "GiveItem":
                                {
                                    addItemToInventory(xmlParser.Value);

                                    break;
                                }

                            case "RemoveItem":
                                {
                                    removeItemFromInventory(xmlParser.Value);

                                    break;
                                }

                            case "Target":
                                {
                                    if (command == "MessageBalloon")
                                    {
                                        mMessageTarget = xmlParser.Value;
                                    }

                                    break;
                                }

                            case "EventMsgIcon":
                                {
                                    eventMsg = true;

                                    eventMsgIcon = xmlParser.Value;

                                    break;
                                }

                            case "Text":
                                {
                                    if (command == "MessageBalloon")
                                    {
                                        msgManager.setFocusEntity(mMessageTarget);

                                        msgManager.addMessage(xmlParser.Value, eventMsg, eventMsgIcon);

                                        eventMsgIcon = "";

                                        eventMsg = false;
                                    }

                                    break;
                                }
                        }
                    }
                }
            }

            xmlParser.Close();
        }