void Awake() { hpcontroller = FindObjectOfType <Hpcontroller>(); ACTION = Actioncontroller.action_type; attact_character = BattleInfo.attact_character; attact_target = BattleInfo.attact_target; gameObject.name = attact_character.name + " " + ACTION + " " + attact_target.name; character = attact_character.GetComponent <Character_Object>(); for (int i = 0; i < BattleInfo.characters_gameobject.Count; i++) { if (attact_character == BattleInfo.characters_gameobject[i]) { now_character = i; break; } } firstmove = Vector3.Distance(attact_character.transform.position, new Vector3(attact_target.transform.position.x, 0.5f, attact_target.transform.position.z)) * speed * 0.01f; Actioncontroller.battlering_active = false; SwitchCharacterMoving(); character.this_model.transform.LookAt(new Vector3(attact_target.transform.position.x, 0, attact_target.transform.position.z)); character.animator.CrossFade("AngierWalk", 0.1f); character.animator.SetBool("isWalking", true); character.animator.SetBool("isIdle", false); //speed = NewSpeed(); }
void OnEnable() { character = BattleInfo.attact_character.GetComponent <Character_Object>(); now_camera = character.character_camera; Vector3 position = character.character_camera.transform.position; Vector3 rotat = character.character_camera.transform.rotation.eulerAngles; position.y += 0.4f; position.z += 7; transform.position = position; //transform.LookAt(character.character_camera.transform.position); transform.RotateAround(character.character_camera.transform.position, Vector3.up, rotat.y); first_angle = transform.rotation.eulerAngles.y; }
void Activebattlering()//判斷是否能行動 { for (int i = 0; i < length; i++) { if (character_timer[i] > 5 && battlering_active == false && character_moving[i] == false) { Time.timeScale = 0;//選擇行動時時間暫停 attact_character = BattleInfo.characters_gameobject[i]; character = attact_character.GetComponent <Character_Object>(); //maincamera.transform.position = (BattleInfo.characters_gameobject[i].transform.position + Vector3.up) + new Vector3(0, 0.5f, -1.5f); //maincamera.transform.LookAt(new Vector3(0, 0, 0) + Vector3.up); BattleInfo.attact_character = attact_character; battlering.SetActive(true); battlering_active = true; character.SendMessage("Switchattacter");//打開攻擊者頭上提示 //battlering.SetActive(true); } } }