예제 #1
0
    /// <summary>
    /// 魚生成
    /// </summary>
    public Fish CreateFish(Fish.Loader fishLoader, Master.FishData fishMaster, Fish.ID id)
    {
        //魚(外側)生成
        var fish = Instantiate(this.fishPrefab, this.fishArea, false);
        //IDセット
        fish.id = id;
        //マスターセット
        fish.SetMaster(fishMaster);
        //モデルアタッチ
        fish.SetModel(fishLoader);

        if (this.fishColliderPrefab != null)
        {
            //魚当たり判定用コライダ生成
            var collider = Instantiate(this.fishColliderPrefab, this.fishColliderArea, false);
            //コライダアタッチ
            fish.SetCollider(collider, fishLoader.colliderData);
        }

        //破棄時コールバック設定
        fish.onDestroy += this.OnDestroyFish;

        this.fishList.Add(fish);

        //魚を生成したことを通知
        (SceneChanger.currentScene as BattleSceneBase)?.OnCreateFish(fish);

        return fish;
    }
예제 #2
0
    /// <summary>
    /// construct
    /// </summary>
    public FishWaveDataController(Fish.ID id, FishWaveData master, float delay)
    {
        this.id = id;
        this.master = master;
        this.delay = delay;

        for (int i = 0; i < master.formationDatas.Count; i++)
        {
            this.id.formationId = (byte)i;

            var controller = new FormationDataController(
                id: this.id,
                master: this.master.formationDatas[i].data,
                delay: this.master.formationDatas[i].delay
            );
            controller.onFinished = this.OnFinishedFormation;

            this.formationDataControllers.Add(controller);
            this.loader.AddRange(controller.loader);
        }
    }
    /// <summary>
    /// construct
    /// </summary>
    public FormationDataController(Fish.ID id, FishFormationData master, float delay)
    {
        this.id = id;
        this.master = master;
        this.delay = delay;
        this.eventDataController = new FormationEventDataController(this.master.eventDatas, this);

        for (int i = 0; i < this.master.routeDatas.Count; i++)
        {
            this.id.routeId = (byte)i;

            var controller = new FishRouteDataController(
                id: this.id,
                master: this.master.routeDatas[i].data,
                delay: this.master.routeDatas[i].delay
            );
            controller.onFinished = this.OnFinishedRoute;

            this.routeDataControllers.Add(controller);
            this.loader.AddRange(controller.loader);
        }
    }