예제 #1
0
    public override void Do(CommandMapScript prCommand)
    {
        //Default Result
        string lcResult = "AI: Sorry my error, could you type that again?";

        switch (_Scan)
        {
        case "area":
            //Get players current scene
            SceneScript lcCurrentScene = PlayerManagerScript.GetCurrentScene();
            //Add to users score
            PlayerManagerScript._CurrentPlayer.PlayerScore += 25;
            //Add scene name to scanned list
            PlayerManagerScript._CurrentPlayer.Scanned += lcCurrentScene + ",";
            //update database
            _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
            //Output
            lcResult = "AI: Scanning Area \n" +
                       lcCurrentScene.Scan +
                       "\n" +
                       "AI: Items found \n" +
                       ItemstoString(lcCurrentScene.Name);
            break;
            //-------------------------------------- End Of Methods ----------------------------------------------------------------------------
        }
        prCommand._Result = lcResult;
    }
예제 #2
0
    /// <summary>
    /// Moves the player based on the direction
    /// </summary>
    /// <param name="prCommand"> </param>
    public override void Do(CommandMapScript prCommand)
    {
        if (GameManagerScript._Instance._ActiveCanvas.name == "Main Canvas")
        {
            //Turn off display events
            TurnOffEvent();
            //Assign players current local to a local variable
            SceneScript lcCurrentScene = PlayerManagerScript.GetCurrentScene();
            //Create a new scene variable
            SceneScript lcNewScene = new SceneScript();

            //Try get new scene. If not a valid direction, ignore
            try
            {
                //Get scene direction by selecting where From Scene name is current Scenes and direction is users input
                SceneDirectionScript lcSceneDirection = _db.Connection.Table <SceneDirectionScript>().Where <SceneDirectionScript>(x => x.FromSceneName == lcCurrentScene.Name && x.Direction == _direction).ToList <SceneDirectionScript>().First <SceneDirectionScript>();

                //Get new scene by selecting where name is scene direction's to scene variable
                lcNewScene = _db.Connection.Table <SceneScript>().Where <SceneScript>(x => x.Name == lcSceneDirection.ToSceneName).ToList <SceneScript>().First <SceneScript>();
                PlayerManagerScript._CurrentPlayer.CurrentLocationID = lcNewScene.Name;
            }
            catch
            {
                lcNewScene = _db.Connection.Table <SceneScript>().Where <SceneScript>(x => x.Name == lcCurrentScene.Name).ToList <SceneScript>().First <SceneScript>();
                PlayerManagerScript._CurrentPlayer.CurrentLocationID = lcNewScene.Name;
            }

            //check if new scene has a display event
            HasEvent(lcNewScene.Event);

            //if scene has been visited and scanned, Set this as text output
            if (Visited(lcNewScene) && Scanned(lcNewScene))
            {
                prCommand._Result = lcNewScene.Name + "\n" +
                                    lcNewScene.SceneStoryDescription + "\n" +
                                    _Scanned;
            }
            //Else if scene has only been visited, set this as text output
            else if (Visited(lcNewScene))
            {
                prCommand._Result = lcNewScene.Name + "\n" +
                                    lcNewScene.SceneStoryDescription + "\n" +
                                    _NotScanned;
            }
            else
            {
                //Update player saying they have visited this area before
                PlayerManagerScript._CurrentPlayer.Visted = PlayerManagerScript._CurrentPlayer.Visted + "," + lcNewScene.Name;
                //Update player with more score
                PlayerManagerScript._CurrentPlayer.PlayerScore += 10;
                //Set this as text output
                prCommand._Result = lcNewScene.Name + "\n" + lcNewScene.SceneStoryDescription;
            }
            _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
        }
        else
        {
            prCommand._Result = "switch to the terminal to move";
        }
    }
예제 #3
0
    public override void Do(CommandMapScript prCommand)
    {
        if (GameManagerScript._Instance._ActiveCanvas.name == "Main Canvas")
        {
            //Default Result
            string lcResult = "AI: Sorry my error, could you type that again?";

            switch (_Scan)
            {
            case "area":
                //Get players current scene
                SceneScript lcCurrentScene = PlayerManagerScript.GetCurrentScene();
                //Add to users score
                PlayerManagerScript._CurrentPlayer.PlayerScore += 25;
                //Add scene name to scanned list
                PlayerManagerScript._CurrentPlayer.Scanned += lcCurrentScene + ",";
                //update database
                _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
                //Output
                lcResult = "AI: Scanning Area \n" +
                           lcCurrentScene.Scan +
                           "\n" +
                           "AI: Items found \n" +
                           ItemstoString(lcCurrentScene.Name);
                break;
            }
            prCommand._Result = lcResult;
        }
        else
        {
            prCommand._Result = "switch to the terminal to scan";
        }

        //update Firebase Database
    }
예제 #4
0
    public override void Do(CommandMapScript prCommand)
    {
        //Turn off display events
        TurnOffEvent();

        //Assign players current local to a local variable
        SceneScript lcCurrentScene = PlayerManagerScript.GetCurrentScene();

        //Get scene direction by selecting where From Scene name is current Scenes and direction is users input
        SceneDirectionScript lcSceneDirection = _db.Connection.Table <SceneDirectionScript>().Where <SceneDirectionScript>(x => x.FromSceneName == lcCurrentScene.Name && x.Direction == _direction).ToList <SceneDirectionScript>().First <SceneDirectionScript>();

        //Get new scene by selecting where name is scene direction's to scene variable
        SceneScript lcNewScene = _db.Connection.Table <SceneScript>().Where <SceneScript>(x => x.Name == lcSceneDirection.ToSceneName).ToList <SceneScript>().First <SceneScript>();

        //Update current player with new scene
        PlayerManagerScript._CurrentPlayer.CurrentLocationID = lcNewScene.Name;

        //Save updated player in database
        _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);

        //check if new scene has a display event
        HasEvent(lcNewScene.Event);

        //if scene has been visited and scanned, Set this as text output
        if (Visited(lcNewScene) && Scanned(lcNewScene))
        {
            prCommand._Result = lcNewScene.Name + "\n" +
                                lcNewScene.SceneStoryDescription + "\n" +
                                _Scanned;
        }
        //Else if scene has only been visited, set this as text output
        else if (Visited(lcNewScene))
        {
            prCommand._Result = lcNewScene.Name + "\n" +
                                lcNewScene.SceneStoryDescription + "\n" +
                                _NotScanned;
        }
        else
        {
            //Update player saying they have visited this area before
            PlayerManagerScript._CurrentPlayer.Visted = PlayerManagerScript._CurrentPlayer.Visted + "," + lcNewScene.Name;
            //Update player with more score
            PlayerManagerScript._CurrentPlayer.PlayerScore += 10;
            //Save updated player into database
            _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
            //Set this as text output
            prCommand._Result = lcNewScene.Name + "\n" + lcNewScene.SceneStoryDescription;
        }
    }
예제 #5
0
    public override void Do(CommandMapScript prCommand)
    {
        if (GameManagerScript._Instance._ActiveCanvas.name == "Main Canvas")
        {
            //Default output
            string lcResult = "AI: No Items to Sell";

            //Check to see if user is in correct location to sell items
            if (PlayerManagerScript.GetCurrentScene().Name == "C4")
            {
                //Create Array of players inventory items
                string[] lcInventory = PlayerManagerScript._CurrentPlayer.InventoryList.Split(',');

                foreach (string ItemName in lcInventory)
                //Side effect of .Split, Creates one extra in Array
                {
                    if (ItemName != "")
                    {
                        //Get item with same name
                        GameItemScript lcItem = _db.Connection.Table <GameItemScript>().Where(x => x.Name == ItemName).First <GameItemScript>();
                        //Add item price to players money
                        PlayerManagerScript._CurrentPlayer.PlayerMoney += lcItem.Price;
                        //Add item score to players score
                        PlayerManagerScript._CurrentPlayer.PlayerScore += lcItem.Score;
                    }
                }
                //Empty Inventory
                PlayerManagerScript._CurrentPlayer.InventoryList = "";
                //Update data base
                _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
                //New Output
                lcResult = "AI: All items sold";
            }
            else
            {
                //New Output
                lcResult = "AI: Not at the shop, Go to C4";
            }

            prCommand._Result = lcResult;
        }
        else
        {
            prCommand._Result = "switch to the terminal to sell items";
        }

        //update Firebase Database
    }
예제 #6
0
//--------------------------------------- End Of Top Level Variable Declaring ---------------------------------------------------------


//-------------------------------------- Start Of Methods ----------------------------------------------------------------------------
    // Use this for initialization
    void Start()
    {
        // Adding the gameobject to the variable
        _inputField = this.GetComponent <InputField>();

        if (_inputField != null)
        {
            _submitEvent = new InputField.SubmitEvent();
            _submitEvent.AddListener(submitInput);
            _inputField.onEndEdit = _submitEvent;
            //If this input field is attached to main canvas, show story
            if (_Canvas.name == "Main Canvas")
            {
                _TxtOutput.text = PlayerManagerScript.GetCurrentScene().Name + "\n" + PlayerManagerScript.GetCurrentScene().SceneStoryDescription;
            }
        }
    }
예제 #7
0
 public override void Do(CommandMapScript prCommand)
 {
     if (GameManagerScript._Instance._ActiveCanvas.name == "Main Canvas")
     {
         switch (_item)
         {
         case "up":
             SceneScript lcCurrentScene = PlayerManagerScript.GetCurrentScene();
             //if items havent been picked up
             if (!ItemsPickedUp(lcCurrentScene.Name))
             {
                 string lcInventoryList = null;
                 List <SceneItemScript> lcSceneItems = new List <SceneItemScript>();
                 //Gets all Scene Item that have the current Scene Name
                 lcSceneItems = _db.Connection.Table <SceneItemScript>().Where <SceneItemScript>(x => x.SceneName == lcCurrentScene.Name).ToList <SceneItemScript>();
                 foreach (SceneItemScript SceneItem in lcSceneItems)
                 {
                     //Get the Item with the same ID
                     GameItemScript Item = _db.Connection.Table <GameItemScript>().Where <GameItemScript>(x => x.ItemId == SceneItem.ItemId).ToList <GameItemScript>().First <GameItemScript>();
                     //Add Item name to local variable
                     lcInventoryList = lcInventoryList + Item.Name + ",";
                 }
                 //Add current scene name to collected list
                 PlayerManagerScript._CurrentPlayer.CollectList = PlayerManagerScript._CurrentPlayer.CollectList + lcCurrentScene + ",";
                 //Update players inventory with local variable
                 PlayerManagerScript._CurrentPlayer.InventoryList = PlayerManagerScript._CurrentPlayer.InventoryList + lcInventoryList;
                 //Save to database
                 _db.Connection.InsertOrReplace(PlayerManagerScript._CurrentPlayer);
                 //Text output
                 prCommand._Result = "AI: Items picked up";
             }
             else
             //Text Output
             {
                 prCommand._Result = "AI: No Items to pick up";
             }
             break;
         }
     }
     else
     {
         prCommand._Result = "switch to the terminal to pick Items up";
     }
     //update Firebase Database
 }
예제 #8
0
    public override void Do(CommandMapScript prCommand)
    {
        //Default output
        string lcResult = "What are you wanting to show?";
        //Get current Scene
        SceneScript lcScene = PlayerManagerScript.GetCurrentScene();
        //Help Output
        string lcHelp = "Go: \n" +
                        "   Up - Down - Left - Right \n" +
                        "Show: \n" +
                        "   Map - Inventory - Terminal - Help\n" +
                        "Scan: \n" +
                        "   Area \n" +
                        "Pick: \n" +
                        "   Up \n" +
                        "Sell: \n" +
                        "   Items";

        switch (_Display)
        {
        case "map":
            lcResult = "";
            GameManagerScript._Instance.SetActiveCanvas("Map Canvas");
            break;

        case "inventory":
            GameManagerScript._Instance.SetActiveCanvas("Inventory Canvas");
            break;

        case "terminal":
            GameManagerScript._Instance.SetActiveCanvas("Main Canvas");
            lcResult = lcScene.SceneStoryDescription;
            break;

        case "help":
            lcResult = lcHelp;
            break;
        }

        prCommand._Result = lcResult;
    }
예제 #9
0
/// <summary>
/// Sets up the input field and updates the view with the users current in game scene
/// </summary>
    void Start()
    {
        // Adding the gameobject to the variable
        _inputField = this.GetComponent <InputField>();

        if (_inputField != null)
        {
            _submitEvent = new InputField.SubmitEvent();
            _submitEvent.AddListener(submitInput);
            _inputField.onEndEdit = _submitEvent;

            //If this input field is attached to main canvas, show story
            if (_Canvas.name == "Main Canvas")
            {
                _TxtOutput.text = PlayerManagerScript.GetCurrentScene().Name + "\n" + PlayerManagerScript.GetCurrentScene().SceneStoryDescription;
            }
        }
        //checks the user for mobile input every 1.5 seconds
        //ERROR: when the user submits a command, it moves two spaces instead of one. I am unsure where the error is.
        InvokeRepeating("MobileInput", 1.5f, 1.5f);
    }