public void Detonate() { if (explosionPrefab != null) { GameObject explosion = (GameObject)Instantiate(explosionPrefab, transform.position, transform.rotation); Destroy(explosion, 5F); NetworkServer.Spawn(explosion); } Player_Fire shooterFireScript = Shooter.GetComponent <Player_Fire>(); shooterFireScript.currentNuke = null; //Remove the current nuke CheckForPlayers(); if (smokeTrail != null) //UNITY 5.1.3 has problems with particle systems so I bult this failsafe just in case I disable them { smokeTrail.GetComponent <ParticleSystem>().startSize = 0; Destroy(smokeTrail, 5F); } print("Playing nuke sfx"); //source.PlayOneShot(explosionSfx); //Play explosion sound Shooter.GetComponent <Audio_Sync>().PlaySound(8, transform.position); //Play nuke explosiion sfx via the shooter //Shooter.GetComponent<Projectile_daisyChain>().CmdDestroy(gameObject); Destroy(gameObject); //NetworkServer.Destroy(gameObject); }
// Use this for initialization void Start() { player_fire = GetComponent <Player_Fire> (); yButtManager = GetComponent <YButtonManager> (); last_fire = Time.time; }
// Initialization void Start() { player_fire = GetComponent <Player_Fire> (); player_missile_fire = GetComponent <Player_Missile_Fire> (); yButtManager = GetComponent <YButtonManager> (); move = transform.root.GetComponentInChildren <PlayerMove> (); last_fire = Time.time; }
// Initialize void Start() { thisSR = GetComponent <SpriteRenderer> (); PlayerTurretSR = PlayerTurret.GetComponent <SpriteRenderer> (); player_Fire = PlayerTurret.GetComponent <Player_Fire> (); HP = startingMaxHP; invuln = false; checkColliders = false; dashing = false; setAllColorScale(1); }
// Use this for initialization void Start() { //if (isLocalPlayer) { variablesScript = GetComponent <variables>(); playerBoostScript = GetComponent <Player_Boost>(); playerDeathScript = GetComponent <Player_Death>(); playerRespawnScript = GetComponent <Player_Respawn>(); playerFireScript = GetComponent <Player_Fire>(); playerHealthScript = GetComponent <Player_Health>(); playerIDScript = GetComponent <Player_ID>(); shipControlScript = GetComponent <ShipControl>(); playerEngineScript = GetComponent <Player_Engine>(); playerSpotlightScript = GetComponent <Player_Spotlight>(); playerNetworkSetup = GetComponent <Player_NetworkSetup>(); if (isLocalPlayer) { playerType = PlayerPrefs.GetString("ShipType"); //print("Setting player type to: " + playerType); if (playerType != "Large" && playerType != "Medium" && playerType != "Small") { playerType = "Medium"; } if (playerType == "Small") { Cmd_EnableSmallShip(); } else if (playerType == "Medium") { Cmd_EnableMediumShip(); } else if (playerType == "Large") { Cmd_EnableLargeShip(); } CmdTellServerMyShip(playerType); } /* * if (!isLocalPlayer) { * if (playerTypeGlobal == "Small") { * Cmd_EnableSmallShip(); * } * else if (playerTypeGlobal == "Medium") { * Cmd_EnableMediumShip(); * } * else if (playerTypeGlobal == "Large") { * Cmd_EnableLargeShip(); * } * } */ }
// Initialize the upgrade settings to lvl1 if not already set void Start() { player_fire = GetComponent <Player_Fire> (); if (exploRadiusMult == 0f) { exploRadiusMult = lvl1ExploRadiusMult; maxCooldown = lvl1Cooldown; } activeMissiles = new List <GameObject> (); // Testing: //UnlockMissiles(1); //EnableTracking (1); //EnableTripleShot(1); //UpgradeCooldown (1); //UpgradeExplosionRadius (1); }
// Use this for initialization void Start() { playerHealthScript = GetComponent <Player_Health>(); variablesScript = GetComponent <variables>(); playerFireScript = GetComponent <Player_Fire>(); playerBoostScript = GetComponent <Player_Boost>(); healthText = GameObject.Find("Health Text").GetComponent <Text> (); healthBar = GameObject.Find("Health Bar").GetComponent <Image>(); fireText = GameObject.Find("Fire Text").GetComponent <Text>(); fireBar = GameObject.Find("Fire Bar").GetComponent <Image>(); specialText = GameObject.Find("Special Text").GetComponent <Text>(); specialBar = GameObject.Find("Special Bar").GetComponent <Image>(); boostText = GameObject.Find("Boost Text").GetComponent <Text>(); boostBar = GameObject.Find("Boost Bar").GetComponent <Image>(); healthText.text = playerHealthScript.health.ToString(); healthBar.fillAmount = 1; }
void Awake() { //Get references p = GetComponent <Player>(); rb = GetComponent <Rigidbody2D>(); cf = GetComponent <ConstantForce2D>(); sr = GetComponent <SpriteRenderer>(); cc = GetComponent <CapsuleCollider2D>(); anim = GetComponent <Animator>(); ph = GetComponent <Player_Health>(); pf = GetComponent <Player_Fire>(); pm = GetComponent <Player_Movement>(); pj = GetComponent <Player_Jump>(); pc = GetComponent <Player_Currency>(); instance = this; //Set instance to this player //Get the collider for the player's dead state deadCollider = transform.Find("Dead Collider").GetComponent <CapsuleCollider2D>(); deadCollider.enabled = false; //Set inactive }
// Call this to purchase/enable a gunner upgrade public static void purchaseGunnerUpgrade(gunnerEffect toPurchase) { int total = gunnerUpgrades [toPurchase] + 1; gunnerUpgrades [toPurchase] = total; if (toPurchase == gunnerEffect.A_fireRate) { Player_Fire.UpgradeFireRate(total); } else if (toPurchase == gunnerEffect.A_range) { bullet_range.upgradeRange(total); } else if (toPurchase == gunnerEffect.A_ricochet) { Player_Fire.UpgradeRicochet(total); } else if (toPurchase == gunnerEffect.A_multishot) { Player_Fire.UpgradeMultishot(total); } else if (toPurchase == gunnerEffect.A_wideBullets) { Player_Fire.UpgradeBulletWidth(total); } else if (toPurchase == gunnerEffect.missile) { Player_Missile_Fire.UnlockMissiles(total); } else if (toPurchase == gunnerEffect.missile_cooldown) { Player_Missile_Fire.UpgradeCooldown(total); } else if (toPurchase == gunnerEffect.missile_explosions) { Player_Missile_Fire.UpgradeExplosionRadius(total); } else if (toPurchase == gunnerEffect.missile_tripleShot) { Player_Missile_Fire.EnableTripleShot(total); } else if (toPurchase == gunnerEffect.missile_tracking) { Player_Missile_Fire.EnableTracking(total); } else if (toPurchase == gunnerEffect.sword) { sword_script.upgrade_enabled(total); } else if (toPurchase == gunnerEffect.sword_destroyProj) { sword_script.upgrade_projectiles(total); } else if (toPurchase == gunnerEffect.sword_duration) { sword_script.upgrade_dur(total); } else if (toPurchase == gunnerEffect.sword_range) { sword_script.upgrade_range(total); } else if (toPurchase == gunnerEffect.sword_spin) { sword_script.upgrade_spins(total); } else if (toPurchase == gunnerEffect.Y_slowMo) { YButtonManager.UnlockSlowMo(total); } else if (toPurchase == gunnerEffect.Y_starMode) { YButtonManager.UnlockStarMode(total); } }
public void Doknockback(Vector3 po1, Vector3 po2, float length = 1f) { knockback = -Player_Fire.VectorRotation(Player_Fire.PointDirection(po1, po2)) * nockback_length * 0.1f * length; }
void Start() { pf = player.GetComponent <Player_Fire>(); }