/*Player attack*/ private void player_attack(attack_information atk) { if (Input.GetKey (KeyCode.Z)) { /*ファイア周囲1を起動*/ attack.GetComponent<Attack>().fire_attack(atk); } }
void attack(Vector3 delta_Position) { Vector3 position = transform.position; attack_information atk = new attack_information(); atk.g_time = e_time; atk.position = position; atk.P_or_E = "E"; atk.name = gameObject; atk.Scriptname = "Enemy"; attack_manager.GetComponent<Attack>().fire_attack(atk); }
void attack() { attack_information atk = new attack_information(); atk.g_time = e_time; atk.position = transform.position; atk.P_or_E = "E"; atk.name = gameObject; atk.Scriptname = "Goburin"; atk.intervaltime2 = 2.0f; attack_manager.GetComponent<Attack>().fire_attack(atk); }
/*ファイア周囲1*/ public void fire_attack(attack_information atk) { int i, j; /*次の攻撃までの間隔*/ float intervalTime = 1.0f; /*プレイヤーが前の攻撃を行ったときからの時間*/ float gametime = atk.g_time; /*Playerの初期位置を保存する*/ Vector3 Player_position = atk.position; /*effect time*/ float attacktime; //.Log (intervalTime); if (gametime >= intervalTime) { //if(true) { /*初期値は左斜め下*/ i = -50; j = -50; /*positionを左斜め下から開始するようにする*/ atk.position.x -= 50f; atk.position.y -= 50f; while(i <= 50) { while(j <= 50) { if(atk.position != Player_position) { GameObject effect = (GameObject)Instantiate (fire1Prehab, atk.position, transform.rotation); attacktime = effect.GetComponent<ParticleSystem>().startLifetime; GameObject attack_block; attack_block = (GameObject)Instantiate (p_attackCube, atk.position, transform.rotation); Destroy(attack_block,attacktime); } atk.position.y += 50f; j = j + 50; } /*yを初期値に戻す*/ j = -50; atk.position.y -= 150f; atk.position.x += 50f; i = i + 50; } //技が終了したらプレイヤーの時間を0に戻す atk.name.GetComponent<Player>().change_p_time(0f); } return; }
// Update is called once per frame void Update() { p_time += Time.deltaTime; //現在位置を取得 Vector3 position = transform.position; /*attackプログラムに渡す引数をまとめる*/ attack_information atk = new attack_information(); atk.g_time = p_time; atk.position = position; atk.P_or_E = "P"; atk.name = gameObject; //ユーザフェーズのみ行動できる if (main.phase == 2) { player_attack (atk); player_move (position); Player_HP_Update (); } }
// Update is called once per frame void Update() { p_time += Time.deltaTime; //現在位置を取得 Vector3 position = transform.position; /*attackプログラムに渡す引数をまとめる*/ attack_information atk = new attack_information(); atk.g_time = p_time; atk.position = position; atk.P_or_E = "P"; atk.name = gameObject; atk.Scriptname = "Player"; player_attack (atk); player_move (position); Player_HP_Update (); }