예제 #1
0
        // 乗り移る処理
        private void RelyOnTarget(ActorController actor_controller)
        {
            if (!rely_ || rely_detector_.Target == null)
            {
                return;
            }

            if (actor_controller.GetActorType() != ActorController.ActorType.kSoul)
            {// 魂に戻ってから乗り移る
                soul_.SetBrainType(ActorController.BrainType.kPlayer);
                var soul_rely_state = soul_.gameObject.AddComponent <SoulRelyState>();
                soul_rely_state.transform.SetPositionAndRotation(transform.position, transform.rotation);
                soul_rely_state.SetSoulAmount(soul_amount_);
                soul_rely_state.SetTarget(rely_detector_.Target.GetComponent <ActorController>());
                soul_.ChangeState(soul_rely_state);

                // This
                ChangeStateToNpc(actor_controller);
            }
            else
            {
                // Target
                var soul_rely_state = gameObject.AddComponent <SoulRelyState>();
                soul_rely_state.SetSoulAmount(soul_amount_);
                soul_rely_state.SetTarget(rely_detector_.Target.GetComponent <ActorController>());
                actor_controller.ChangeState(soul_rely_state);
            }
        }
예제 #2
0
        // 今の器をNpcに切り替える
        protected void ChangeStateToNpc(ActorController actor_controller)
        {
            gameObject.tag = "Npc";
            actor_controller.SetBrainType(ActorController.BrainType.kNPC);
            switch (actor_controller.GetActorType())
            {
            case ActorController.ActorType.kAnonymous:
                actor_controller.ChangeState(gameObject.AddComponent <NpcDemoState>());
                break;

            case ActorController.ActorType.kGolem:
                actor_controller.ChangeState(gameObject.AddComponent <NpcDemoState>());
                break;

            case ActorController.ActorType.kCarbuncle:
                actor_controller.ChangeState(gameObject.AddComponent <NpcDemoState>());
                break;

            case ActorController.ActorType.kSoul:
                actor_controller.ChangeState(gameObject.AddComponent <NpcSoulState>());
                break;

            default:
                break;
            }
        }
예제 #3
0
        /// <summary>
        /// 行動処理
        /// </summary>
        /// <param name="actor_controller"></param>
        public override void Act(ActorController actor_controller)
        {
            // targetの位置まで移動する
            transform.position = Vector3.Lerp(transform.position, point_, kLerpSpeed * Time.deltaTime);

            // 一定範囲に入ったら操作できる様になる
            if (Vector3.Distance(transform.position, point_) <= kReturnRange)
            {
                // Soul
                var soul_state = gameObject.AddComponent <SoulState>();
                soul_state.SetSoulAmount(GetSoulAmount());
                actor_controller.ChangeState(soul_state);
            }
        }
예제 #4
0
        /// <summary>
        /// 行動処理
        /// </summary>
        /// <param name="actor_controller"></param>
        public override void Act(ActorController actor_controller)
        {
            // targetの位置まで移動する
            transform.position = Vector3.Lerp(transform.position, target_.transform.position, kLerpSpeed * Time.deltaTime);

            // 一定範囲に入ったら乗り移る
            if (Vector3.Distance(transform.position, target_.transform.position) <= kRelyRange)
            {
                target_.SetBrainType(ActorController.BrainType.kPlayer);
                var target_soul_state = target_.gameObject.AddComponent <SoulState>();
                target_soul_state.SetSoulAmount(GetSoulAmount());
                target_.ChangeState(target_soul_state);

                // This
                ChangeStateToNpc(actor_controller);
            }
        }