private void Start()
    {
        Manager2 manager = FindObjectOfType <Manager2>();

        max_v        = manager.max_v;
        acceleration = manager.acceleration;
        dampspeed    = manager.dampspeed;
        maxhealth    = manager.maxhealth;
        inman        = FindObjectOfType <InputManager>();
        currhealth   = maxhealth;

        //Load brain
        int      inputNeuron  = nn.Input;
        int      hiddenNeuron = nn.Hidden;
        int      outputNeuron = nn.Output;
        R2Tensor ihWeight     = new R2Tensor(hiddenNeuron, inputNeuron, nn.ih_weight);
        R2Tensor ihBias       = new R2Tensor(hiddenNeuron, 1, nn.ih_bias);
        R2Tensor ohWeight     = new R2Tensor(outputNeuron, hiddenNeuron, nn.ho_weight);
        R2Tensor ohBias       = new R2Tensor(outputNeuron, 1, nn.ho_bias);

        brain = new NeuralNetwork(ihWeight, ihBias, ohWeight, ohBias, inputNeuron, hiddenNeuron, outputNeuron);

        //Particles
        if (particleson)
        {
            part = Instantiate(particlesystem, Vector3.zero, Quaternion.identity, gameObject.transform).GetComponent <ParticleSystem>();
        }
    }
Exemple #2
0
 // Use this for initialization
 void Start()
 {
     manager       = GetComponent(typeof(Manager2)) as Manager2;
     manager.tiles = GetComponent(typeof(Tiles2)) as Tiles2;
     Init();
     manager.tiles.Cell_init();
 }
    private void Start()
    {
        Manager2 man = FindObjectOfType <Manager2>();

        max_v        = man.max_v;
        acceleration = man.acceleration;
        dampspeed    = man.dampspeed;
        maxhealth    = man.maxhealth;
        currhealth   = maxhealth;
    }
Exemple #4
0
    public void OnPointerDown(PointerEventData eventData)
    {
        Manager2 manager = GameObject.Find("Manager").GetComponent <Manager2>();

        IsSelected = manager.Select(_name.text);
        if (IsSelected)
        {
            _TextSelected.text = "已選取";
        }
        else
        {
            _TextSelected.text = "未選取";
        }
    }
Exemple #5
0
        public static void DropTestDatabaseAndRole()
        {
            NpgsqlConnection.ClearAllPools();
            using (var conn = Manager1.CreateDatabaseConnection())
            {
                conn.Open();

                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("DROP DATABASE IF EXISTS \"{0}\"", Manager1.Description.ConnectionInfo.DatabaseName);
                    cmd.ExecuteNonQuery();
                }
            }

            using (var conn = Manager2.CreateDatabaseConnection())
            {
                conn.Open();

                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("DROP DATABASE IF EXISTS \"{0}\"", Manager2.Description.ConnectionInfo.DatabaseName);
                    cmd.ExecuteNonQuery();
                }
            }

            using (var conn = Manager1.CreateDatabaseConnection())
            {
                conn.Open();

                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("DROP ROLE IF EXISTS \"{0}\"", Manager2.Description.ConnectionInfo.UserName);
                    cmd.ExecuteNonQuery();
                }
            }

            using (var conn = Manager2.CreateDatabaseConnection())
            {
                conn.Open();

                using (var cmd = conn.CreateCommand())
                {
                    cmd.CommandText = string.Format("DROP ROLE IF EXISTS \"{0}\"", Manager2.Description.ConnectionInfo.UserName);
                    cmd.ExecuteNonQuery();
                }
            }
        }
        /// <summary>
        /// Gets the assigned work items.
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="fieldFilter">The field filter.</param>
        /// <returns>
        /// BurnReport Object
        /// </returns>
        public WorkItemCollection GetAssignedWorkItems(string sessionId, string tfsUrlPath, string projectName, FieldFilter fieldFilter)
        {
            Manager2 manager = new Manager2();

            BurnRetrievalOptions retrievalOptions = new BurnRetrievalOptions();
            string Query = "SELECT [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [Custom.ReleasedIn], [System.IterationPath]  FROM WorkItems ";

            Query = Query + GetWorkItemTypeWhereClause(fieldFilter);
            Query = Query + GetStateWhereClause(fieldFilter);
            Query = Query + " AND [System.AssignedTo] IN ";
            Query = Query + GetAssignedToWhereClause(sessionId, fieldFilter, retrievalOptions);
            Query = Query + GetIterationPathWhereClause(projectName, fieldFilter);

            Query = Query + " ORDER BY [System.Id] ";

            return(manager.GetAssignedWorkItems(tfsUrlPath, projectName, retrievalOptions, Query));
        }
    private void Start()
    {
        input       = parameters.input.ToString();
        output      = parameters.output.ToString();
        RayLength   = parameters.RayLength;
        theta       = parameters.theta * Mathf.PI / 180;
        usetimemask = parameters.UseTimeMask;
        invert      = parameters.Invert;

        man = gameObject.GetComponent <Manager2>();
        int correction = 1;

        if (2 * Mathf.PI % theta == 0)
        {
            correction = 0;
        }
        iter = div(2 * Mathf.PI, theta) + correction;
    }
        /// <summary>
        /// Gets the burn details.
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="fieldFilter">The field filter.</param>
        /// <returns>Burn Report</returns>
        public BurnReport GetBurnDetails(string sessionId, string tfsUrlPath, string projectName, FieldFilter fieldFilter)
        {
            Manager2             manager          = new Manager2();
            BurnRetrievalOptions retrievalOptions = new BurnRetrievalOptions();

            string Query = "SELECT [System.ChangedBy], [System.Id], [System.WorkItemType], [System.Title], [System.AssignedTo], [System.State], [System.ChangedDate], " +
                           "[System.CreatedDate], [Microsoft.VSTS.Scheduling.OriginalEstimate], [Microsoft.VSTS.Scheduling.RemainingWork], [Microsoft.VSTS.Scheduling.CompletedWork] " +
                           "FROM WorkItemLinks " +
                           "WHERE " +
                           "([Source].[System.TeamProject] = @project) And " +
                           "([System.Links.LinkType] = 'System.LinkTypes.Hierarchy-Forward') And " +
                           "([Target].[System.WorkItemType] = 'Task')  And " +
                           "([Target].[System.AssignedTo] IN  ";

            Query = Query + GetAssignedToWhereClause(sessionId, fieldFilter, retrievalOptions) + " And ";

            Query = Query + "[Target].[System.ChangedDate] >= @startDate And " +
                    "[Target].[System.CreatedDate] <= @endDate) " +
                    "ORDER BY [System.Id] mode(Recursive,ReturnMatchingChildren)";

            retrievalOptions.DateRange = fieldFilter.DateRange;

            return(manager.GetBurnDetails(tfsUrlPath, projectName, retrievalOptions, Query));
        }
        /// <summary>
        /// Gets the child tasks.
        /// </summary>
        /// <param name="sessionId">The session identifier.</param>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="ParentId">The parent identifier.</param>
        /// <returns>ChildItem Collection</returns>
        public ChildItemCollection GetChildTasks(string sessionId, string tfsUrlPath, string projectName, string ParentId)
        {
            Manager2 manager = new Manager2();

            return(manager.GetChildTasksDetails(tfsUrlPath, projectName, ParentId));
        }
        /// <summary>
        /// Gets the iterations.
        /// </summary>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="release">The release.</param>
        /// <returns>Iteration Collection</returns>
        public IterationCollection GetIterations(string tfsUrlPath, string projectName, string release)
        {
            Manager2 manager = new Manager2();

            return(manager.GetIterations(tfsUrlPath, projectName, release));
        }
        /// <summary>
        /// Gets the releases.
        /// </summary>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <returns>ReleaseVersion Collection</returns>
        public ReleaseVersionCollection GetReleases(string tfsUrlPath, string projectName)
        {
            Manager2 manager = new Manager2();

            return(manager.GetReleases(tfsUrlPath, projectName));
        }
        /// <summary>
        /// Gets the list of work items.
        /// </summary>
        /// <param name="tfsUrlPath">The TFS URL path.</param>
        /// <param name="projectName">Name of the project.</param>
        /// <param name="workItemIds">The work item ids.</param>
        /// <returns>ChildItem Collection</returns>
        public ChildItemCollection GetListOfWorkItems(string tfsUrlPath, string projectName, string[] workItemIds)
        {
            Manager2 manager = new Manager2();

            return(manager.GetListOfWorkItems(tfsUrlPath, projectName, workItemIds));
        }
		public DragDropBehavior(Manager2 manager)
		{
			IntPtr temp;
			manager.CreateBehavior(Manager2.DragDropConfigurationBehavior, Utilities.GetGuidFromType(typeof(DragDropBehavior)), out temp);
			NativePointer = temp;
		}
Exemple #14
0
 private void Awake()
 {
     Instance = this;
 }
Exemple #15
0
    private void Start()
    {
        speedup       = parameters.SpeedUp;
        hidden        = parameters.HiddenLayer;
        output        = parameters.output.ToString();
        afk           = parameters.afk;
        afkenable     = parameters.afk_kill;
        singafk       = parameters.singlelineafk;
        singafkenable = parameters.singlelineafkkill;
        invert        = parameters.Invert;
        // BestPrison stuff
        BestPrison camp = FindObjectOfType <BestPrison>();

        networkvisual = GameObject.Find("Network");
        if (networkvisual != null)
        {
            inputactivation    = GameObject.Find("InputText").GetComponent <Text>();
            hiddenactivation   = GameObject.Find("HiddenText").GetComponent <Text>();
            outputactivation   = GameObject.Find("OutputText").GetComponent <Text>();
            inputhiddenweight  = GameObject.Find("InputHiddenWeight").GetComponent <Text>();
            inputhiddenbias    = GameObject.Find("InputHiddenBias").GetComponent <Text>();
            hiddenoutputweight = GameObject.Find("HiddenOutputWeight").GetComponent <Text>();
            hiddenoutputbias   = GameObject.Find("HiddenOutputBias").GetComponent <Text>();
        }
        //load brain
        if (parameters.PlayMode.ToString() == "Load")
        {
            NetData  loadedBrain  = DataManager.LoadBrain(parameters.LoadIndex);
            int      inputNeuron  = loadedBrain.Input;
            int      hiddenNeuron = loadedBrain.Hidden;
            int      outputNeuron = loadedBrain.Output;
            R2Tensor ihWeight     = new R2Tensor(hiddenNeuron, inputNeuron, loadedBrain.ih_weight);
            R2Tensor ihBias       = new R2Tensor(hiddenNeuron, 1, loadedBrain.ih_bias);
            R2Tensor ohWeight     = new R2Tensor(outputNeuron, hiddenNeuron, loadedBrain.ho_weight);
            R2Tensor ohBias       = new R2Tensor(outputNeuron, 1, loadedBrain.ho_bias);
            brain = new NeuralNetwork(ihWeight, ihBias, ohWeight, ohBias, inputNeuron, hiddenNeuron, outputNeuron, loadedBrain.outputType);
        }
        else
        {
            int      inputNeuron  = bestbrain.Input;
            int      hiddenNeuron = bestbrain.Hidden;
            int      outputNeuron = bestbrain.Output;
            R2Tensor ihWeight     = new R2Tensor(hiddenNeuron, inputNeuron, bestbrain.ih_weight);
            R2Tensor ihBias       = new R2Tensor(hiddenNeuron, 1, bestbrain.ih_bias);
            R2Tensor ohWeight     = new R2Tensor(outputNeuron, hiddenNeuron, bestbrain.ho_weight);
            R2Tensor ohBias       = new R2Tensor(outputNeuron, 1, bestbrain.ho_bias);
            brain = new NeuralNetwork(ihWeight, ihBias, ohWeight, ohBias, inputNeuron, hiddenNeuron, outputNeuron, bestbrain.outputType);
        }

        if (networkvisual != null)
        {
            if (networkvisual.activeSelf)
            {
                inputhiddenweight.text  = PrintNeuron(brain.ih_weight);
                inputhiddenbias.text    = PrintNeuron(brain.ih_bias);
                hiddenoutputweight.text = PrintNeuron(brain.ho_weight);
                hiddenoutputbias.text   = PrintNeuron(brain.ho_bias);
            }
        }

        Manager2 manager = FindObjectOfType <Manager2>();

        max_v        = manager.max_v;
        acceleration = manager.acceleration;
        dampspeed    = manager.dampspeed;
        maxhealth    = parameters.maxhealth;
        inman        = FindObjectOfType <InputManager>();
        currhealth   = maxhealth;

        //Particles
        if (particleson)
        {
            part = Instantiate(particlesystem, Vector3.zero, Quaternion.identity, gameObject.transform).GetComponent <ParticleSystem>();
        }
    }
		public AutoScrollBehavior(Manager2 manager)
		{
			IntPtr temp;
			manager.CreateBehavior(Manager2.AutoScrollBehavior, Utilities.GetGuidFromType(typeof(AutoScrollBehavior)), out temp);
			NativePointer = temp;
		}
Exemple #17
0
 private void Start()
 {
     man = gameObject.GetComponent <Manager2>();
 }
        public ProjectCollection GetProjects(string tfsUrlPath)
        {
            Manager2 manager = new Manager2();

            return(manager.GetProjects(tfsUrlPath));
        }
Exemple #19
0
    private void Start()
    {
        speedup       = parameters.SpeedUp;
        hidden        = parameters.HiddenLayer;
        output        = parameters.output.ToString();
        afk           = parameters.afk;
        afkenable     = parameters.afk_kill;
        singafk       = parameters.singlelineafk;
        singafkenable = parameters.singlelineafkkill;
        invert        = parameters.Invert;
        // Holocaust stuff
        Holocaust camp = FindObjectOfType <Holocaust>();

        prisoner_number = number;
        number++;

        networkvisual = GameObject.Find("Network");
        if (networkvisual != null & prisoner_number == parameters.best_n - 1)
        {
            inputactivation    = GameObject.Find("InputText").GetComponent <Text>();
            hiddenactivation   = GameObject.Find("HiddenText").GetComponent <Text>();
            outputactivation   = GameObject.Find("OutputText").GetComponent <Text>();
            inputhiddenweight  = GameObject.Find("InputHiddenWeight").GetComponent <Text>();
            inputhiddenbias    = GameObject.Find("InputHiddenBias").GetComponent <Text>();
            hiddenoutputweight = GameObject.Find("HiddenOutputWeight").GetComponent <Text>();
            hiddenoutputbias   = GameObject.Find("HiddenOutputBias").GetComponent <Text>();
        }

        if (camp.generation > 1)
        {
            if (prisoner_number < parameters.best_n)
            {
                spren.color = new Color(0, 1, 0.2f);
                brain       = camp.best_networks[prisoner_number].Copy();
            }
            else
            {
                if (parameters.IncludePrevGen & camp.generation > 2 & prisoner_number < 2 * parameters.best_n)
                {
                    spren.color = new Color(0, 0.2f, 1);
                    Debug.Log(prisoner_number - parameters.best_n);
                    brain = camp.best_networks_prev[prisoner_number - parameters.best_n].Copy();
                }
                else
                {
                    if (parameters.BestStay & prisoner_number == 2 * parameters.best_n)
                    {
                        spren.color = new Color(1, 0.2f, 0.4f);
                        brain       = camp.bestBrain.Copy();
                    }
                    else
                    {
                        //Selection
                        int     index      = 0;
                        float[] scorearray = camp.score;
                        float   randnum    = Random.Range(0f, totalscore);
                        for (int i = 0; i < parameters.best_n; i++)
                        {
                            randnum -= scorearray[i];
                            if (randnum <= 0)
                            {
                                break;
                            }
                            index++;
                        }

                        //Mutation
                        brain = camp.best_networks[index].Copy();
                        brain.Mutate(parameters.chernobyl_rate, parameters.chernobyl_magnitude, parameters.clamping);
                        //Debug.Log(brain.ih_weight.tensor == test.ih_weight.tensor);
                    }
                }
            }
        }
        else
        {
            brain = new NeuralNetwork(FindObjectOfType <InputManager>().GetIn(), hidden, FindObjectOfType <InputManager>().GetOut(), output);
        }

        if (networkvisual != null)
        {
            if (networkvisual.activeSelf & prisoner_number == parameters.best_n - 1)
            {
                inputhiddenweight.text  = PrintNeuron(brain.ih_weight);
                inputhiddenbias.text    = PrintNeuron(brain.ih_bias);
                hiddenoutputweight.text = PrintNeuron(brain.ho_weight);
                hiddenoutputbias.text   = PrintNeuron(brain.ho_bias);
            }
        }

        Manager2 manager = FindObjectOfType <Manager2>();

        max_v        = manager.max_v;
        acceleration = manager.acceleration;
        dampspeed    = manager.dampspeed;
        maxhealth    = parameters.maxhealth;
        inman        = FindObjectOfType <InputManager>();
        currhealth   = maxhealth;

        //Particles
        if (particleson)
        {
            part = Instantiate(particlesystem, Vector3.zero, Quaternion.identity, gameObject.transform).GetComponent <ParticleSystem>();
        }
    }