Exemplo n.º 1
0
    void Initialize()
    {
        // Camera.main.GetComponent<MousePan>().Activated = true;
        Slot1.ActivatePanel();
        activePanel = Slot1;

        if (Slot1.InUse)
        {
            Slot1.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 1));
        }
        if (Slot2.InUse)
        {
            Slot2.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 2));
        }
        if (Slot3.InUse)
        {
            Slot3.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 3));
        }
        if (Slot4.InUse)
        {
            Slot4.GetPanel().Click += new MouseEventHandler((control, mouseEvent) => SlotClick(control, mouseEvent, 4));
        }

        IBlackBox brain1 = null, brain2 = null, brain3 = null, brain4 = null, activeBrain = null;
        string    path = "";

        if (Player.Brain1 != null)
        {
            path = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain1.ObjectId);
            // print("Path: " + path);
            brain1      = Utility.LoadBrain(path);
            activeBrain = brain1;
        }
        if (Player.Brain2 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain2.ObjectId);
            brain2 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain2;
            }
        }

        if (Player.Brain3 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain3.ObjectId);
            brain3 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain3;
            }
        }

        if (Player.Brain4 != null)
        {
            path   = Application.persistentDataPath + string.Format("/{0}/{1}.champ.xml", Player.Username, Player.Brain4.ObjectId);
            brain4 = Utility.LoadBrain(path);
            if (activeBrain == null)
            {
                activeBrain = brain4;
            }
        }


        Controller.Activate(activeBrain, Target);
        Controller.SetBrains(brain1, brain2, brain3, brain4);

        // print("Current mission: " + PlayerPrefs.GetInt(MissionPanel.CURRENT_MISSION, 1));
        string arena = "";

        switch (PlayerPrefs.GetInt(MissionPanel.CURRENT_MISSION, 1))
        {
        case 1:
            arena = "Mission 1";

            Mission1.Initialize(this);
            break;

        case 2:
            arena = "Mission 2";
            Mission2.Initialize(this);
            break;

        case 3:
            arena = "Mission 3";
            Mission3.Initialize(this);
            break;

        case 4:
            arena = "Mission 4";
            Mission4.Initialize(this);
            break;

        case 5:
            arena = "Mission 5";
            Mission5.Initialize(this);
            break;
        }
        logger = new EventLogger(Controller, arena);

        logger.StartLogging();
    }