Example #1
0
 public void SetPopEnemyNotification(EnemyUnitBase _enemy_unit)
 {
     if (null == enemy_unit_list)
     {
         return;
     }
     enemy_unit_list.Add(_enemy_unit);
 }
Example #2
0
    private void born_next_enemy()
    {
        var           _reserve_data = reserve_pop_list[0];
        PopObjectType _type         = _reserve_data.type;

        if (false == prefab_data_dic.ContainsKey(_type))
        {
            return;
        }
        GameObject _prefab = null;

        prefab_data_dic.TryGetValue(_type, out _prefab);

        GameObject _pop_text = GameObject.Instantiate(
            _prefab, transform.position, transform.rotation);

        // TODO Prefabの出現時のステータス設定。どこかに分離したい
        _pop_text.transform.SetParent(parent.transform, false);
        Vector2 pop_pos = new Vector2(
            UnityEngine.Random.Range(play_area_pos_x_min + 10, play_area_pos_x_max),
            UnityEngine.Random.Range(play_area_pos_y_min + 10, play_area_pos_y_max));

        _pop_text.transform.localPosition = pop_pos;
        _pop_text.transform.localRotation = Quaternion.Euler(0, 0, UnityEngine.Random.Range(0, 360));
        reserve_pop_list.Remove(_reserve_data);

        EnemyUnitBase _unit_base = _pop_text.GetComponent <EnemyUnitBase>();

        if (null == _unit_base)
        {
            Debug.Util.LogError("EnemyUniteBase is null");
        }

        Text _text = _pop_text.GetComponent <Text>();

        _text.text = _reserve_data.word;
        _unit_base.Init(_text.text.ToString());

        BoxCollider2D collider = _pop_text.GetComponent <BoxCollider2D>();

        collider.size = new Vector2(_reserve_data.word.ToString().Length * 25, 60);

        UnitManagerSystem.Instance.SetPopEnemyNotification(_unit_base);
    }