コード例 #1
0
ファイル: SomeHead.cs プロジェクト: wertkh32/-somejam
    void GetAllGrannies()
    {
        allGrannies.Clear();
        foreach (GameObject grannyGroupObj in grannyGod.Grannies)
        {
            SomeGranny grannyGroup = grannyGroupObj.GetComponent <SomeGranny> ();

            foreach (GameObject granny in grannyGroup.Grannies)
            {
                allGrannies.Add(granny);
            }
        }
    }
コード例 #2
0
ファイル: SomeHead.cs プロジェクト: wertkh32/-somejam
    void StopAllGrannies(bool stop)
    {
        foreach (GameObject grannyGroupObj in grannyGod.Grannies)
        {
            SomeGranny grannyGroup = grannyGroupObj.GetComponent <SomeGranny> ();
            grannyGroup.start = !stop;

            foreach (GameObject granny in grannyGroup.Grannies)
            {
                granny.GetComponent <Animator> ().enabled = !stop;
                granny.GetComponent <Animator> ().speed   = 1.0f;
            }
        }
    }
コード例 #3
0
    GameObject SpawnGrannyGroup(int n)
    {
        GameObject grannyGroup = new GameObject(string.Format("grannyGroupOf{0}", n));

        grannyGroup.transform.parent = transform;

        SomeGranny g = grannyGroup.AddComponent <SomeGranny>();

        for (int i = 0; i < n; ++i)
        {
            GameObject newGranny = Instantiate <GameObject>(GrannyPrefab);
            newGranny.transform.parent = grannyGroup.transform;
            float leftMost = 0f - ((float)n - 1f) / 2f;
            newGranny.transform.localPosition = new Vector3(i * 1f + leftMost, 0, 0);
            g.Grannies.Add(newGranny);
        }
        return(grannyGroup);
    }