Example #1
0
    public void StartCompilation()
    {
        if (IsCompiling)
        {
            return;
        }


        //  cbm = new CodeBlockManager();
        PlayerPoints = 0;
        EnemyPoints  = 0;
        EnemyActions = new List <ActionStates>();
        EnemyActions.Clear();
        foreach (ActionHandler act in EAS.actions)
        {
            EnemyActions.Add(act.Action);
        }

        //int i = 0;
        ClearConsole();
        AddtoConsole("Start of Simulation");
        Debug.Log("Starting Simulation");
        if (MainHasContent())
        {
            Debug.Log("MainFunction has content");
        }
        else
        {
            Modal.ShowOk("Your main block is empty! Create and put your script on the main block!", () => StopAll(), "Oops!");
            Debug.Log("MainFunction has NO content"); return;
        }

        // CodeblockUIAnimator.SetBool("IsOpen", false);


        int playerActs = CBM.GetPlayerMoveCount(MainFuncContent, 0);

        Debug.Log("Player actions:" + playerActs);
        if (playerActs <= 0)
        {
            Modal.ShowOk("Your script yields no action! Revisit your Code Blocks!", () => StopAll(), "Oops!");
            Debug.Log("Warning: Player yields no actions! Revisit your codeBlocks!");
            return;
        }

        if ((playerActs - EnemyActions.Count) >= OverheadActionTreshold)
        {
            Modal.ShowOk("You have too much overhead actions! Revisit your Code Blocks!", () => StopAll(), "Oops!");
            Debug.Log("Warning: Player have too much Overhead Actions! Please revisit your codeBlocks!");
            return;
        }

        if (playerActs > EnemyActions.Count)
        {
            //todo when  players action is more than enemies action
            Modal.ShowYesNo("You have MORE actions than the enemy, Overhead actions have no effect on enemies! Do you want to continue?", () => DoNothing(), () => StopAll());
            Debug.Log("Warning: Player have MORE actions than the enemy, Overhead actions have no effect on enemies!");
        }

        else if (playerActs < EnemyActions.Count)
        {
            Modal.ShowYesNo("You have LESS actions than the enemy, Proceeding actions will be considered as IDLE! Do you want to continue?", () => DoNothing(), () => StopAll());

            Debug.Log("Warning: Player have LESS actions than the enemy, Proceeding actions will be considered as IDLE!");
        }

        //Randomizes Enemy Actions
        EAS.PrepareActions();
        fillEnemyActions.FillOutCanvas();

        IsCompiling    = true;
        Timer.IsPaused = true;
        PlayerScriptSim.SetBool("IsOpen", true);
        CodeCanvasCG.blocksRaycasts = false;
        CBM.PlayerActions.Clear();
        CBM.CodeContainerReader(MainFuncContent);

        //Debug.Log("LOL!");
    }
Example #2
0
 public void OnPointerDown(PointerEventData eventData)
 {
     Debug.Log("Show Description");
     MDS.ShowOk(QM.quests[QM.activeQuest].Description, null, "Quest Info");
 }