void apply_effect(GameObject bullet, Gem to_apply) { switch (to_apply.getElement()) { case 'F': FireAspect fire_aspect = bullet.AddComponent <FireAspect> (); fire_aspect.damagePerTick = to_apply.getGrade(); fire_aspect.ticks = 4 + to_apply.getGrade(); FireDamage fire_damage = bullet.AddComponent <FireDamage> (); fire_damage.damage = to_apply.getGrade(); break; case 'W': WaterAspect water_aspect = bullet.AddComponent <WaterAspect> (); water_aspect.slowPercentage = 0.90f / (float)to_apply.getGrade(); WaterDamage water_damage = bullet.AddComponent <WaterDamage> (); water_damage.damage = to_apply.getGrade(); break; case 'A': AirAspect air_aspect = bullet.AddComponent <AirAspect> (); air_aspect.damageMultiplier = 1 + to_apply.getGrade(); AirDamage air_damage = bullet.AddComponent <AirDamage> (); air_damage.damage = to_apply.getGrade(); break; case 'E': EarthAspect earth_aspect = bullet.AddComponent <EarthAspect> (); earth_aspect.mass = 500 * to_apply.getGrade(); EarthDamage earth_damage = bullet.AddComponent <EarthDamage> (); earth_damage.damage = to_apply.getGrade(); break; default: break; } }
public void doDamage(float amount) { DrainPlayer = PlayerController.isDraining; DrownPlayer = WaterDamage.isDrowning; rb.isKinematic = true; rb.useGravity = false; if (!DrainPlayer) { if (!DrownPlayer || fallDamage) { audioSrc2.volume = Random.Range(0.8f, 1.0f); audioSrc2.pitch = Random.Range(0.8f, 1.0f); audioSrc2.PlayOneShot(hurt); ScreenFlashEnabled = true; } } flashScreen = hurtScreen; HPMessage.GetComponent <Text>().enabled = true; HPMessage.GetComponent <RectTransform>().anchoredPosition = HPOrgPos; FlameBreastEnabled = Breast.FlameBreast; if (FlameBreastEnabled && stamina > 1) { PlayCtrl.RemovePlayerStamina(amount); } else { health -= amount; } HPMessage.text = "-" + Mathf.CeilToInt(amount); if (health <= 0) { breastState = GetComponent <Breast>(); breastState.ResetBreastState(); WatDMG = Head.GetComponent <WaterDamage>(); WatDMG.ResetDrown(); hurtScreen.color = new Color(hurtScreen.color.r, hurtScreen.color.g, hurtScreen.color.b, 1); fadeScr = ScreenFade.GetComponent <FadeScreen>(); fadeScr.SetAlpha(1); fadeScr.FadeOutScreen(); audioSrc2.volume = Random.Range(0.8f, 1.0f); audioSrc2.pitch = Random.Range(0.8f, 1.0f); audioSrc2.PlayOneShot(death); Message.GetComponent <Text>().enabled = true; playerTransform.position = lastPosition; playerTransform.rotation = lastRotation; Message.text = "You Died..."; Message.GetComponent <RectTransform>().anchoredPosition = MSGOrgPos; StartCoroutine(FadeTextToZeroAlpha(3f, Message)); flashScreen.enabled = false; MovementSet.ResetStam(); health = 100; setUIText(); } StartCoroutine(FadeTextToZeroAlpha(3f, HPMessage)); }
public void StartGame(bool True) { if (True) { PlayST = GetComponent <PlayerStats>(); gameMap = GetComponent <MapSystem>(); PlayerInt = GetComponent <Interaction>(); WatDmg = Head.GetComponent <WaterDamage>(); if (isOverWorld) { PlayST.SendMainMSG(1, "Fated Island", 3); } else if (isFlameTemple) { PlayST.SendMainMSG(1, "Flame Temple", 3); } else if (isPhantomTemple) { PlayST.SendMainMSG(1, "Phantom Temple", 3); } else if (isFrostTemple) { PlayST.SendMainMSG(1, "Frost Temple", 3); } else if (isFinalTemple) { PlayST.SendMainMSG(1, "Final Temple", 3); } else if (isBeginning) { if (scene == 1) { PlayST.SendMainMSG(1, "Fated Island", 3); } if (scene == 2) { PlayST.SendMainMSG(1, "Flame Temple", 3); } if (scene == 3) { PlayST.SendMainMSG(1, "Phantom Temple", 3); } if (scene == 4) { PlayST.SendMainMSG(1, "Frost Temple", 3); } if (scene == 5) { PlayST.SendMainMSG(1, "Debug Scene", 3); } if (scene == 6) { PlayST.SendMainMSG(1, "Final Temple", 3); } } if (curWeatherPhant) { rain.SetActive(true); curWeatherPhant = false; } else if (curWeatherFrost) { snow.SetActive(true); curWeatherFrost = false; } else if (curWeatherFlame) { ash.SetActive(true); curWeatherFlame = false; } tipText.enabled = false; WatDmg.ResetDrown(); PlayerInt.EnableAUI(false, null); StartCoroutine(AudioFadeIn(musicAudioSrc)); musicAudioSrc.Play(); freezeplayer = false; isDisabled = false; transform.position = newPosition.transform.position; transform.rotation = newPosition.rotation; gameMap.FindMap(); if (isFlameTemple) { FireWave.SetActive(true); } else { FireWave.SetActive(false); } loadingText.text = ""; if (isBeginning) { StartCoroutine(FadeTo(0.0f, 1.0f, blackScreenMenu, false)); } StartCoroutine(FadeTo(0.0f, 1.0f, blackScreen, false)); isBeginning = false; isDebugging = false; PlayST.SetCheckPoint(); isLoading = false; loadScene = false; inTerritory = false; isOverWorld = false; isFlameTemple = false; isPhantomTemple = false; isFrostTemple = false; isFinalTemple = false; True = false; } }