private void addPower() { PowerEffect.staticChangeVarValue(powerGain); textScrollScript.gameObject.GetComponent <Text>().text = "+" + powerGain + " Power"; textScrollScript.startScrolling(); hudScript.updatePower(); }
//COLLISION public override void OnTriggerEnter(Collider other) { //#if !UNITY_WINRT && UNITY_EDITOR string effectName = this.gameObject.name + "Effect"; //Type type = Type.GetType(effectName); #if UNITY_WINRT && !UNITY_EDITOR //PowerEffect effect = (PowerEffect)typeof(BasePowerDealer).GetTypeInfo().Assembly.CreateInstance(effectName); //PowerEffect effect = (PowerEffect)Activator.CreateInstance(typeof(BasePowerDealer).GetTypeInfo().Assembly.ToString(), effectName); PowerEffect powerEffect = getEffectFromName(effectName); //PowerEffect effect = (PowerEffect)Activator.CreateInstance(typeof(FireEffect)); #else PowerEffect powerEffect = (PowerEffect)Assembly.GetAssembly(this.GetType()).CreateInstance(effectName); #endif powerEffect.initialize(this); if (!powerEffect.OnTriggerEnterOverride(other, this)) { if (other.tag == GlobalManager.npcsTag) { PersonStatus person = other.GetComponent <PersonStatus> (); if (person.UnitStatus != PersonStatus.Status.Dead && person.IsAValidTarget) { person.ActivePower = powerEffect; } } } //#endif }
public Powerup() { powerupEffect = (PowerEffect)Random.range(0, 4); transform.position = RandomSpawnPoint(); Texture2D texture; switch (powerupEffect) { case PowerEffect.Durability: texture = GameManager.gameScene.content.Load <Texture2D>("powerups/durability"); break; case PowerEffect.Size: texture = GameManager.gameScene.content.Load <Texture2D>("powerups/size"); break; case PowerEffect.Speed: texture = GameManager.gameScene.content.Load <Texture2D>("powerups/speed"); break; default: texture = GameManager.gameScene.content.Load <Texture2D>("powerups/cuantity"); break; } addComponent(new Sprite(texture)); var collider = addComponent <BoxCollider>(); collider.setSize(texture.Width, texture.Height); collider.physicsLayer = (int)Layers.powerups; }
public void playWarpAnims() { StartCoroutine("delayedFireEvent"); PowerEffect.staticChangeVarValue(costPerJump); WarpEffect.changeValuesByOne(); updateValuesInHUD(new Effect[] { new PowerEffect(), new WarpEffect() }); warpScript.playWarp(); resetTimers(); }
private void setDefaultValues() { powerLeftTxt.text = "Power Left: " + PowerEffect.staticGetVarValue(); livesLeftTxt.text = "Lives Left: " + LivesEffect.staticGetLivesRemaining(); livesLostTxt.text = "Lives Lost: " + LivesEffect.staticGetLivesLost(); //TODO: Morale number interpreter moraleTxt.text = "Current Morale: " + MoraleEffect.staticGetMoraleValue(); jumpsLeftTxt.text = "Jumps until destination (estimate): " + WarpEffect.JumpsLeft; jumpsMadeTxt.text = "Jumps already made: " + WarpEffect.JumpsMade; }
public void Start() { refreshEvents(); powerShieldEffect = (GameObject)Instantiate(powerShieldEffect, new Vector3(this.transform.position.x, this.transform.position.y + ((2.5f) * (1 + this.transform.localScale.x)), this.transform.position.z), Quaternion.identity); powerShieldEffect.transform.parent = this.transform; powerShieldEffect.SetActive(false); shouldNotBeKilledEffect = (GameObject)Instantiate(shouldNotBeKilledEffect, new Vector3(this.transform.position.x, this.transform.position.y + ((2.5f) * (1 + this.transform.localScale.x)), this.transform.position.z), Quaternion.identity); shouldNotBeKilledEffect.transform.parent = this.transform; shouldNotBeKilledEffect.SetActive(false); IsAValidTarget = initialIsValidTarget; ShouldNotBeKilled = initialShouldNotBeKilled; _activePower = null; }
// Update is called once per frame void Update() { if (PowerEffect.staticGetVarValue() <= 0 || MoraleEffect.staticGetMoraleValue() <= 0 || LivesEffect.staticGetLivesRemaining() <= 0) { gameOverScript.showGameOver(); } if (WarpEffect.JumpsLeft <= 0) { winText.SetActive(true); } if (!finalSpeechScript.isFinalEventConfirmed()) { if (eventIsOpen) { checkForInput(); } else { totalTime += Time.deltaTime; secBetweenEvents -= Time.deltaTime; secBetweenRGain -= Time.deltaTime; if (!shownFirstEvent) { fireEvent(); } if (secBetweenEvents < 0) { fireEvent(); secBetweenEvents = secBetweenEventsStore; } if (secBetweenRGain < 0) { addPower(); secBetweenRGain = secBetweenRGainStore; } } } }
public void updatePower() { powerLeftTxt.text = "Power Left: " + PowerEffect.staticGetVarValue(); }
void powerActivated(PersonStatus person, PowerEffect effect) { activatedPowers++; //Debug.Log(activatedPowers); }