Exemplo n.º 1
0
    private void create_oni_group(Vector3 appear_position, float speed, OniGroupControl.TYPE type)
    {
        Vector3 position = appear_position;

        GameObject      go        = GameObject.Instantiate(this.OniGroupPrefab) as GameObject;
        OniGroupControl new_group = go.GetComponent <OniGroupControl>();

        position.y = OniGroupControl.collision_size / 2.0f;
        position.z = 0.0f;

        new_group.transform.position = position;

        new_group.scene_control = this.scene_control;
        new_group.main_camera   = this.scene_control.main_camera;
        new_group.player        = this.player;
        new_group.run_speed     = speed;
        new_group.type          = type;

        Vector3 base_position = position;
        int     oni_num       = this.oni_appear_num;

        base_position.x -= (OniGroupControl.collision_size / 2.0f - OniControl.collision_size / 2.0f);
        base_position.y  = OniControl.collision_size / 2.0f;

        new_group.CreateOnis(oni_num, base_position);
    }
Exemplo n.º 2
0
    // -------------------------------------------------------------------------------- //

    // オニのグループを発生させる.
    private void create_oni_group(Vector3 appear_position, float speed, OniGroupControl.TYPE type)
    {
        // -------------------------------------------------------- //
        // グループ全体のコリジョン(当たり判定)を生成する.

        Vector3 position = appear_position;

        // OniGroupPrefab のインスタンスを生成します.
        // "as GameObject" を末尾につけると、生成されたオブジェクトは
        // GameObject オブジェクトになります.
        //
        GameObject go = GameObject.Instantiate(this.OniGroupPrefab) as GameObject;

        OniGroupControl new_group = go.GetComponent <OniGroupControl>();

        // 地面に接する高さ.
        position.y = OniGroupControl.collision_size / 2.0f;

        position.z = 0.0f;

        new_group.transform.position = position;

        new_group.scene_control = this.scene_control;
        new_group.main_camera   = this.scene_control.main_camera;
        new_group.player        = this.player;
        new_group.run_speed     = speed;
        new_group.type          = type;

        // -------------------------------------------------------- //
        // グループに属するオニの集団を生成する.

        Vector3 base_position = position;

        int oni_num = this.oni_appear_num;

        // コリジョンボックスの左端によせる.
        base_position.x -= (OniGroupControl.collision_size / 2.0f - OniControl.collision_size / 2.0f);

        // 地面に接する高さ.
        base_position.y = OniControl.collision_size / 2.0f;

        // オニを発生させる.
        new_group.CreateOnis(oni_num, base_position);
    }
Exemplo n.º 3
0
    // -------------------------------------------------------------------------------- //

    // 生成怪物分组
    private void create_oni_group(Vector3 appear_position, float speed, OniGroupControl.TYPE type)
    {
        // -------------------------------------------------------- //
        // 生成分组整体的碰撞器(用于碰撞检测)

        Vector3 position = appear_position;

        // 生成 OniGroupPrefab 实例
        // 加上 "as GameObject" 表示将生成的对象转化为 GameObject
        //
        GameObject go = GameObject.Instantiate(this.OniGroupPrefab) as GameObject;

        OniGroupControl new_group = go.GetComponent <OniGroupControl>();

        // 和地面接触的高度
        position.y = OniGroupControl.collision_size / 2.0f;

        position.z = 0.0f;

        new_group.transform.position = position;

        new_group.scene_control = this.scene_control;
        new_group.main_camera   = this.scene_control.main_camera;
        new_group.player        = this.player;
        new_group.run_speed     = speed;
        new_group.type          = type;

        // -------------------------------------------------------- //
        // 生成分组的怪物集合

        Vector3 base_position = position;

        int oni_num = this.oni_appear_num;

        // 靠近碰撞盒的左端
        base_position.x -= (OniGroupControl.collision_size / 2.0f - OniControl.collision_size / 2.0f);

        // 和地面接触的高度
        base_position.y = OniControl.collision_size / 2.0f;

        // 生成怪物
        new_group.CreateOnis(oni_num, base_position);
    }