void InstantiateObject(Object prefab, Vector3 cameraPos, int number, float space)
    {
        Vector3[] positiones = RandomPositiones(cameraPos, number, space);
        for (int i = 0; i < number; i++) // 個数分繰り返す
        {
            // positionの演算
            Vector3 position = positiones[i];

            // 角度の算出
            float yRotation = Random.Range(-180f, 180f);

            // AR空間に生成
            var newObject = (GameObject)Instantiate(prefab, position, Quaternion.Euler(0, yRotation, 0));
            // 親にタグを登録
            newObject.tag = "Object";
            // 子にタグを登録
            List <GameObject> children = GetAllChildren.GetAll(newObject);
            foreach (GameObject obj in children)
            {
                obj.tag = "CH_Object";
            }
            // targetIndicatorを生成
            BuildTargetIndicator(newObject.transform);
        }

        UnityMessageManager.Instance.SendMessageToFlutter("next");
        fadeController.isFadeIn = true;
    }
Beispiel #2
0
    /// <summary>
    /// 最後の敵のオーラの色を変える
    /// </summary>
    private void EnemyAuraChange()
    {
        if (tag == "Boss")
        {
            return;
        }

        //全ての子オブジェクト取得
        List <GameObject> children = GetAllChildren.GetAll(gameObject);
        //エネミー用リスト
        List <GameObject> enemys = new List <GameObject>();

        //タグがEnemyの子オブジェクト用意したリストに追加
        foreach (GameObject c in children)
        {
            if (c.tag == "Enemy")
            {
                enemys.Add(c);
            }
        }

        enemys.RemoveAll(x => x == null);//空の要素削除
        //エネミーが一つしか残ってなかったらオーラの色変更
        if (enemys.Count == 1)
        {
            enemys[0].transform.Find("EnemyAura").GetComponent <SpriteRenderer>().material = greenAura;
            plusEffectPos = enemys[0].transform.position;
        }
    }
Beispiel #3
0
 //================================================================================================================
 // 常に更新し続ける処理(60FPSで固定)
 //================================================================================================================
 void FixedUpdate()
 {
     //-------------------------------------------------------
     // 引き合う時の処理
     if (moveFlg == true)
     {
         GameObject player = objects[0];
         Vector3    pos    = player.transform.position;
         Vector3    dis    = gorlPos - startPos;
         pos += (dis * Time.deltaTime) * velocity;
         //----------------------------------------------------
         // 一定の距離まで近づくまで動く
         if (Vector3.Distance(pos, gorlPos) >= 0.5f)
         {
             player.transform.position = pos;
         }
         else
         {
             ReactionStart();
             VibrationCamera.Instance.Vibration();
             List <GameObject> children1 = GetAllChildren.GetAll(player);
             //------------------------------------------------------
             // 親子関係にある敵だけ削除
             for (int num = 0; num < children1.Count; num++)
             {
                 if (children1[num].tag == "Enemy")
                 {
                     Destroy(children1[num]);
                 }
             }
         }
         velocity += speed / 100;
     }
 }
Beispiel #4
0
    void Start()
    {
        if (randomColor)
        {
            GetComponent <SpriteRenderer>().color = new Color(Random.Range(0, 0.5f), Random.Range(0, 0.5f), Random.Range(0, 0.5f), 1);
        }

        if (randomScale)
        {
            scale = Random.Range(0.5f, 3f);
            transform.localScale = new Vector3(scale, scale, scale);
            GetComponent <SpriteRenderer>().sortingOrder = (int)(-200 + (scale * 16)) + highOrder;
            if (highOrder != 0)
            {
                GameObject[] childs;
                childs = GetAllChildren.getChildren(gameObject);
                for (int i = 0; i < childs.Length; i++)
                {
                    childs[i].GetComponent <SpriteRenderer>().sortingOrder = (int)(-200 + (scale * 16)) + highOrder - 1 - i;
                }
            }
        }

        if (randomRot)
        {
            Quaternion rotation = Quaternion.Euler(0, 0, Random.Range(0, 360f));
            transform.rotation = rotation;
        }
    }
Beispiel #5
0
    public void SwitchRagdoll(bool newVal)
    {
        myAnimator.enabled = !newVal;

        var child = GetAllChildren.GetAll(rootBone);

        foreach (GameObject obj in child)
        {
            if (obj.GetComponent <Rigidbody>())
            {
                obj.GetComponent <Rigidbody>().isKinematic = !newVal;
            }
            if (obj.GetComponent <BoxCollider>())
            {
                obj.GetComponent <BoxCollider>().enabled = newVal;
            }
            if (obj.GetComponent <CapsuleCollider>())
            {
                obj.GetComponent <CapsuleCollider>().enabled = newVal;
            }
            if (obj.GetComponent <SphereCollider>())
            {
                obj.GetComponent <SphereCollider>().enabled = newVal;
            }
        }
    }
Beispiel #6
0
 void Start()
 {
     wave.SetActive(false);
     curDial = 0;
     dangerZone.SetActive(true);
     numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length;
     ContinuePlot();
 }
Beispiel #7
0
    void Awake()
    {
        var children = GetAllChildren.GetAll(gameObject);

        foreach (var child in children)
        {
            AddGrabAble(child, true);
        }
    }
Beispiel #8
0
    IEnumerator Waiter()
    {
        yield return(new WaitForSeconds(3));

        WaveInt.GetComponent <Text>().text = "" + (curWave + 1);
        audioSource = GetComponent <AudioSource>();
        waves       = GetAllChildren.getChildren(gameObject, false, "Wave");
        waves[curWave].SetActive(true);
        timer = 5;
    }
Beispiel #9
0
 public void Reduce()
 {
     numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length - 1;
     if (numOfObjs <= 0)
     {
         DestroyMeteors();
         venue.gameObject.SendMessage("HideMe", 0);
         venue.NextWave();
         Destroy(gameObject);
     }
 }
Beispiel #10
0
 void Update()
 {
     if (allowAnti)
     {
         numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length;
         timer    -= Time.deltaTime * 1;
         if (timer < 0)
         {
             Check();
             timer = 5;
         }
     }
 }
Beispiel #11
0
 public void ContinuePlot()
 {
     if (curDial <= boxes.Length - 1)
     {
         venue.CastEvent((int)boxes[curDial].who, boxes[curDial].text, boxes[curDial].specEvent, this);
         curDial++;
     }
     else
     {
         venue.RemoveEvent();
         dangerZone.SetActive(false);
         wave.SetActive(true);
         numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length;
     }
 }
Beispiel #12
0
    /// <summary>
    /// LifeMeterの移動
    /// </summary>
    private void LifeMeterMove()
    {
        var CurrentEnenmyCount = GetAllChildren.GetAll(mainClass.enemyWave[0]).Count;
        //for (int i = 0; i < EnemyS.Length; i++)
        //{
        //    if (EnemyS[i] != null)
        //        CurrentEnenmyCount += EnemyS[i].transform.childCount;
        //}

        var ACPO = transform.parent.GetComponent <RectTransform>().anchoredPosition;

        if ((EnemyCount > CurrentEnenmyCount || Player.isDamage || Main.waveNum > 0) && ACPO.x < 150)
        {
            transform.parent.GetComponent <RectTransform>().anchoredPosition += new Vector2(1, 0) * MeterMoveSpeed;
        }
    }
Beispiel #13
0
 public void ContinuePlot()
 {
     if (curDial <= boxes.Length - 1)
     {
         venue.CastEvent((int)boxes[curDial].who, boxes[curDial].text, boxes[curDial].specEvent, this);
         curDial++;
     }
     else
     {
         dangerZone.SetActive(false);
         venue.RemoveEvent();
         wave.SetActive(true);
         venue.gameObject.SendMessage("CallMe", 0);
         numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length;
         allowAnti = true;
     }
 }
Beispiel #14
0
    // Use this for initializatio
    void Start()
    {
        //rt = GetComponent<RectTransform>();//RectTransformを取得
        //iniSize = rt.sizeDelta;

        main      = GameObject.Find("MainManager");//playerオブジェクトを取得
        mainClass = main.GetComponent <Main>();
        //speed = Mathf.Abs(player.speed) / player.speedLimit;

        needleposition = GameObject.Find("NeedlePosition");

        EnemyCount = GetAllChildren.GetAll(mainClass.enemyWave[0]).Count;

        //EnemyS = GameObject.FindGameObjectsWithTag("EnemyManager");
        //for (int i = 0; i < EnemyS.Length; i++)
        //    EnemyCount += EnemyS[i].transform.childCount;
    }
Beispiel #15
0
    /// <summary>
    /// 時間経過開始
    /// </summary>
    private void TimeStart()
    {
        //子オブジェクトが減ったら
        if (GetAllChildren.GetAll(gameObject).Count < iniChildCnt && !IsTimeStart)
        {
            EnemysActive();
            //ボスバトル時間の減少を始める
            main.GetComponent <Main>().SetIsLifeTime(true);
            IsTimeStart = true;

            if (gameObject.tag != "Boss" && IsLine == true)
            {
                enemyLine.GetComponent <EnemyLine>().GetComponent <LineRenderer>().material = Line;
                IsLine = false;
            }
        }
    }
        private void Button1_Click(object sender, RoutedEventArgs e)
        {
            switch (Button1.Content.ToString())
            {
            case "Show all nannies":
                GetAllNannies.Clear();
                foreach (var item in BL.GetAllNannys())
                {
                    GetAllNannies.Add(item);
                }
                CleanGrid();
                ShowAllNanniesListView.Visibility = Visibility.Visible;
                break;

            case "Show all children":
                GetAllChildren.Clear();
                foreach (var item in BL.GetAllChildren())
                {
                    GetAllChildren.Add(item);
                }
                CleanGrid();
                ShowAllChildrenListView.Visibility = Visibility.Visible;
                break;

            case "Show all mothers":
                GetAllMothers.Clear();
                foreach (var item in BL.GetAllMothers())
                {
                    GetAllMothers.Add(item);
                }
                CleanGrid();
                ShowAllMothersListView.Visibility = Visibility.Visible;
                break;

            case "Show all contracts":
                GetAllContracts.Clear();
                foreach (var item in BL.GetAllContracts())
                {
                    GetAllContracts.Add(item);
                }
                CleanGrid();
                ShowAllContractsListView.Visibility = Visibility.Visible;
                break;
            }
        }
Beispiel #17
0
        void Start()
        {
            var health = GetComponent <PlayerHealth>();

            cloudPoint = GetComponent <PlayerCloudPoint>();

            playerMeshList = GetAllChildren.GetAll(this.gameObject)
                             .Select(x => x.GetComponent <SkinnedMeshRenderer>())
                             .Where(x => x != null)
                             .ToList();

            health.ReceiveDamageObservable
            .Subscribe(_ => Flash(health.InvincibleTime));

            cloudPoint.IsRecovering
            .Where(x => x)
            .Subscribe(_ => Charge());
        }
    public void Init(float changing, float Delay, bool minus)
    {
        List <GameObject> list = GetAllChildren.GetAll(gameObject);

        list.Add(gameObject);
        rends        = list.Select(x => x.GetComponent <CanvasRenderer>()).Where(r => r != null).ToList();
        alphas       = rends.Select(item => item.GetAlpha() / changing).ToList();
        ChangingTime = changing;
        DelayTime    = Delay;
        MinusColor   = minus;
        if (MinusColor)
        {
            ColorDirection = -1;
        }
        else
        {
            ColorDirection = 1;
            rends.ForEach(r => r.SetAlpha(0));
        }
        Timer = 0;
    }
Beispiel #19
0
    // Use this for initialization
    void Start()
    {
        box = core.GetComponent <BoxCollider2D>();   //BoxCollider2D取得

        animator = shield.GetComponent <Animator>(); //Animator取得

        childEnemy = GetAllChildren.GetAll(gameObject);

        //敵の種類によってコンポーネントのアクティブを切る
        foreach (var e in childEnemy)
        {
            if (e.GetComponent <Turtroial_Move>() != null)
            {
                e.GetComponent <Turtroial_Move>().enabled = false;
                KeyEnemy.Add(e);
            }

            if (e.GetComponent <BoxCollider2D>() != null)
            {
                e.GetComponent <BoxCollider2D>().enabled = false;
            }
            if (e.GetComponent <Laser>() != null)
            {
                e.GetComponent <SpriteRenderer>().enabled = false;
            }
            if (e.gameObject.tag == "BeemEnd")
            {
                e.GetComponent <SpriteRenderer>().enabled = false;
            }
        }
        isBossStop = false;

        animator  = shield.GetComponent <Animator>();
        animation = GetComponent <Animation>();
        shield.GetComponent <CircleCollider2D>().enabled = false;

        isColActive = false;
        isActive    = false;
        isSE        = false;
    }
Beispiel #20
0
    // Use this for initialization
    void Start()
    {
        camera = GameObject.Find("Main Camera"); //カメラオブジェクト取得
        main   = GameObject.Find("MainManager"); //メインオブジェクト取得

        //ボスじゃなければランクの表示座標設定
        if (tag != "Boss")
        {
            rankPoint = transform.FindChild("EnemyLine").gameObject;
            spawmPos  = rankPoint.transform.position;
        }
        plusEffectPos = Vector3.zero;

        LimitTime   = addLifeTime * 60;
        CurrentTime = LimitTime;
        damage      = GameObject.Find("Player").GetComponent <Player>().damage;
        iniChildCnt = GetAllChildren.GetAll(gameObject).Count;//全ての子オブジェクトの数取得

        IsTimeStart    = false;
        isChildDestroy = false;
        IsLine         = true;
    }
Beispiel #21
0
    private void SetWeapons()
    {
        _weaponList = new List <GameObject> ();

        List <GameObject> childList = GetAllChildren.GetAll(gameObject);

        foreach (GameObject obj in childList)
        {
            //child is your child transform

            //Make sure the target has components
            var hasEnemyWeapon = obj.GetComponent <EnemyWeapon> ();

            //If have a component
            if (hasEnemyWeapon != null)
            {
                _weaponList.Add(obj);
            }
        }

        childList.Clear();
    }
Beispiel #22
0
    //所持している武器の取得
    private void SetWeapons()
    {
        //武器リスト作成
        _weaponList = new List <GameObject> ();
        //子オブジェクトのリスト作成
        List <GameObject> childList = GetAllChildren.GetAll(gameObject);

        foreach (GameObject obj in childList)
        {
            //EnemyWeaponのコンポーネントを持っているか
            //Make sure the target has components
            var hasEnemyWeapon = obj.GetComponent <EnemyWeapon> ();

            //コンポーネントを持っている場合
            //If have a component
            if (hasEnemyWeapon != null)
            {
                //武器リストにオブジェクトを登録する
                _weaponList.Add(obj);
            }
        }
        //子オブジェクトのリストをクリア
        childList.Clear();
    }
Beispiel #23
0
        /// <summary>
        /// Spring系コンポーネントを削除する
        /// </summary>
        private static void RemoveSpringComponents(GameObject obj)
        {
            // 指定オブジェクトのルート取得
            var root = obj.GetRoot();

            // root下の全オブジェクトを取得
            GameObject[] objs = GameObjectExtensions.GetChildren(root);

            // DynamicBoneを削除
            objs.Select(a => a.GetComponent <DynamicBone>()).Where(a => a != null).ToList().ForEach(Undo.DestroyObjectImmediate);
            // DynamicBoneColliderを削除

            // RootObjの子をすべて探索し格納
            List <GameObject> rootObjList = GetAllChildren.GetAll(root);

            // コピー先を探索しDynamicBoneColliderがあったら参照
            foreach (GameObject child in rootObjList)
            {
                if (child.GetComponent <DynamicBoneCollider>())
                {
                    Undo.DestroyObjectImmediate(child);
                }
            }
        }
Beispiel #24
0
 void Start()
 {
     audioSource = GetComponent <AudioSource>();
     waves       = GetAllChildren.getChildren(gameObject, false, "Wave");
     waves[curWave].SetActive(true);
 }
Beispiel #25
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Alpha1))
        {
            cube.SetActive(!cube.activeSelf);
            if (cube.activeSelf)
            {
                active3DModel = cube;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha2))
        {
            regSqPyramid.SetActive(!regSqPyramid.activeSelf);
            if (regSqPyramid.activeSelf)
            {
                active3DModel = regSqPyramid;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha3))
        {
            regTriPyramid.SetActive(!regTriPyramid.activeSelf);
            if (regTriPyramid.activeSelf)
            {
                active3DModel = regTriPyramid;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha4))
        {
            cone.SetActive(!cone.activeSelf);
            if (cone.activeSelf)
            {
                active3DModel = cone;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha5))
        {
            cylinder.SetActive(!cylinder.activeSelf);
            if (cylinder.activeSelf)
            {
                active3DModel = cylinder;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha6))
        {
            rectangular.SetActive(!rectangular.activeSelf);
            if (rectangular.activeSelf)
            {
                active3DModel = rectangular;
            }
        }
        else if (Input.GetKeyDown(KeyCode.Alpha7))
        {
            sphere.SetActive(!sphere.activeSelf);
            if (sphere.activeSelf)
            {
                active3DModel = sphere;
            }
        }


        if (Input.GetKeyDown(KeyCode.C))
        {
            characterUI = active3DModel.transform.Find("CharUI").gameObject;
            characterUI.SetActive(!characterUI.activeSelf);
        }


        if (Input.GetKeyDown(KeyCode.V))
        {
            points = active3DModel.transform.Find("points").gameObject;
            points.SetActive(!points.activeSelf);
        }


        //カメラの方向を向かせる
        if (characterUI.activeSelf)
        {
            List <GameObject> childList = GetAllChildren.GetAll(characterUI);
            foreach (GameObject obj in childList)
            {
                obj.transform.LookAt(MainCameraDummy.transform.position);
            }
        }



        if (Input.GetKeyDown(KeyCode.W))
        {
            CanvasForWipe.SetActive(!CanvasForWipe.activeSelf);
        }


        if (Input.GetKeyDown(KeyCode.G))
        {
            GuideText.SetActive(!GuideText.activeSelf);
        }
    }//Update()
Beispiel #26
0
 public void Reduce()
 {
     numOfObjs = GetAllChildren.getChildren(wave, false, "Enemy").Length - 1;
     Check();
 }
Beispiel #27
0
 void Start()
 {
     list1 = GetAllChildren.GetAll(gameObject);
     list2 = GetAllChildren.GetAll(unity_chan2);
 }
 void GetChildren()
 {
     m_candleSpawner = GetAllChildren.GetAll(gameObject);
 }
Beispiel #29
0
 // Use this for initialization
 void Start()
 {
     backList = GetAllChildren.GetAll(gameObject);
 }
Beispiel #30
0
        // objのコンポーネント情報をtargetに追加する
        private static DynamicBone AddBoneComponent(GameObject obj, GameObject[] objs, GameObject target)
        {
            // コピー先に子がいない場合は抜ける
            if (!target.HasChild())
            {
                return(null);
            }

            // コピー元
            var fromBone = obj.GetComponent <DynamicBone>();

            // コピー先
            var toBone = target.AddComponent <DynamicBone>();

            // ルートObject
            var rootObj = target.GetRoot();

            /*** DynamicBone Parameters ***/

            // Rootを設定
            toBone.m_Root = target.gameObject.transform;
            // UpdateRateを設定
            toBone.m_UpdateRate = fromBone.m_UpdateRate;
            // UpdateModeを設定
            toBone.m_UpdateMode = fromBone.m_UpdateMode;
            // Dampingを設定
            toBone.m_Damping        = fromBone.m_Damping;
            toBone.m_DampingDistrib = fromBone.m_DampingDistrib;
            // Elasticityを設定
            toBone.m_Elasticity        = fromBone.m_Elasticity;
            toBone.m_ElasticityDistrib = fromBone.m_ElasticityDistrib;
            // Stiffnessを設定
            toBone.m_Stiffness        = fromBone.m_Stiffness;
            toBone.m_StiffnessDistrib = fromBone.m_StiffnessDistrib;
            // RadiusDistribを設定
            toBone.m_Radius        = fromBone.m_Radius;
            toBone.m_RadiusDistrib = fromBone.m_RadiusDistrib;
            // EndLenghを設定
            toBone.m_EndLength = fromBone.m_EndLength;
            // EndOffset,Gravity,Forceを設定
            toBone.m_EndOffset = fromBone.m_EndOffset;
            toBone.m_Gravity   = fromBone.m_Gravity;
            toBone.m_Force     = fromBone.m_Force;
            // Collidersを設定
            toBone.m_Colliders = new List <DynamicBoneColliderBase>();

            // RootObjの子をすべて探索し格納
            List <GameObject> rootObjList = GetAllChildren.GetAll(rootObj);

            // コピー先を探索しDynamicBoneColliderがあったら参照
            foreach (var collider in fromBone.m_Colliders)
            {
                //var dynamicBoneCollider = rootObj.transform.Find(collider.gameObject.name).GetComponent<DynamicBoneCollider>();
                foreach (GameObject child in rootObjList)
                {
                    if (child.name == collider.gameObject.name)
                    {
                        toBone.m_Colliders.Add(child.GetComponent <DynamicBoneCollider>());
                    }
                }
            }
            // Exclusionsを設定
            toBone.m_Exclusions = new List <Transform>();
            foreach (var exclusion in fromBone.m_Exclusions)
            {
                toBone.m_Exclusions.Add(exclusion);
            }
            // FreezeAxisを設定
            toBone.m_FreezeAxis = fromBone.m_FreezeAxis;
            // DistantDisableを設定
            toBone.m_DistantDisable = fromBone.m_DistantDisable;
            // ReferenceObjectを設定
            toBone.m_ReferenceObject = fromBone.m_ReferenceObject;
            // DistanceToObjectを設定
            toBone.m_DistanceToObject = fromBone.m_DistanceToObject;

            return(toBone);
        }