예제 #1
0
    IEnumerator SetWingmanCout(WingmanData data, int cout)
    {
        player = GameObject.FindWithTag("Player").transform;
        if (player == null)
        {
            Debug.LogError("player is null");
        }
        GameObject parent  = player.transform.Find("wingman").gameObject;
        float      nowCout = parent.transform.childCount;

        for (int i = 0; i < nowCout; i++)
        {
            GameObject child = parent.transform.GetChild(i).gameObject;
            GameObject.Destroy(child);
        }

        float tempTime = 2.0f / cout;

        for (int i = 0; i < cout; i++)
        {
            GameObject wingaman = GameObject.Instantiate(wingmanPrefab);

            wingaman.transform.SetParent(parent.transform, false);
            TweenPosition tp = wingaman.GetComponent <TweenPosition>();
            tp.tp = tp;
            //Sprite sprite = ResourcesManager.Instance.LoadWingmanSprite(data.spriteName);
            tp.PingPangOneStop += PingPangOneStep;
            tp.PingPangTwoStop += PingPangSecondStep;
            WingmanInfo info = wingaman.GetComponent <WingmanInfo>();
            info.SetBullet(data.bulletName);
            info.tempTime = data.tempTime;
            yield return(new WaitForSeconds(tempTime));
        }
    }
예제 #2
0
    void AddOneWingman(WingmanData data)
    {
        player = GameObject.FindWithTag("Player").transform;
        if (player == null)
        {
            Debug.LogError("player is null");
            return;
        }
        GameObject parent   = player.transform.Find("wingman").gameObject;
        GameObject wingaman = GameObject.Instantiate(wingmanPrefab);

        wingaman.transform.SetParent(parent.transform, false);
        TweenPosition tp = wingaman.GetComponent <TweenPosition>();

        tp.tp = tp;
        //Sprite sprite = ResourcesManager.Instance.LoadWingmanSprite(data.spriteName);
        tp.PingPangOneStop += PingPangOneStep;
        tp.PingPangTwoStop += PingPangSecondStep;
        WingmanInfo info = wingaman.GetComponent <WingmanInfo>();

        info.SetBullet(data.bulletName);
        info.tempTime = data.tempTime;
    }