void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Beispiel #2
0
    public static int preg    = 3;  //9

    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);
    }
Beispiel #3
0
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(this.gameObject);
    }
Beispiel #4
0
    private void Start()
    {
        PlayerData.Instance.oneJump = false;
        Debug.Log("Choosing");
        button1 = PlayerData.Instance.buttons[Random.Range(0, PlayerData.Instance.buttons.Count)];
        PlayerData.Instance.buttons.Remove(button1);
        button2 = PlayerData.Instance.buttons[Random.Range(0, PlayerData.Instance.buttons.Count)];
        PlayerData.Instance.buttons.Add(button1);
        Debug.Log(button1.name + " " + button2.name);
        b1 = Instantiate(button1, new Vector3((Screen.width / 2) - 150, Screen.height / 2, 0), Quaternion.identity, canvas.transform);
        b2 = Instantiate(button2, new Vector3((Screen.width / 2) + 150, Screen.height / 2, 0), Quaternion.identity, canvas.transform);
        Debug.Log(b1);
        Debug.Log(b2);
        Debug.Log(PlayerData.Instance.pressButton);

        ggm = GeneralGameManager.Instance;
    }
    // Use this for initialization
    void Start()
    {
        pd                 = PlayerData.Instance;
        playerCombat       = GetComponent <PlayerCombat>();
        isGrounded         = false;
        rb                 = GetComponent <Rigidbody2D>();
        startingLocalScale = transform.localScale;
        ggm                = GeneralGameManager.Instance;

        //Retrieve vars from PlayerData
        speed    = pd.moveSpeed;
        jumpvel  = pd.jumpVel;
        maxJumps = pd.maxJumps;

        animator = GetComponent <Animator>();

        if (pd.lowLighting)
        {
            Vector3 position = transform.position;
            position.z = -1;
            Instantiate(playerLight, position, Quaternion.identity);
        }
    }
Beispiel #6
0
        private void OpenKIFFile(string kifFilePath)
        {
            KIFFilePath = kifFilePath;
            mruManager.AddRecentFile(KIFFilePath);
            GeneralGameManager = new GeneralGameManager(KIFFilePath, 10, 10, Properties.Settings.Default.WcfSvcHostExecutable, Properties.Settings.Default.TempFilePath)
            {
                StartNextMoveEvent = startNextTurnEvent, PrevMoveEvent = prevTurnEvent
            };
            GeneralGame.UseOldWayOfGeneratingAndApplyingMoves =
                useOriginalMoveGenerationAndApplicationToolStripMenuItem.Checked;

            playerToolStripMenuItem.DropDownItems.Clear();
            int playerOutputWindowX    = 0;
            int playerOutputWindowY    = htmlOutputForm.Location.Y + htmlOutputForm.Height;
            int playerOutputFormWidth  = (this.ClientRectangle.Width - 5) / (GeneralGameManager.TheGeneralGame.FindRoles().Count() == 0 ? 1 : GeneralGameManager.TheGeneralGame.FindRoles().Count());
            int playerOutputFormHeight = this.ClientRectangle.Height - 25 - this.statusStrip1.Height - managerOutputForm.Height - htmlOutputForm.Height - (2 * SystemInformation.HorizontalScrollBarHeight);
            int playerFormCount        = 0;

            foreach (string role in GeneralGameManager.TheGeneralGame.FindRoles())
            {
                var playerOutputForm = new Form()
                {
                    MdiParent     = this,
                    Text          = role,
                    StartPosition = FormStartPosition.Manual,
                    Location      = new Point(playerOutputWindowX, playerOutputWindowY),
                    Width         = playerOutputFormWidth,
                    Height        = playerOutputFormHeight,
                    Tag           = PlayerWindowConfigStringPrefix + playerFormCount
                };
                var playerOutputTextBox = new TextBox()
                {
                    Dock = DockStyle.Fill, Multiline = true, ScrollBars = ScrollBars.Both
                };
                playerOutputForm.Controls.Add(playerOutputTextBox);
                DebugAndTraceHelper.AddListener(new TextboxTraceListener(playerOutputTextBox), role);
                playerOutputWindowX += playerOutputForm.Bounds.Width;
                WindowGeometryPersistence.SetFormsGeometry(Properties.Settings.Default.WindowGeometry, playerOutputForm);
                playerOutputForm.Show();
                outputForms.Add(playerOutputForm);

                var mi = new ToolStripMenuItem(role);
                playerToolStripMenuItem.DropDownItems.Add(mi);

                var submi = new ToolStripMenuItem("Query Player Prolog Engine");
                mi.DropDownItems.Add(submi);
                submi.Click += (o, k) =>
                {
                    var dialog = new PrologQuery(GeneralGameManager.Players.Where(n => n.Role == role).First().GetPrologEngine());
                    dialog.Show(this);
                };

                playerFormCount++;
            }

            startGameToolStripMenuItem.Enabled = true;

            saveCollapsedParseTreesToolStripMenuItem.Enabled = true;
            saveParseTreesToolStripMenuItem.Enabled          = true;
            saveHornClausesToolStripMenuItem.Enabled         = true;

            queryGamePrologEngineToolStripMenuItem.Enabled       = true;
            dumpPrologEngineUserClausesToolStripMenuItem.Enabled = true;
        }