コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        //Debug.Log("I am a control panel");
        GameObject controlPanel = GameObject.Instantiate(Resources.Load("ControlPanelPrefab", typeof(GameObject))) as GameObject;

        //Button myBtn =
        //controlPanel.transform.parent = gameObject.transform;


        //Canvas canvas = controlPanel.GetComponent<Canvas>();
        //Button reproductionButton = controlPanel.GetComponent<Button>();

        //Debug.Log(reproductionButton.ToString());
        //reproductionButton.onClick.AddListener(LifeformReproduction);
        //controlPanel = GameObject.Instantiate(controlPanelPrefab);

        lifeFormExec = gameObject.GetComponent <LifeFormExec>();
        lifeFormExec.AddEnergy(750);
    }
コード例 #2
0
ファイル: Reproduction.cs プロジェクト: gabesf/Simvolution
    public static void Reproduce(GameObject oLifeForm)
    {
        //Debug.Break();

        counter++;
        GameObject lifeForm = new GameObject("newLife" + counter);

        LifeFormExec lifeFormExec = lifeForm.AddComponent <LifeFormExec>();

        lifeFormExec.SetGeneticCode(DuplicateGeneticCode(oLifeForm.GetComponent <LifeFormExec>().GetGeneticCode()));

        //if(counter >= 0)
        //{
        //    lifeFormExec.reproduced = true;
        //}

        lifeForm.transform.position = oLifeForm.transform.position;
        //lifeForm.transform.position = new Vector3(3*counter, 2, 0);
    }
コード例 #3
0
 public void SetLifeFormExec(LifeFormExec _lifeFormExec)
 {
     lifeFormExec = _lifeFormExec;
 }