Пример #1
0
        // 공격 모션 속도.
        protected void  attack_motion_speed_control()
        {
            chrBehaviorEnemy mine         = this.behavior;
            BasicAction      basic_action = mine.basic_action;

            if (this.melee_attack.step.get_current() == MeleeAttackAction.STEP.ATTACK)
            {
                float current_time    = this.melee_attack.step.get_time();
                float furikaburi_time = 0.38f + 0.3f;

                float play_speed = 0.5f;

                if (current_time < furikaburi_time)
                {
                    // 머리 위로 높이 쳐들 때까지 서서히 느리게.

                    float rate = Mathf.Clamp01(Mathf.InverseLerp(0.0f, furikaburi_time, current_time));

                    play_speed = Mathf.Lerp(0.3f, 0.1f, rate);
                }
                else
                {
                    // 내리 휘두를 때가지 단숨에 빨라진다.

                    float rate = Mathf.Clamp01(Mathf.InverseLerp(furikaburi_time, furikaburi_time + 0.3f, current_time));

                    play_speed = Mathf.Lerp(0.1f, 0.7f, rate);
                }

                basic_action.setMotionPlaySpeed(play_speed);
            }
        }
Пример #2
0
        // 부모가 실행 중에도 실행.
        public override void    stealth()
        {
            chrBehaviorEnemy mine         = this.behavior;
            BasicAction      basic_action = mine.basic_action;

            switch (basic_action.step.get_current())
            {
            case BasicAction.STEP.SPAWN:
            {
                if (basic_action.jump.velocity.y < 0.0f)
                {
                    basic_action.step.set_next(BasicAction.STEP.UNIQUE);
                }
            }
            break;
            }
        }
Пример #3
0
        public override void    execute()
        {
            BasicAction basic_action = this.behavior.basic_action;

            if (this.finish_child())
            {
                this.step.set_next(STEP.MOVE);
            }

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

            switch (this.step.do_transition())
            {
            // 걷는 중.
            case STEP.MOVE:
            {
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.MOVE);
                }

                chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

                if (this.behavior.isInAttackRange(player.control))
                {
                    this.push(this.melee_attack);
                    this.step.sleep();
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전환됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 걷는 중.
                case STEP.MOVE:
                {
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                var coli = basic_action.control.collision_results.Find(x => x.object1.tag == "Wall" || x.object1.tag == "Player");

                // 벽(또는 플레이어)에 부딪히면 반사해서 방향을 바꿉니다.
                do
                {
                    if (coli == null)
                    {
                        break;
                    }
                    if (coli.option0 == null)
                    {
                        break;
                    }
                    ContactPoint cp = (ContactPoint)coli.option0;

                    // 벽의 법선 방향을 90도 단위로 합니다.

                    Vector3 normal = cp.normal;

                    float normal_angle = Mathf.Atan2(normal.x, normal.z) * Mathf.Rad2Deg;

                    normal_angle = MathUtility.unormDegree(normal_angle);
                    normal_angle = Mathf.Round(normal_angle / 90.0f) * 90.0f;

                    normal = Quaternion.AngleAxis(normal_angle, Vector3.up) * Vector3.forward;

                    Vector3 v = basic_action.getMoveVector();

                    if (Vector3.Dot(v, normal) >= 0.0f)
                    {
                        break;
                    }

                    v -= 2.0f * Vector3.Dot(v, normal) * normal;
                    basic_action.setMoveDirByVector(v);

                    // 플레이어에게 부딪혔으면 대미지를 줍니다.
                    do
                    {
                        if (coli.object1.tag != "Player")
                        {
                            break;
                        }

                        chrController chr = coli.object1.GetComponent <chrController>();

                        if (chr == null)
                        {
                            break;
                        }
                        if (!(chr.behavior is chrBehaviorLocal))
                        {
                            break;
                        }

                        chr.causeDamage(this.control.vital.getAttackPower(), -1);
                    } while(false);
                } while(false);

                basic_action.setMoveSpeed(4.0f);
                basic_action.setMoveMotionSpeed(0.0f);

                basic_action.executeMove();

                //

                this.model.transform.Rotate(new Vector3(7.0f, 0.0f, 0.0f));
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                basic_action.setMoveMotionSpeed(0.0f);
            }
            break;
            }

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

            this.execute_child();
        }
Пример #4
0
        public override void    execute()
        {
            BasicAction basic_action = this.behavior.basic_action;

            if (this.finish_child())
            {
                this.step.set_next(STEP.MOVE);
            }

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

            switch (this.step.do_transition())
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

                if (this.behavior.isInAttackRange(player.control))
                {
                    this.push(this.melee_attack);
                    this.step.sleep();
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전환됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 걷는 중.
                case STEP.MOVE:
                {
                    this.next_position = 0;

                    Vector3 move_vector = this.positions[this.next_position] - this.control.getPosition();

                    basic_action.move_dir = Mathf.Atan2(move_vector.x, move_vector.z) * Mathf.Rad2Deg;
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                Vector3 tgt_vector0 = this.positions[0] - this.control.getPosition();
                Vector3 tgt_vector1 = this.positions[1] - this.control.getPosition();
                Vector3 move_vector = this.control.getMoveVector();

                float dp0 = Vector3.Dot(tgt_vector0, move_vector);
                float dp1 = Vector3.Dot(tgt_vector1, move_vector);

                if (dp0 > 0.0f && dp1 > 0.0f)
                {
                    if (tgt_vector0.sqrMagnitude < tgt_vector1.sqrMagnitude)
                    {
                        this.next_position = 0;
                    }
                    else
                    {
                        this.next_position = 1;
                    }
                }
                else if (dp0 < 0.0f && dp1 < 0.0f)
                {
                    if (tgt_vector0.sqrMagnitude > tgt_vector1.sqrMagnitude)
                    {
                        this.next_position = 0;
                    }
                    else
                    {
                        this.next_position = 1;
                    }
                }

                Vector3 tgt_vector = this.positions[this.next_position] - this.control.getPosition();

                basic_action.move_dir = Mathf.Atan2(tgt_vector.x, tgt_vector.z) * Mathf.Rad2Deg;

                basic_action.executeMove();

                basic_action.setMoveMotionSpeed(1.0f);
            }
            break;
            }

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

            this.execute_child();
        }
Пример #5
0
        public override void    execute()
        {
            chrBehaviorEnemy mine         = this.behavior;
            BasicAction      basic_action = mine.basic_action;

            float distance_limit = 10.0f;
            float angle_limit    = 45.0f;

            if (this.finish_child())
            {
                this.step.set_next(STEP.READY);
            }

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

            switch (this.step.do_transition())
            {
            case STEP.READY:
            {
                // 공격 가능 범위에서 가장 가까이 정면에 있는 플레이어를.
                // 찾습니다.
                this.target_player = this.behavior.selectTargetPlayer(distance_limit, angle_limit);

                if (target_player != null)
                {
                    this.step.set_next(STEP.TURN);
                }
            }
            break;

            // 목표 방향으로 선회.
            case STEP.TURN:
            {
                if (this.target_player == null)
                {
                    this.step.set_next(STEP.READY);
                }
                else
                {
                    basic_action.move_dir = MathUtility.calcDirection(mine.control.getPosition(), this.target_player.control.getPosition());

                    float dir_diff = MathUtility.snormDegree(basic_action.move_dir - mine.control.getDirection());

                    if (Mathf.Abs(dir_diff) < 5.0f)
                    {
                        this.push(this.shoot);
                        this.step.sleep();
                    }
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전환됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 목표 방향으로 선회.
                case STEP.TURN:
                {
                }
                break;

                case STEP.FINISH:
                {
                    this.is_finished = true;
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 목표 방향으로 선회.
            case STEP.TURN:
            {
                basic_action.move_dir = MathUtility.calcDirection(mine.control.getPosition(), this.target_player.control.getPosition());
            }
            break;
            }

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

            this.execute_child();
        }
Пример #6
0
        public override void    execute()
        {
            chrBehaviorEnemy mine         = this.behavior;
            BasicAction      basic_action = mine.basic_action;

            if (this.finish_child())
            {
                this.step.set_next(STEP.MOVE);
            }

            chrBehaviorPlayer target_player = this.behavior.selectTargetPlayer(float.MaxValue, float.MaxValue);

            this.melee_attack.target_player = target_player;

            // ---------------------------------------------------------------- //
            // 다음 상태로 이동하는지 체크합니다.

            switch (this.step.do_transition())
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                do
                {
                    if (target_player == null)
                    {
                        break;
                    }
                    if (!this.behavior.isInAttackRange(target_player.control))
                    {
                        break;
                    }

                    //

                    this.push(this.melee_attack);
                    this.step.sleep();
                } while(false);
            }
            break;

            // 멈춰 있다.
            case STEP.REST:
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.MOVE);
                }

                do
                {
                    if (target_player == null)
                    {
                        break;
                    }
                    if (!this.behavior.isInAttackRange(target_player.control))
                    {
                        break;
                    }

                    //

                    this.push(this.melee_attack);
                    this.step.sleep();
                } while(false);
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전환됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 걷는 중.
                case STEP.MOVE:
                {
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                do
                {
                    if (target_player == null)
                    {
                        break;
                    }

                    basic_action.move_dir = MathUtility.calcDirection(mine.control.getPosition(), target_player.control.getPosition());

                    basic_action.setMoveMotionSpeed(1.0f);
                    basic_action.setMoveSpeed(0.6f);

                    basic_action.setMotionPlaySpeed(0.6f);

                    basic_action.executeMove();
                } while(false);
            }
            break;

            // 멈춰있다.
            case STEP.REST:
            {
                basic_action.setMoveMotionSpeed(0.0f);
            }
            break;
            }

            this.spring.execute(Time.deltaTime);

            if (this.spring.isMoving())
            {
                this.scale = Mathf.InverseLerp(-1.0f, 1.0f, this.spring.position);
                this.scale = Mathf.Lerp(1.0f, 2.0f, this.scale);
            }

            this.control.transform.localScale = Vector3.one * this.scale;

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

            this.execute_child();

            if (this.child == this.melee_attack)
            {
                this.attack_motion_speed_control();
            }
        }
Пример #7
0
        public override void    execute()
        {
            chrBehaviorEnemy mine         = this.behavior;
            BasicAction      basic_action = mine.basic_action;

            if (this.finish_child())
            {
                this.step.set_next(STEP.MOVE);
            }

            chrBehaviorPlayer target_player = this.behavior.selectTargetPlayer(float.MaxValue, float.MaxValue);

            this.melee_attack.target_player = target_player;

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

            switch (this.step.do_transition())
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                do
                {
                    if (target_player == null)
                    {
                        break;
                    }
                    if (!this.behavior.isInAttackRange(target_player.control))
                    {
                        break;
                    }

                    //

                    this.push(this.melee_attack);
                    this.step.sleep();
                } while(false);
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.MOVE);
                }

                do
                {
                    if (target_player == null)
                    {
                        break;
                    }
                    if (!this.behavior.isInAttackRange(target_player.control))
                    {
                        break;
                    }

                    //

                    this.push(this.melee_attack);
                    this.step.sleep();
                } while(false);
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전한됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 걷는 중.
                case STEP.MOVE:
                {
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                do
                {
                    if (target_player == null)
                    {
                        break;
                    }

                    basic_action.move_dir = MathUtility.calcDirection(mine.control.getPosition(), target_player.control.getPosition());

                    basic_action.executeMove();

                    basic_action.setMoveMotionSpeed(1.0f);
                } while(false);
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                basic_action.setMoveMotionSpeed(0.0f);
            }
            break;
            }

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

            this.execute_child();
        }
Пример #8
0
        public override void    execute()
        {
            BasicAction basic_action = this.behavior.basic_action;

            if (this.finish_child())
            {
                this.step.set_next(STEP.MOVE);
            }

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

            switch (this.step.do_transition())
            {
            // 걷는 중.
            case STEP.MOVE:
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.REST);
                }

                chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

                if (this.behavior.isInAttackRange(player.control))
                {
                    this.push(this.melee_attack);
                    this.step.sleep();
                }
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                if (this.step.get_time() > 1.0f)
                {
                    this.step.set_next(STEP.MOVE);
                }

                chrBehaviorLocal player = PartyControl.get().getLocalPlayer();

                if (this.behavior.isInAttackRange(player.control))
                {
                    this.push(this.melee_attack);
                    this.step.sleep();
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // 상태가 전환됐을 때의 초기화.

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                // 걷기 중.
                case STEP.MOVE:
                {
                    basic_action.move_dir += Random.Range(-90.0f, 90.0f);

                    if (basic_action.move_dir > 180.0f)
                    {
                        basic_action.move_dir -= 360.0f;
                    }
                    else if (basic_action.move_dir < -180.0f)
                    {
                        basic_action.move_dir += 360.0f;
                    }
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 걷기 중.
            case STEP.MOVE:
            {
                basic_action.executeMove();

                basic_action.setMoveMotionSpeed(1.0f);
            }
            break;

            // 멈춤.
            case STEP.REST:
            {
                basic_action.setMoveMotionSpeed(0.0f);
            }
            break;
            }

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

            this.execute_child();
        }
Пример #9
0
        public override void    execute()
        {
            BasicAction basic_action = this.behavior.basic_action;

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

            switch (this.step.do_transition())
            {
            // 대기 중.
            case STEP.READY:
            {
                /*do {
                 *
                 *      if(!LevelControl.get().canCreateCurrentRoomEnemy()) {
                 *
                 *              break;
                 *      }
                 *
                 *      if(!Input.GetMouseButtonDown(1)) {
                 *      //if(!this.step.is_acrossing_cycle(5.0f)) {
                 *
                 *              break;
                 *      }
                 *
                 *      this.step.set_next(STEP.SPAWN);
                 *
                 * } while(false);*/
            }
            break;

            // 적 스폰.
            case STEP.SPAWN:
            {
                // 스폰 애니메이션이 끝나면 대기 상태로 돌아간다.
                do
                {
                    // 애니메이션 전환 중이면 돌아가지 않는다.
                    // (이걸 넣어두지 않으면 "idle" -> "generate"의.
                    //  전환 중에 다음 if문이 true가 되어 버린다).
                    if (basic_action.animator.IsInTransition(0))
                    {
                        break;
                    }
                    if (basic_action.animator.GetCurrentAnimatorStateInfo(0).IsName("Base Layer.Generate"))
                    {
                        break;
                    }

                    this.step.set_next(STEP.READY);
                } while(false);
            }
            break;

            // 찌그러진다.
            case STEP.PECHANCO:
            {
                if (this.is_death_motion_finished)
                {
                    this.step.set_next_delay(STEP.IDLE, 0.5f);
                }
            }
            break;
            }

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

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                case STEP.IDLE:
                {
                    // 부모 계층의 액션으로 복귀.
                    if (this.parent != null)
                    {
                        this.parent.resume();
                    }
                }
                break;

                // 대기 중.
                case STEP.READY:
                {
                }
                break;

                // 적 스폰.
                case STEP.SPAWN:
                {
                    this.is_trigger_pe = false;
                    basic_action.animator.SetTrigger("Generate");
                }
                break;

                // 찌그러진다.
                case STEP.PECHANCO:
                {
                    basic_action.animator.SetTrigger("Death");
                    this.is_death_motion_finished = false;

                    this.control.cmdEnableCollision(false);
                }
                break;
                }
            }

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

            switch (this.step.do_execution(Time.deltaTime))
            {
            // 적 스폰.
            case STEP.SPAWN:
            {
                // 모션 타이밍에 맞춰 적을 토해낸다.
                if (this.is_trigger_pe)
                {
                    chrBehaviorEnemy_Lair behave_lair = this.behavior as chrBehaviorEnemy_Lair;

                    if (this.pedigree != "")
                    {
                        behave_lair.create_enemy_internal_pedigree(this.pedigree);
                        this.pedigree = "";
                    }
                    else
                    {
                        behave_lair.create_enemy_internal();
                    }

                    this.is_trigger_pe = false;
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
        }
Пример #10
0
        public override void    execute()
        {
            BasicAction basic_action = this.behavior.basic_action;

            // ---------------------------------------------------------------- //
            // ?ㅼ쓬 ?곹깭濡??댄뻾?좎? 泥댄겕?쒕떎.

            switch (this.step.do_transition())
            {
            // ?€湲?以?
            case STEP.READY:
            {
                /*do {
                 *
                 *      if(!LevelControl.get().canCreateCurrentRoomEnemy()) {
                 *
                 *              break;
                 *      }
                 *
                 *      if(!Input.GetMouseButtonDown(1)) {
                 *      //if(!this.step.is_acrossing_cycle(5.0f)) {
                 *
                 *              break;
                 *      }
                 *
                 *      this.step.set_next(STEP.SPAWN);
                 *
                 * } while(false);*/
            }
            break;

            // ???ㅽ룿.
            case STEP.SPAWN:
            {
                // ?ㅽ룿 ?좊땲硫붿씠?섏씠 ?앸굹硫??€湲??곹깭濡??뚯븘媛꾨떎.
                do
                {
                    // ?좊땲硫붿씠???꾪솚 以묒씠硫??뚯븘媛€吏€ ?딅뒗??
                    // (?닿구 ?l뼱?먯? ?딆쑝硫?"idle" -> "generate"??
                    //  ?꾪솚 以묒뿉 ?ㅼ쓬 if臾몄씠 true媛€ ?섏뼱 踰꾨┛??.
                    if (basic_action.animator.IsInTransition(0))
                    {
                        break;
                    }
                    if (basic_action.animator.GetCurrentAnimatorStateInfo(0).IsName("Base Layer.Generate"))
                    {
                        break;
                    }

                    this.step.set_next(STEP.READY);
                } while(false);
            }
            break;

            // 李뚭렇?ъ쭊??
            case STEP.PECHANCO:
            {
                if (this.is_death_motion_finished)
                {
                    this.step.set_next_delay(STEP.IDLE, 0.5f);
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
            // ?곹깭 ?꾪솚 ??珥덇린??

            while (this.step.get_next() != STEP.NONE)
            {
                switch (this.step.do_initialize())
                {
                case STEP.IDLE:
                {
                    // 遺€紐?怨꾩링???≪뀡?쇰줈 蹂듦?.
                    if (this.parent != null)
                    {
                        this.parent.resume();
                    }
                }
                break;

                // ?€湲?以?
                case STEP.READY:
                {
                }
                break;

                // ???ㅽ룿.
                case STEP.SPAWN:
                {
                    this.is_trigger_pe = false;
                    basic_action.animator.SetTrigger("Generate");
                }
                break;

                // 李뚭렇?ъ쭊??
                case STEP.PECHANCO:
                {
                    basic_action.animator.SetTrigger("Death");
                    this.is_death_motion_finished = false;

                    this.control.cmdEnableCollision(false);
                }
                break;
                }
            }

            // ---------------------------------------------------------------- //
            // 媛??곹깭?먯꽌???ㅽ뻾 泥섎━.

            switch (this.step.do_execution(Time.deltaTime))
            {
            // ???ㅽ룿.
            case STEP.SPAWN:
            {
                // 紐⑥뀡 ?€?대컢??留욎떠 ?곸쓣 ?좏빐?몃떎.
                if (this.is_trigger_pe)
                {
                    chrBehaviorEnemy_Lair behave_lair = this.behavior as chrBehaviorEnemy_Lair;

                    if (this.pedigree != "")
                    {
                        behave_lair.create_enemy_internal_pedigree(this.pedigree);
                        this.pedigree = "";
                    }
                    else
                    {
                        behave_lair.create_enemy_internal();
                    }

                    this.is_trigger_pe = false;
                }
            }
            break;
            }

            // ---------------------------------------------------------------- //
        }
Пример #11
0
	public override void	execute()
	{
		BasicAction	basic_action = this.behavior.basic_action;

		float	warp_in_time = 0.2f;
		float	warp_out_time = 0.2f;

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

		switch(this.step.do_transition()) {

			// 사라집니다.
			case STEP.WARP_IN:
			{
				if(this.step.get_time() > warp_in_time) {

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

			// 나타납니다.
			case STEP.WARP_OUT:
			{
				if(this.step.get_time() > warp_out_time) {

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

		// ---------------------------------------------------------------- //
		// 상태가 바뀌었을 때의 초기화.

		while(this.step.get_next() != STEP.NONE) {

			switch(this.step.do_initialize()) {

				// 나타납니다.
				case STEP.WARP_OUT:
				{
					if(this.target_player != null) {

						Vector3		v = this.control.getPosition() - this.target_player.control.getPosition();
	
						if(v.magnitude > 5.0f) {
	
							v *= 5.0f/v.magnitude;
						}
	
						v = Quaternion.AngleAxis(45.0f, Vector3.up)*v;
	
						basic_action.position_xz = this.target_player.control.getPosition() + v;
						basic_action.move_dir    = Mathf.Atan2(-v.x, -v.z)*Mathf.Rad2Deg;

					} else {

						Vector3		v = Quaternion.AngleAxis(this.control.getDirection() + Random.Range(-30.0f, 30.0f), Vector3.up)*Vector3.forward;

						v *= 5.0f;

						basic_action.position_xz = this.control.getPosition() + v;
						basic_action.move_dir    = Mathf.Atan2(v.x, v.z)*Mathf.Rad2Deg;
					}

					this.control.cmdSetDirection(basic_action.move_dir);

					// 착지합니다.
					// 상자에서 튀어나온 직후는 공중에서 워프하므로.
					basic_action.jump.forceFinish();
				}
				break;

				// 끝.
				case STEP.FINISH:
				{
					this.is_finished = true;
				}
				break;
			}
		}

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

		switch(this.step.do_execution(Time.deltaTime)) {

			// 사라집니다.
			case STEP.WARP_IN:
			{
				float	rate = Mathf.Clamp01(this.step.get_time()/warp_in_time);

				rate = Mathf.Pow(rate, 0.25f);

				float	xz_scale = Mathf.Lerp(1.0f, 0.0f, rate);
				float	y_scale  = Mathf.Lerp(1.0f, 2.0f, rate);

				this.control.transform.localScale = new Vector3(xz_scale, y_scale, xz_scale);

				this.control.rigidbody.Sleep();
			}
			break;

			// 나타납니다.
			case STEP.WARP_OUT:
			{
				float	rate = Mathf.Clamp01(this.step.get_time()/warp_out_time);

				rate = Mathf.Pow(rate, 0.25f);

				float	xz_scale = Mathf.Lerp(0.0f, 1.0f, rate);
				float	y_scale  = Mathf.Lerp(2.0f, 1.0f, rate);

				this.control.transform.localScale = new Vector3(xz_scale, y_scale, xz_scale);

				this.control.rigidbody.Sleep();
			}
			break;
		}

		// ---------------------------------------------------------------- //
	}
Пример #12
0
	public override void	execute()
	{
		BasicAction	basic_action = this.behavior.basic_action;

		if(this.target_player == null) {

			this.target_player = PartyControl.get().getLocalPlayer();
		}

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

		switch(this.step.do_transition()) {

			// 공격 중.
			case STEP.ATTACK:
			{
				if(this.behavior.is_attack_motion_finished) {

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

		// ---------------------------------------------------------------- //
		// 상태가 바뀌었을 때의 초기화.

		while(this.step.get_next() != STEP.NONE) {

			switch(this.step.do_initialize()) {

				// 공격 중.
				case STEP.ATTACK:
				{
					basic_action.setMoveMotionSpeed(0.0f);
					basic_action.animator.SetTrigger("Attack");
				}
				break;

				// 끝.
				case STEP.FINISH:
				{
					this.is_finished = true;
				}
				break;
			}
		}

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

		switch(this.step.do_execution(Time.deltaTime)) {

			// 공격 중.
			case STEP.ATTACK:
			{
				if(this.behavior.is_attack_motion_impact) {

					if(this.behavior.isInAttackRange(this.target_player.control)) {

						if(this.target_player.isLocal()) {

							this.target_player.control.causeDamage(this.behavior.control.vital.getAttackPower(), -1);

						} else {

							// 원격 플레이어에게는 대미지를 주지 않는다.
						}
					}
				}
				basic_action.move_dir = MathUtility.calcDirection(this.behavior.control.getPosition(), this.target_player.control.getPosition());
			}
			break;
		}

		// ---------------------------------------------------------------- //
	}
Пример #13
0
	public override void	execute()
	{
		BasicAction	basic_action = this.behavior.basic_action;

		chrBehaviorEnemy_Obake	obake = this.behavior as chrBehaviorEnemy_Obake;

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

		switch(this.step.do_transition()) {

			// 발사.
			case STEP.SHOOT:
			{
				if(this.behavior.is_attack_motion_finished) {

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

		// ---------------------------------------------------------------- //
		// 상태가 바뀌었을 때의 초기화.

		while(this.step.get_next() != STEP.NONE) {

			switch(this.step.do_initialize()) {

				// 발사.
				case STEP.SHOOT:
				{
					basic_action.setMoveMotionSpeed(0.0f);
					basic_action.animator.SetTrigger("Attack");
				}
				break;

				// 끝.
				case STEP.FINISH:
				{
					this.is_finished = true;
				}
				break;
			}
		}

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

		switch(this.step.do_execution(Time.deltaTime)) {

			// 발사.
			case STEP.SHOOT:
			{
				if(this.behavior.is_attack_motion_impact) {

					obake.shootBullet();
				}
			}
			break;
		}

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