示例#1
0
    public void Stop(MouseScript mouse)
    {
        if (!complete)
        {
            double   mouse_fitness  = mouse.GetGenotype_Fitness().GetFitness();
            double[] mouse_genotype = (double[])mouse.GetGenotype_Fitness().GetGenotype().Clone();

            genotype_fitness.Add(mouse.GetGenotype_Fitness().Clone());
            Destroy(mouse.gameObject);

            if (mouse_fitness > best_fitness)
            {
                new_best      = true;
                best_fitness  = mouse_fitness;
                best_genotype = mouse_genotype;
            }

            act_mouse++;
            if (act_mouse == pop_size)
            {
                act_mouse = 0;
                GA();
            }
        }
        else
        {
            Destroy(mouse.gameObject);
        }
    }
示例#2
0
    void Start()
    {
        sgltn         = UMSingleton.Initialize();
        log.OnGetLog += OnLogMessage;
        if (memberType == StartNetworkScript.MemberType.Server)
        {
            thread = new Thread(() => ServerListenMessage());
            cameraObj.transform.position = new Vector3(0, 30, -70);
            cameraObj.AddComponent <FreeMovement>();
            MouseScript ms = cameraObj.AddComponent <MouseScript>();
            ms.minimumVert = -90;
            ms.maximumVert = 90;
        }
        else if (memberType == StartNetworkScript.MemberType.Client)
        {
            thread = new Thread(() => ClientListenMessage());

            StartNetworkScript.um.Send(ToBinary(new BloMessage(MessageType.Connect, "First Network Test")));
        }
        else
        {
            cameraObj.transform.position = new Vector3(0, 30, -70);
            cameraObj.AddComponent <FreeMovement>();
            MouseScript ms = cameraObj.AddComponent <MouseScript>();
            ms.minimumVert = -90;
            ms.maximumVert = 90;
        }
        thread?.Start();
        log.Write("Start game as " + memberType.ToString());
        Debug.Log(memberType.ToString());
    }
示例#3
0
 public void Complete(MouseScript mouse)
 {
     complete = true;
     Debug.Log("Complete");
     best_genotype = (double[])mouse.GetGenotype_Fitness().GetGenotype().Clone();
     Destroy(mouse.gameObject);
     SpawnBestMouse();
 }
示例#4
0
文件: PauseMenu.cs 项目: Nitwoe/Nommy
	void Start() {
		Time.timeScale = 1;
		shadeSpriteRenderer = pauseFilter.GetComponent<SpriteRenderer> ();
		ms = this.gameObject.GetComponent<MouseScript>();
		Texture2D texture = new Texture2D (1, 1);
		texture.SetPixel (0, 0, shadeSpriteRenderer.color);
		Sprite sprite = Sprite.Create (texture, new Rect (0, 0, 2000, 2000), new Vector2 (0, 0));
		shadeSpriteRenderer.sprite = sprite;
		pauseFilter.renderer.enabled = false;
	}
示例#5
0
    void Start()
    {
        Time.timeScale      = 1;
        shadeSpriteRenderer = pauseFilter.GetComponent <SpriteRenderer> ();
        ms = this.gameObject.GetComponent <MouseScript>();
        Texture2D texture = new Texture2D(1, 1);

        texture.SetPixel(0, 0, shadeSpriteRenderer.color);
        Sprite sprite = Sprite.Create(texture, new Rect(0, 0, 2000, 2000), new Vector2(0, 0));

        shadeSpriteRenderer.sprite   = sprite;
        pauseFilter.renderer.enabled = false;
    }
示例#6
0
 public override void Selected()
 {
     MouseScript.AddToSelectionQ(gameObject);
     //MouseScript.selectionQ.Add(gameObject);
 }
示例#7
0
 public override void Selected()
 {
     //if a room is clicked, depopulate the selection Q (unselect selected officers)
     MouseScript.ClearSelectionQ();
 }
示例#8
0
 void Start()
 {
     mouseScript = GetComponent <MouseScript>();
 }
示例#9
0
 void Awake()
 {
     if( instance == null ){
         instance = this;
     }
 }
示例#10
0
 private void Awake()
 {
     instance = this;
 }