Ejemplo n.º 1
0
	public static EffectRoot	getInstance()
	{
		if(EffectRoot.instance == null) {

			EffectRoot.instance = GameObject.Find("Effect Root").GetComponent<EffectRoot>();
		}

		return(EffectRoot.instance);
	}
Ejemplo n.º 2
0
 public static EffectRoot        get()
 {
     return(EffectRoot.getInstance());
 }
Ejemplo n.º 3
0
    public override void    execute()
    {
        CameraModule camera_module = CameraControl.get().getModule();

        float ougi_pos_y0 = -3.2f;
        float ougi_pos_y1 = 0.0f;

        // ---------------------------------------------------------------- //
        // 다음 상태로 이동할지 체크.

        switch (this.step.do_transition())
        {
        case STEP.START:
        {
        }
        break;

        // "!" 말풍선.
        case STEP.BIKKURI:
        {
            if (this.step.get_time() > 1.0f)
            {
                this.sprite_bikkuri.setVisible(false);
                this.step.set_next(STEP.TURN_AND_RISE);
            }
        }
        break;

        // 빙글 돌아 모션 재생.
        case STEP.TURN_AND_RISE:
        {
            if (this.step.get_time() > 2.0f)
            {
                this.step.set_next(STEP.STICK_THROW);
            }
        }
        break;

        // 아이스 스틱을 던진다.
        case STEP.STICK_THROW:
        {
            if (this.player.control.getMotionCurrentTime() > 0.3f)
            {
                this.step.set_next(STEP.STICK_FLYING);
            }
        }
        break;

        // 아이스 스틱이 날라온다.
        case STEP.STICK_FLYING:
        {
            if (!this.ice_fcurve.isMoving())
            {
                ItemWindow.get().setItem(Item.SLOT_TYPE.MISC, this.slot_index, this.item_favor);

                this.player.item_slot.miscs[this.slot_index].is_using = false;

                this.step.set_next(STEP.END);
            }
        }
        break;

        case STEP.END:
        {
            this.step.set_next(STEP.IDLE);
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.START:
            {
                Vector3 player_position = this.player.control.getPosition();

                // -------------------------------------------------------- //
                // 카메라.

                CameraControl.get().beginOuterControll();
                camera_module.pushPosture();

                this.cam_posture0           = camera_module.getPosture();
                this.cam_posture1.position  = player_position + new Vector3(0.0f, 5.3f, -3.5f);
                this.cam_posture1.intererst = player_position + Vector3.forward * 2.0f;
                this.cam_posture1.up        = Vector3.up;

                this.camera_fcurve.setSlopeAngle(70.0f, 5.0f);
                this.camera_fcurve.setDuration(0.5f);
                this.camera_fcurve.start();

                // 플레이어.
                this.player.beginOuterControll();
                this.player.GetComponent <Rigidbody>().Sleep();

                // 피라미 적 캐릭터의 움직임을  멈춘다.
                LevelControl.get().beginStillEnemies();

                //
                this.step.set_next_delay(STEP.BIKKURI, 1.0f);
            }
            break;

            // "!" 말풍선.
            case STEP.BIKKURI:
            {
                this.bikkuri_spring.k      = 750.0f;
                this.bikkuri_spring.reduce = 0.77f;
                this.bikkuri_spring.start(-2.75f);

                this.sprite_bikkuri.setVisible(true);
            }
            break;

            // 빙글 돌아 모션 재생.
            case STEP.TURN_AND_RISE:
            {
                // 뒤의 부채.

                this.ougi_position   = this.player.control.getPosition() + Vector3.forward * 1.0f;
                this.ougi_position.y = ougi_pos_y0;

                this.ougi = EffectRoot.get().createAtariOugi(this.ougi_position);

                this.ougi_fcurve.setSlopeAngle(70.0f, 5.0f);
                this.ougi_fcurve.setDuration(0.5f);
                this.ougi_fcurve.start();

                // 플레이어.
                if (this.player_weapon != null)
                {
                    this.player_weapon.SetActive(false);
                }
                this.player.control.cmdSetMotion("m004_use", 1);

                // 아이스바 모델.
                this.ice_bar.SetActive(true);

                // 종을 울림.
                SoundManager.getInstance().playSE(Sound.ID.DDG_JINGLE04);

                // 플레이어 가까이 있는 적을 지운다.
                this.hide_enemies = LevelControl.get().getRoomEnemiesInRange(null, this.player.getPosition(), 2.0f);

                foreach (var enemy in this.hide_enemies)
                {
                    enemy.damage_effect.startFadeOut(0.1f);
                }
            }
            break;

            // 아이스 스틱을 던진다.
            case STEP.STICK_THROW:
            {
                // 플레이어.
                this.player.control.cmdSetMotion("m003_attack", 1);
            }
            break;

            // 아이스 스틱이 날라온다.
            case STEP.STICK_FLYING:
            {
                this.cam_posture1 = camera_module.getPosture();

                this.camera_fcurve.setSlopeAngle(10.0f, 5.0f);
                this.camera_fcurve.setDuration(1.0f);
                this.camera_fcurve.start();

                // 당첨 말풍선.
                this.atari_fcurve.setSlopeAngle(50.0f, 30.0f);
                this.atari_fcurve.setDuration(0.5f);
                this.atari_fcurve.start();

                // 뒤 부채.
                this.ougi_fcurve.setSlopeAngle(70.0f, 5.0f);
                this.ougi_fcurve.setDuration(1.0f);
                this.ougi_fcurve.start();

                // 아이스.
                this.ice_fcurve.setSlopeAngle(60.0f, 20.0f);
                this.ice_fcurve.setDuration(1.0f);
                this.ice_fcurve.start();

                this.sprite_ice_bar.setVisible(true);

                // 플레이어가 가진 아이스바(당첨).
                this.ice_bar.gameObject.destroy();
            }
            break;

            case STEP.END:
            {
                GameObject.Destroy(this.ice_bar);

                if (this.player_weapon != null)
                {
                    this.player_weapon.SetActive(true);
                }
                this.player.GetComponent <Rigidbody>().WakeUp();
                this.player.endOuterControll();

                this.sprite_bikkuri.destroy();
                this.sprite_atari.destroy();
                this.sprite_ice_bar.destroy();

                this.ougi.destroy();

                camera_module.popPosture();
                CameraControl.get().endOuterControll();

                // 피래미 적 캐릭터의 움직임을 재개한다.
                LevelControl.get().endStillEnemies(null, 2.0f);

                foreach (var enemy in this.hide_enemies)
                {
                    enemy.damage_effect.startFadeIn(0.5f);
                }
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        // "!" 말풍선.
        case STEP.BIKKURI:
        {
            this.bikkuri_spring.execute(Time.deltaTime);

            Vector2 position = new Vector2(0.0f, 80.0f);

            position += Vector2.up * 8.0f * this.bikkuri_spring.position;

            this.sprite_bikkuri.setPosition(position);
        }
        break;

        // 빙글 돌아 모션 재생.
        case STEP.TURN_AND_RISE:
        {
            // -------------------------------------------------------- //
            // 카메라.

            this.camera_fcurve.execute(Time.deltaTime);

            if (this.camera_fcurve.isMoving())
            {
                CameraModule.Posture posture = CameraModule.lerp(this.cam_posture0, this.cam_posture1, this.camera_fcurve.getValue());

                camera_module.setPosture(posture);
            }
            else
            {
                float dolly = camera_module.getDistance();

                camera_module.dolly(dolly * (1.0f - 0.05f * Time.deltaTime));
            }

            // -------------------------------------------------------- //
            // 플레이어.

            this.player.control.cmdSmoothHeadingTo(CameraControl.get().transform.position);

            if (this.player.control.getMotionCurrentTime() > 0.5f)
            {
                this.player.control.getAnimationPlayer().Stop();
            }

            // -------------------------------------------------------- //
            // 뒤의 부채.

            this.ougi_fcurve.execute(Time.deltaTime);
            this.ougi_position.y = Mathf.Lerp(ougi_pos_y0, ougi_pos_y1, this.ougi_fcurve.getValue());

            this.ougi.transform.position = this.ougi_position;

            // -------------------------------------------------------- //
            // 플레이어가 가지고 있는 아이스바(당첨).

            // 카메라 방향으로 향한다.

            Vector3 dir = CameraControl.get().gameObject.getPosition() - this.ice_bar.getPosition();

            this.ice_bar.setRotation(Quaternion.LookRotation(-dir.Y(0.0f), Quaternion.AngleAxis(20.0f, Vector3.forward) * Vector3.up));

            // 줌

            if (this.step.is_acrossing_time(0.3f))
            {
                this.ice_zoom_fcurve.setSlopeAngle(70.0f, 5.0f);
                this.ice_zoom_fcurve.setDuration(0.3f);
                this.ice_zoom_fcurve.start();
            }

            this.ice_zoom_fcurve.execute(Time.deltaTime);

            this.ice_bar.setLocalScale(Vector3.one * Mathf.Lerp(0.2f, 0.8f, this.ice_zoom_fcurve.getValue()));

            // -------------------------------------------------------- //
            // 당첨 말풍선.

            if (this.step.is_acrossing_time(0.3f))
            {
                this.spring.k      = 750.0f;
                this.spring.reduce = 0.87f;
                this.spring.start(-0.75f);
                this.sprite_atari.setVisible(true);
            }

            this.spring.execute(Time.deltaTime);

            float scale = this.spring.position + 1.0f;

            this.sprite_atari.setScale(new Vector2(scale, scale));
        }
        break;

        // 아이스 스틱을 던진다.
        case STEP.STICK_THROW:
        {
            // -------------------------------------------------------- //
            // カメラ.

            float dolly = camera_module.getDistance();

            camera_module.dolly(dolly * (1.0f - 0.05f * Time.deltaTime));

            // -------------------------------------------------------- //
            //

            Vector3 dir = CameraControl.get().gameObject.getPosition() - this.player.gameObject.getPosition();

            dir = Quaternion.AngleAxis(-90.0f, Vector3.up) * dir.Y(0.0f);

            this.player.control.cmdSmoothHeadingTo(this.player.gameObject.getPosition() + dir);
        }
        break;

        // 아이스 스틱이 날아온다.
        case STEP.STICK_FLYING:
        {
            // -------------------------------------------------------- //
            // 카메라.

            this.camera_fcurve.execute(Time.deltaTime);

            CameraModule.Posture posture = CameraModule.lerp(this.cam_posture1, this.cam_posture0, this.camera_fcurve.getValue());

            camera_module.setPosture(posture);

            // -------------------------------------------------------- //
            // 당첨 말풍선.

            this.atari_fcurve.execute(Time.deltaTime);
            this.sprite_atari.setScale(Vector2.one * Mathf.Lerp(1.0f, 0.0f, this.atari_fcurve.getValue()));

            // -------------------------------------------------------- //
            //  뒤 풍선.

            this.ougi_fcurve.execute(Time.deltaTime);
            this.ougi_position.y = Mathf.Lerp(ougi_pos_y1, ougi_pos_y0, this.ougi_fcurve.getValue());

            this.ougi.transform.position = this.ougi_position;

            // -------------------------------------------------------- //
            // 이쪽으로 날아오는 아이스 스틱.

            this.ice_fcurve.execute(Time.deltaTime);
            this.tracer.proceedToDistance(this.ice_fcurve.getValue() * this.tracer.curve.calcTotalDistance());

            Vector2 on_curve_position = this.tracer.cv.position.xz() * 480.0f / 2.0f;

            // 커브의 종단점이 아이템 윈도의 아이콘 위치가 되도록 보정한다.
            do
            {
                if (this.slot_index < 0)
                {
                    break;
                }
                if (this.ice_fcurve.getValue() <= 0.5f)
                {
                    break;
                }

                float blend_rate = Mathf.InverseLerp(0.5f, 1.0f, this.ice_fcurve.getValue());

                Vector2 icon_position = ItemWindow.get().getIconPosition(Item.SLOT_TYPE.MISC, this.slot_index);

                Vector2 curve_end = this.tracer.curve.cvs.back().position.xz() * 480.0f / 2.0f;

                on_curve_position += (icon_position - curve_end) * blend_rate;
            } while(false);

            this.sprite_ice_bar.setPosition(on_curve_position);
            this.sprite_ice_bar.setAngle(this.step.get_time() * 360.0f * 5.0f);
            this.sprite_ice_bar.getMaterial().SetFloat("_BlendRate", this.ice_fcurve.getValue());
        }
        break;
        }
    }
Ejemplo n.º 4
0
    void    Update()
    {
        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크한다.

        switch (this.step.do_transition())
        {
        case STEP.WAIT_ENTER:
        {
            if (this.is_unlocked)
            {
                if (this.keyItemName == null)
                {
                    if (this.entered_players.Count >= PartyControl.get().getPlayerCount())
                    {
                        this.step.set_next(STEP.EVENT_IN_ACTION);
                        PartyControl.get().clearDoorState(this.keyItemName);
                    }
                }
                else
                {
                    if (this.entered_players.Count > 0 &&
                        PartyControl.get().isDoorOpen(this.keyItemName))
                    {
                        this.step.set_next(STEP.EVENT_IN_ACTION);
                        PartyControl.get().clearDoorState(this.keyItemName);
                    }
                }
            }
        }
        break;

        case STEP.EVENT_IN_ACTION:
        {
        }
        break;

        case STEP.WAIT_LEAVE:
        {
            if (this.entered_players.Count == 0)
            {
                this.step.set_next(STEP.WAIT_ENTER);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.SLEEP:
            {
                if (this.moji_effect != null)
                {
                    this.moji_effect.gameObject.destroy();

                    this.moji_effect = null;
                }
            }
            break;

            case STEP.WAIT_ENTER:
            {
                if (this.is_unlocked)
                {
                    if (this.moji_effect == null)
                    {
                        this.moji_effect = EffectRoot.get().createDoorMojisEffect(this.transform.position);
                    }
                }
            }
            break;

            case STEP.WAIT_LEAVE:
            {
                if (this.moji_effect != null)
                {
                    this.moji_effect.gameObject.destroy();
                    this.moji_effect = null;
                }
            }
            break;

            case STEP.EVENT_IN_ACTION:
            {
                TransportEvent transport_event = EventRoot.get().startEvent <TransportEvent>();

                if (transport_event != null)
                {
                    transport_event.setDoor(this);
                }
                else
                {
                    Debug.LogWarning("Can't begin Transport Event");
                }

                // 다음 방을 설정해 둔다.
                if (this.connect_to != null)
                {
                    PartyControl.get().setNextRoom(this.connect_to.room);
                }
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.WAIT_ENTER:
        {
        }
        break;
        }

        // ---------------------------------------------------------------- //
    }
Ejemplo n.º 5
0
    // ================================================================ //

    public override void onDamaged()
    {
        this.control.cmdSetMotion("m005_damage", 1);

        EffectRoot.get().createHitEffect(this.transform.position);
    }
Ejemplo n.º 6
0
    private void    resolve_pick_item_query(QueryItemPick query)
    {
        do
        {
            if (!query.isSuccess())
            {
                break;
            }

            // ?꾩씠???④낵留?蹂듭궗?섍퀬 ??젣?쒕떎.

            ItemController item = this.control.cmdItemPick(query, query.target);

            if (item == null)
            {
                break;
            }

            // ?댄럺??
            EffectRoot.get().createItemGetEffect(this.control.getPosition());

            SoundManager.get().playSE(Sound.ID.DDG_SE_SYS02);

            Debug.Log("Item favor category:" + item.behavior.item_favor.category);
            switch (item.behavior.item_favor.category)
            {
            case Item.CATEGORY.FOOD:
            {
                this.control.vital.healFull();

                this.skin_color_control.startHealing();

                this.cake_count++;
            }
            break;

            case Item.CATEGORY.KEY:
            {
                PartyControl.get().getLocalPlayer().control.consumeKey(item);
            }
            break;

            case Item.CATEGORY.FLOOR_KEY:
            {
                PartyControl.get().getLocalPlayer().control.consumeKey(item);
            }
            break;

            case Item.CATEGORY.CANDY:
            {
                this.startShotBoost();
            }
            break;

            case Item.CATEGORY.WEAPON:
            {
                SHOT_TYPE shot_type = Item.Weapon.getShotType(item.name);

                if (shot_type != SHOT_TYPE.NONE)
                {
                    this.changeBulletShooter(shot_type);
                }
            }
            break;
            }

            item.vanish();
        } while(false);

        query.set_expired(true);
    }
Ejemplo n.º 7
0
    void    Update()
    {
        this.resolve_collision();

        float explode_time = 0.5f;

        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크한다.

        switch (this.step.do_transition())
        {
        case STEP.FLYING:
        {
            if (this.trigger_damage)
            {
                this.step.set_next(STEP.EXPLODE);
            }
        }
        break;

        case STEP.EXPLODE:
        {
            //if(this.explode_effect == null) {
            if (this.step.get_time() > explode_time)
            {
                this.step.set_next(STEP.END);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.FLYING:
            {
            }
            break;

            case STEP.EXPLODE:
            {
                this.model_node.GetComponent <Renderer>().enabled = false;
                this.explode_effect = EffectRoot.get().createYuzuExplode(this.gameObject.getPosition().Y(0.5f));

                this.coli_node.setLocalScale(Vector3.one * this.max_radius * 0.0f);
            }
            break;

            case STEP.END:
            {
                this.gameObject.destroy();
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.FLYING:
        {
            // 이동.
            this.velocity           += Physics.gravity * Time.deltaTime;
            this.transform.position += this.velocity * Time.deltaTime;
        }
        break;

        case STEP.EXPLODE:
        {
            float rate = this.step.get_time() / explode_time;

            float scale = rate * this.max_radius;

            this.coli_node.setLocalScale(Vector3.one * scale);

            // 폭풍과의 충돌.
            // 콜라이더가 바닥에 충돌하면 그 다음 폭풍이 충돌해도 OnTriggerEnter가.
            // 호출되지 않으므로 직접 조사한다.

            RaycastHit hit;

            if (Physics.SphereCast(this.transform.position, scale * this.coli_sphere_radius, Vector3.up, out hit, float.MinValue, LayerMask.GetMask("Enemy", "EnemyLair")))
            {
                CollisionResult result = new CollisionResult();

                result.object0    = this.gameObject;
                result.object1    = hit.collider.gameObject;
                result.is_trigger = true;

                this.collision_results.Add(result);
            }
        }
        break;
        }
    }
Ejemplo n.º 8
0
        // ================================================================ //

        // 시작.
        public void             initialize()
        {
            EffectRoot.get().createHealEffect(this.player.control.getPosition());
        }
Ejemplo n.º 9
0
    private void    resolve_pick_item_query(QueryItemPick query)
    {
        do
        {
            if (!query.isSuccess())
            {
                break;
            }

            // 아이템 효능만 복사하고 삭제한다.

            ItemController item = this.control.cmdItemPick(query, query.target);

            if (item == null)
            {
                break;
            }

            // 효과.
            EffectRoot.get().createItemGetEffect(this.control.getPosition());

            SoundManager.get().playSE(Sound.ID.DDG_SE_SYS02);

            switch (item.behavior.item_favor.category)
            {
            case Item.CATEGORY.CANDY:
            {
                // 아이템 창에 아이콘 표시.
                this.item_slot.candy.favor = item.behavior.item_favor.clone();

                ItemWindow.get().setItem(Item.SLOT_TYPE.CANDY, 0, this.item_slot.candy.favor);

                // 샷의 일정시간 파워업
                this.startShotBoost();
            }
            break;

            case Item.CATEGORY.SODA_ICE:
            case Item.CATEGORY.ETC:
            {
                // 빈 슬롯에 아이템 설정.
                int slot_index = this.item_slot.getEmptyMiscSlot();

                if (slot_index >= 0)
                {
                    this.item_slot.miscs[slot_index].item_id = query.target;
                    this.item_slot.miscs[slot_index].favor   = item.behavior.item_favor.clone();

                    // 아이템 창에 아이콘 표시.
                    ItemWindow.get().setItem(Item.SLOT_TYPE.MISC, slot_index, this.item_slot.miscs[slot_index].favor);
                }
            }
            break;

            case Item.CATEGORY.FOOD:
            {
                // 체력 회복.
                if (GameRoot.get().isNowCakeBiking())
                {
                    this.control.vital.healFullInternal();
                }
                else
                {
                    this.control.vital.healFull();

                    // 레인보우 칼러 효과.
                    this.skin_color_control.startHealing();
                }

                // 체력 회복을 알림.
                CharacterRoot.get().NotifyHitPoint(this.getAcountID(), this.control.vital.getHitPoint());

                // 아이템 폐기를 알림.
                this.control.cmdItemDrop(query.target);

                // 케이크를 먹은 수(케이크 무한제공용).
                this.cake_count++;
            }
            break;

            // 방 열쇠.
            case Item.CATEGORY.KEY:
            {
                PartyControl.get().getLocalPlayer().control.consumeKey(item);

                Item.KEY_COLOR key_color = Item.Key.getColorFromInstanceName(item.name);

                // 아이템 창에 아이콘 표시.
                if (key_color != Item.KEY_COLOR.NONE)
                {
                    ItemWindow.get().setItem(Item.SLOT_TYPE.KEY, (int)key_color, item.behavior.item_favor);
                }
            }
            break;

            // 플로어 이동 문 열쇠.
            case Item.CATEGORY.FLOOR_KEY:
            {
                MapCreator.getInstance().UnlockBossDoor();

                // 아이템 창에 아이콘 표시.
                ItemWindow.get().setItem(Item.SLOT_TYPE.FLOOR_KEY, 0, item.behavior.item_favor);
            }
            break;

            case Item.CATEGORY.WEAPON:
            {
                // 샷 변경(대파 발칸 / 유자 폭탄).
                SHOT_TYPE shot_type = Item.Weapon.getShotType(item.name);

                if (shot_type != SHOT_TYPE.NONE)
                {
                    this.changeBulletShooter(shot_type);
                }
            }
            break;
            }

            item.vanish();
        } while(false);

        query.set_expired(true);
    }
Ejemplo n.º 10
0
    public override void    execute()
    {
        base.execute();

        this.resolve_collision();

        this.update_item_queries();

        // ---------------------------------------------------------------- //
        // 다음 상태로 전환할지 체크한다.


        switch (this.step.do_transition())
        {
        // 평상 시.
        case STEP.MOVE:
        {
            if (this.control.vital.getHitPoint() <= 0.0f)
            {
                this.step.set_next(STEP.BATAN_Q);
            }
        }
        break;

        // 근접 공격.
        case STEP.MELEE_ATTACK:
        {
            if (!this.melee_attack.isAttacking())
            {
                this.step.set_next(STEP.MOVE);
            }
        }
        break;

        // 아이템 사용.
        case STEP.USE_ITEM:
        {
            if (this.step_use_item.transition_check())
            {
                this.ice_timer = ICE_DIGEST_TIME;
            }
        }
        break;

        // 대미지를 받아 날라가는 중.
        case STEP.BLOW_OUT:
        {
            // 일정 거리를 나아가거나 타임아웃으로 종료.

            float distance = MathUtility.calcDistanceXZ(this.control.getPosition(), this.step_blow_out.center);

            if (distance >= this.step_blow_out.radius || this.step.get_time() > BLOW_OUT_TIME)
            {
                this.control.cmdSetAcceptDamage(true);
                this.step.set_next(STEP.MOVE);
            }
        }
        break;

        // 체력0.
        case STEP.BATAN_Q:
        {
            if (this.control.getMotion() == "")
            {
                this.control.cmdSetMotion("m007_out_lp", 1);
                this.step.set_next_delay(STEP.WAIT_RESTART, 1.0f);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태 전환 시 초기화.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            // 평상 시.
            case STEP.MOVE:
            {
                this.rigidbody.WakeUp();
                this.move_target    = this.transform.position;
                this.heading_target = this.transform.TransformPoint(Vector3.forward);
            }
            break;

            // 근접 공격.
            case STEP.MELEE_ATTACK:
            {
                this.melee_attack.setTarget(this.melee_target);
                this.melee_attack.attack(true);
                this.melee_target = null;
            }
            break;

            // 아이템 사용.
            case STEP.USE_ITEM:
            {
                int slot_index = this.step_use_item.slot_index;

                if (this.ice_timer > 0.0f)
                {
                    // 아이스를 짧은 간격으로 연속 사용할 때
                    // 머리가 지끈지끈해서 회복되지 않는다.

                    // 아이템을 삭제한다.
                    ItemWindow.get().clearItem(Item.SLOT_TYPE.MISC, slot_index);
                    this.item_slot.miscs[slot_index].initialize();

                    this.startJinJin();
                    this.step.set_next(STEP.MOVE);

                    SoundManager.getInstance().playSE(Sound.ID.DDG_SE_SYS06);
                }
                else
                {
                    this.item_slot.miscs[slot_index].is_using = true;

                    this.control.cmdSetAcceptDamage(false);

                    this.step_use_item.initialize();
                }
            }
            break;

            // 대미지를 받아 날라가는 중.
            case STEP.BLOW_OUT:
            {
                this.rigidbody.Sleep();
                this.control.cmdSetAcceptDamage(false);
            }
            break;

            // 체력 0
            case STEP.BATAN_Q:
            {
                this.rigidbody.Sleep();
                this.control.cmdSetAcceptDamage(false);
                this.control.cmdSetMotion("m006_out", 1);
            }
            break;

            // 리스타트 대기.
            case STEP.WAIT_RESTART:
            {
                this.step_batan_q.tears_effect.destroy();
            }
            break;

            // 외부 제어.
            case STEP.OUTER_CONTROL:
            {
                this.rigidbody.Sleep();
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        // 근접 공격.
        // 일단 false로 해두고 이동 입력이 있을 때만.
        // true로 한다.
        this.melee_attack.setHasInput(false);

        GameInput gi = GameInput.getInstance();

        switch (this.step.do_execution(Time.deltaTime))
        {
        // 평상 시.
        case STEP.MOVE:
        {
            this.exec_step_move();

            // ショット.
            if (this.is_shot_enable)
            {
                this.bullet_shooter.execute(gi.shot.current);

                if (gi.shot.current)
                {
                    CharacterRoot.get().SendAttackData(PartyControl.get().getLocalPlayer().getAcountID(), 0);
                }
            }

            // 체력 회복 직후(레인보우컬러 중)는 무적.
            if (this.skin_color_control.isNowHealing())
            {
                this.control.cmdSetAcceptDamage(false);
            }
            else
            {
                this.control.cmdSetAcceptDamage(true);
            }
        }
        break;

        // 아이템 사용.
        case STEP.USE_ITEM:
        {
            this.step_use_item.execute();
        }
        break;

        // 대미지를 받아 날라가는 중.
        case STEP.BLOW_OUT:
        {
            this.exec_step_blow_out();
        }
        break;

        // 체력0.
        case STEP.BATAN_Q:
        {
            if (this.step.is_acrossing_time(4.0f))
            {
                this.step_batan_q.tears_effect = EffectRoot.get().createTearsEffect(this.control.getPosition());

                this.step_batan_q.tears_effect.setParent(this.gameObject);
                this.step_batan_q.tears_effect.setLocalPosition(Vector3.up);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //

        if (gi.serif_text.trigger_on)
        {
            this.control.cmdQueryTalk(gi.serif_text.text, true);
        }

        // ---------------------------------------------------------------- //
        // 10 프레임에 한 번 좌표를 네트워크에 보낸다.

        {
            do
            {
                if (this.step.get_current() == STEP.OUTER_CONTROL)
                {
                    break;
                }

                m_send_count = (m_send_count + 1) % SplineData.SEND_INTERVAL;

                if (m_send_count != 0 && m_culling.Count < PLOT_NUM)
                {
                    break;
                }

                // 통신용 좌표 송신.
                Vector3        target = this.control.getPosition();
                CharacterCoord coord  = new CharacterCoord(target.x, target.z);

                Vector3 diff = m_prev - target;
                if (diff.sqrMagnitude > 0.0001f)
                {
                    m_culling.Add(coord);

                    AccountData account_data = AccountManager.get().getAccountData(GlobalParam.getInstance().global_account_id);

                    CharacterRoot.get().SendCharacterCoord(account_data.avator_id, m_plotIndex, m_culling);
                    ++m_plotIndex;

                    if (m_culling.Count >= PLOT_NUM)
                    {
                        m_culling.RemoveAt(0);
                    }

                    m_prev = target;
                }
            } while(false);
        }
    }
Ejemplo n.º 11
0
    // 매 프레임 호출됩니다.
    public override void    execute()
    {
        float germ_time  = 5.0f;
        float glass_time = 5.0f;

        // ---------------------------------------------------------------- //
        // 다음 상태로 이행할지 체크합니다.

        switch (this.step.do_transition())
        {
        case STEP.GERM:
        {
            if (this.step.get_time() > germ_time)
            {
                this.step.set_next(STEP.GLASS);
            }
        }
        break;

        case STEP.GLASS:
        {
            if (this.step.get_time() > glass_time)
            {
                this.step.set_next(STEP.APPEAR);
            }
        }
        break;

        case STEP.APPEAR:
        {
            if (this.ip_jump.isDone())
            {
                this.step.set_next(STEP.FRUIT);
            }
        }
        break;
        }

        // ---------------------------------------------------------------- //
        // 상태가 전환되면 초기화합니다.

        while (this.step.get_next() != STEP.NONE)
        {
            switch (this.step.do_initialize())
            {
            case STEP.GERM:
            {
                // 성장 중엔 주울 수 없습니다.
                this.controll.cmdSetPickable(false);

                this.germ.SetActive(true);
                this.glass.SetActive(false);
                this.fruit.SetActive(false);

                if (this.transform.parent.name == "Negi")
                {
                    ItemManager.ItemState state = ItemManager.get().FindItemState("Negi");

                    if (state.state != ItemController.State.Picked)
                    {
                        this.controll.cmdDispBalloon(0);
                    }
                }
            }
            break;

            case STEP.GLASS:
            {
                this.germ.SetActive(false);
                this.glass.SetActive(true);
                this.fruit.SetActive(false);
            }
            break;

            case STEP.APPEAR:
            {
                this.germ.SetActive(false);
                this.glass.SetActive(false);
                this.fruit.SetActive(true);

                Vector3 start = this.transform.position;
                Vector3 goal  = this.transform.position;

                this.ip_jump.start(start, goal, 1.0f);

                // 연기 효과.

                // 효과가 열매 모델에 묻히지 않게 카메라 쪽으로 밉니다.

                Vector3 smoke_position = this.transform.position + Vector3.up * 0.3f;

                GameObject main_camera = GameObject.FindGameObjectWithTag("MainCamera");

                Vector3 v = main_camera.transform.position - smoke_position;

                v.Normalize();
                v *= 1.0f;

                smoke_position += v;

                EffectRoot.getInstance().createSmoke01(smoke_position);
            }
            break;

            case STEP.FRUIT:
            {
                if (this.transform.parent.name == "Negi")
                {
                    ItemManager.ItemState state = ItemManager.get().FindItemState("Negi");

                    if (state.state != ItemController.State.Picked)
                    {
                        this.controll.cmdDispBalloon(1);
                    }
                }

                // 성장을 다 했으면 주울 수 있습니다
                this.controll.cmdSetPickable(true);
            }
            break;
            }
        }

        // ---------------------------------------------------------------- //
        // 각 상태에서의 실행 처리.

        switch (this.step.do_execution(Time.deltaTime))
        {
        case STEP.APPEAR:
        {
            this.ip_jump.execute(Time.deltaTime);

            this.transform.position = this.ip_jump.position;
        }
        break;
        }

        // ---------------------------------------------------------------- //
    }