// Use this for initialization void Start() { attackPattern = GetComponentInParent <SelectWeapon>(); //bombPattern = attackPattern.attackPattern % 3; //attackPattern.attackPattern = bombPattern; //attackPattern.weaponSymbol.color = attackPattern.patternColors[bombPattern]; player = FindObjectOfType <PlayerController>().gameObject; if (bombPattern == 0) //+ { marker.color = Color.red; } else if (bombPattern == 1) //X { marker.color = Color.blue; } else if (bombPattern == 2) //Circle { marker.color = Color.yellow; } StartCoroutine(shootBomb(attackDelay, attackInterval)); }
// Use this for initialization void Start() { anim = transform.parent.GetChild(1).GetComponent <Animator>(); controller = GetComponent <PlayerController>(); stats = GetComponent <PlayerStats>(); selectedWeapon = GameObject.Find("Weapon Panel").GetComponent <SelectWeapon>(); inv = GameObject.Find("Inventory").GetComponent <Inventory>(); target = controller.Target; distanceFromTarget = controller.DistanceToTarget; }
//------------------------------ private void Start() { movement = GetComponent <PlayerMovement>(); selectedWeapon = GameObject.Find("Weapon Panel").GetComponent <SelectWeapon>(); inv = GameObject.Find("Inventory").GetComponent <Inventory>(); playerStats = this.GetComponent <PlayerStats>(); nextLevel = CalculateNextLevel(); maxHealth = playerStats.Health; currentHealth = maxHealth; levelUpText.SetActive(false); }
//public int attackPattern; // Use this for initialization void Start() { isAttacking = false; attackPattern = GetComponentInParent <SelectWeapon>(); gameManager = FindObjectOfType <GameProcess>(); if (attackPattern.attackPattern == 0) //Top right { laserStartRotation = rightMarker; laserEndRotation = topMarker; marker.color = Color.red; } else if (attackPattern.attackPattern == 1) //Top left { laserStartRotation = leftMarker; laserEndRotation = topMarker; marker.color = Color.blue; } else if (attackPattern.attackPattern == 2) //Bottom left { laserStartRotation = bottomMarker; laserEndRotation = leftMarker; marker.color = Color.yellow; } else if (attackPattern.attackPattern == 3) //Bottom right { laserStartRotation = bottomMarker; laserEndRotation = rightMarker; marker.color = Color.green; } laserBeam.transform.LookAt(laserStartRotation.transform); laserStartEuler = laserBeam.transform.eulerAngles; laserBeam.transform.LookAt(laserEndRotation.transform); laserEndEuler = laserBeam.transform.eulerAngles; if (laserStartEuler.y < laserEndEuler.y) { laserEndEuler.y -= 360; } StartCoroutine(shootLaser(attackDelay, attackInterval)); }
public WeaponButton(WeaponList weapon, SelectWeapon selectWeapon, Vector2 position, Vector2 size, ShopMenu menu, Map map) : base("", position, size, menu, map) { this.weaponType = weapon; this.selectWeapon = selectWeapon; weaponSprite = new Sprite(Weapon.GetIcon(weapon)); lockSprite.FillColor = true; lockSprite.Color = new Color(0, 0, 0, 0.5f); costBox = new TextBox(120f); costBox.SetHeight = size.Y * 0.4f; costBox.Text = WeaponStats.GetStats(weapon).scrapCost.ToString(); costBox.VerticalAlign = TextBox.VerticalAlignment.Center; costBox.HorizontalAlign = TextBox.HorizontalAlignment.Left; }
private void Start() { selectWeapon = FindObjectOfType <SelectWeapon>(); gunImage.enabled = false; }
private void Start() { selectWeapon = FindObjectOfType <SelectWeapon>(); ammoText.gameObject.SetActive(false); }
void Update() { // 落ちた時の対処 if (this.transform.position.y <= -50) { Destroy(this.transform.gameObject); } //コントローラーロック if (controller_lock == true) { return; } //状態異常処理 //麻痺・眠り if (ButState.Stan == true || ButState.Sleep == true) { return; } // Controllerの左スティックのAxisを取得 Vector2 input = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, ControlerNamber), XCI.GetAxis(XboxAxis.LeftStickY, ControlerNamber)); if (input.x > .0f) { //歩く音 // if (direction == 0) { this.PlaySound(audio2, walk_ac, 0.2f); } direction = 1f; } else if (input.x < .0f) { //歩く音 // if (direction == 0) { this.PlaySound(audio2, walk_ac, 0.2f); } direction = -1f; } else { //歩く音を止める //audio2.Stop(); direction = 0f; } if (HaveMozi) { //文字の持ち位置を持ち変える ItemPositionControll(MoziObj, input); } //キャラのy軸のdirection方向にscrollの力をかける rig.velocity = new Vector2(scroll * direction, rig.velocity.y); if (XCI.GetButtonDown(XboxButton.A, ControlerNamber) && !jump) { // 大ジャンプ audio.volume = .2f; audio.PlayOneShot(jump_ac); rig.AddForce(Vector2.up * maxflap); jump = true; //if (XCI.GetButtonUp(XboxButton.Y, ControlerNamber) && !jump) //{ // // 小ジャンプ・・・したかった・・・(´・ω・`) // rig.AddForce(Vector2.up * minflap); // jump = true; //} } // 回避をしたい if (XCI.GetAxis(XboxAxis.RightTrigger, ControlerNamber) < 0.0f && !Avoidance) { // アニメーションに差し替え予定? if (!Avoidance) { if (input.x < .0f) { this.transform.position += new Vector3(-5f, 0f); } else if (input.x > .0f) { this.transform.position += new Vector3(5f, 0f); } Avoidance = true; } } // 回避のクールタイム計測 if (Avoidance && Avoidance_time <= Invincible_time) { Avoidance_time += .1f; } else { // 回避ができるようにする Avoidance = false; Avoidance_time = .0f; } //文字を持っている if (HaveMozi == true) { //文字の位置を調整 MoziBlocController WBController = MoziObj.gameObject.GetComponent <MoziBlocController>(); Vector3 direction = Vector3.zero; if (velocity.x < 0.0f) { direction = Vector3.left; WBController.SetPosition = new Vector3(this.transform.position.x - this.transform.localScale.x, this.transform.position.y + this.transform.localScale.y * 2.5f, 0.0f); } else if (velocity.x > 0.0f) { direction = Vector3.right; WBController.SetPosition = new Vector3(this.transform.position.x + this.transform.localScale.x + 0.5f, this.transform.position.y + this.transform.localScale.y * 2.5f, 0.0f); } //文字を投げる if (XCI.GetButtonDown(XboxButton.B, ControlerNamber)) { MoziBlocController WB = MoziObj.GetComponent <MoziBlocController>(); WB.Attack(input); } // 文字を捨てる if (XCI.GetButton(XboxButton.X, ControlerNamber)) { this.ChangeMozi_Data = false; Destroy(MoziObj); } } else { //所持している文字をすべて消去する if (XCI.GetButtonDown(XboxButton.X, ControlerNamber)) { HPgageObj.transform.GetChild(4).GetComponent <GetMoziController>().AllDestroy(); } } //一文字ずつ消す if (XCI.GetAxis(XboxAxis.LeftTrigger, ControlerNamber) > 0.8f && BackSpace == false) { HPgageObj.transform.GetChild(4).GetComponent <GetMoziController>().BackSpace(); BackSpace = true; } if (XCI.GetAxis(XboxAxis.LeftTrigger, ControlerNamber) < 0.2f) { BackSpace = false; } if (XCI.GetButtonDown(XboxButton.LeftBumper, ControlerNamber)) { //取得文字として登録 HPgageObj.transform.GetChild(4).GetComponent <GetMoziController>().Semi_voicedPoint(); } //武器に変換 if (XCI.GetButtonDown(XboxButton.Y, ControlerNamber)) { if (weapon_use == false && EffectCorutine == false) { weapon = SelectWeapon.CreateSelectWeapon(HPgageObj.transform.GetChild(3).GetComponent <TextMeshProUGUI>().text + HPgageObj.transform.GetChild(4).GetComponent <TextMeshProUGUI>().text); //武器化出来たら if (weapon != null) { GameObject EffectObj = null; foreach (Transform Child in this.transform) { if (Child.name == "Top") { //エフェクトの発生 EffectObj = Instantiate(CreateWeapon_Effect, Child.transform) as GameObject; } } StartCoroutine(this.CreateWeapn(EffectObj)); } } } //武器を持っているとき if (weapon_use == true) { //座標の調整 ItemPositionControll(weapon, input); //武器を使う if (XCI.GetButtonDown(XboxButton.B, ControlerNamber)) { weapon_cs.Attack(); } // 武器を捨てる if (XCI.GetButton(XboxButton.X, ControlerNamber)) { weapon_use = false; Destroy(weapon); weapon = null; } } // Ray this.RayController(); }
// Use this for initialization void Start() { player = FindObjectOfType <PlayerController>().gameObject; isAttacking = false; attackPattern = GetComponentInParent <SelectWeapon>(); if (attackPattern.attackPattern == 0) //Three turret { marker.color = Color.red; patternZeroRotationAngle = 0.5f; turretOne = Instantiate(turret, transform.position, transform.rotation, transform); Quaternion twoRotation = new Quaternion(); twoRotation.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y + 120, transform.rotation.z); turretTwo = Instantiate(turret, transform.position, twoRotation, transform); Quaternion threeRotation = new Quaternion(); threeRotation.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y + 240, transform.rotation.z); turretThree = Instantiate(turret, transform.position, threeRotation, transform); patternZeroSwitchTime = Time.time; patternTwoSwitchTime = Time.time; } else if (attackPattern.attackPattern == 1) //Four turret { marker.color = Color.blue; turretOne = Instantiate(turret, transform.position, transform.rotation, transform); Quaternion twoRotation = new Quaternion(); twoRotation.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y + 90, transform.rotation.z); turretTwo = Instantiate(turret, transform.position, transform.rotation, transform); Quaternion threeRotation = new Quaternion(); threeRotation.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y + 180, transform.rotation.z); turretThree = Instantiate(turret, transform.position, transform.rotation, transform); Quaternion fourRotation = new Quaternion(); fourRotation.eulerAngles = new Vector3(transform.rotation.x, transform.rotation.y + 270, transform.rotation.z); turretFour = Instantiate(turret, transform.position, transform.rotation, transform); } else if (attackPattern.attackPattern == 2) //Two turret { marker.color = Color.yellow; patternTwoRotationAngle = 0.2f; patternTwoAngleCounter = 0; patternTwoSwitch = true; turretOne = Instantiate(turret, transform.position, transform.rotation, transform); turretTwo = Instantiate(turret, transform.position, transform.rotation, transform); } else if (attackPattern.attackPattern == 3) //One turret { marker.color = Color.green; turretOne = Instantiate(turret, transform.position, transform.rotation, transform); } }