private void PlayerCollisionLightsaber(Lightsaber l, Player p) { if (l.boundingBox.Intersects(p.boundingBox)) { p.health -= 3; SoundManager.boss_hit.Play(volume: SoundManager.effectsVolume, pitch: 0.0f, pan: 0.0f); } }
private void ToggleLightsaberOnOff() { // find the lightsaber Lightsaber lightsaber = GetComponentInChildren <Lightsaber>(); // toggle activation lightsaber.ToggleLightsaberOnOff(); // Debug.Log("Toggle lightsaber activation: " + lightsaber); }
void Start() { this._firstLightsaber = this.gameObject.GetComponentsInChildren <Lightsaber>()[0]; this._secondLightsaber = this.gameObject.GetComponentsInChildren <Lightsaber>()[1]; this._firstLightsaber.Damage = 20f; this._secondLightsaber.Damage = 20f; this._player = Object.FindObjectOfType <Player>(); this._playerMovement = this._player.gameObject.GetComponent <PlayerMovement>(); this._animator = this._player.GetComponent <Animator>(); this.Attacking = false; }
private void Throw(int flyspeed) { // speed must be > 8 // if (isThrow == true) // { isAttack = true; if (throwCounter > 0) { throwCounter--; } //# if standing right if (spriteEffect == SpriteEffects.None) { if (throwCounter <= 0) { texture = lighsaber[throw_currentFrame]; if (throw_currentFrame == 0) { position.X -= 22; } else if (throw_currentFrame == 1) { position.X -= 40; } else if (throw_currentFrame == 2) { position.X -= 29; } else if (throw_currentFrame == 3) { position.X -= 1; } // else if (throw_currentFrame == 4) // position.X += 1; throw_currentFrame++; } if (throw_currentFrame >= 4) { throw_currentFrame = 0; texture = force[0]; position.X += 115; // isThrow = false; Lightsaber l = new Lightsaber(throwTexture, new Vector2(14440, 655), new Vector2(13500, 655)); l.isVisible = true; l.speed = flyspeed; lightsaberList.Add(l); isAttack = false; step++; SoundManager.boss_throw.Play(volume: SoundManager.effectsVolume, pitch: 0.0f, pan: 0.0f); } } // # else if (spriteEffect == SpriteEffects.FlipHorizontally) { if (throwCounter <= 0) { texture = lighsaber[throw_currentFrame]; throw_currentFrame++; } if (throw_currentFrame >= 4) { throw_currentFrame = 0; texture = force[0]; Lightsaber l = new Lightsaber(throwTexture, new Vector2(13500, 655), new Vector2(14500, 655)); // ???? l.isVisible = true; l.speed = flyspeed; lightsaberList.Add(l); isAttack = false; step++; SoundManager.boss_throw.Play(volume: SoundManager.effectsVolume, pitch: 0.0f, pan: 0.0f); } } //# if (throwCounter <= 0) { throwCounter = 13; } // } }
void Start() { parentLightsaber = GetComponentInParent <Lightsaber>(); }