Example #1
0
 public override void update(ChargedWeapon weapon) {
     currentCooldown += Time.deltaTime;
     
     if (currentCooldown >= weapon.cooldown) {
         weapon.currentState = new ChargedWeaponStateIdle();
     }
 }
Example #2
0
    public void StartCharging(ChargedWeapon weapon, EquippedItem item, EntityInstance source)
    {
        var effect = EffectPrototype.Instantiate <WeaponChargeEffect>();
        var hp     = source.Entity.Hardpoints[item.Position.x, item.Position.y];
        var barrel = source.GetBarrel(hp);
        var t      = effect.transform;

        t.SetParent(barrel);
        t.forward             = barrel.forward;
        t.position            = barrel.position;
        effect.Weapon         = weapon;
        ActiveEffects[weapon] = effect;
    }
Example #3
0
 public override void handleInput(ChargedWeapon weapon) {
     if (Input.GetButton("Fire1")) {
         currentChargeTime += Time.deltaTime;
         if (currentChargeTime >= weapon.chargeTime) {
             weapon.currentState = new ChargedWeaponStateFiring();
         }
     }
     else {
         currentChargeTime -= Time.deltaTime;
         if (currentChargeTime <= 0) {
             weapon.currentState = new ChargedWeaponStateIdle();
         }
     }
     Debug.Log("Charged For: " + currentChargeTime + " / " + weapon.chargeTime);
 }
Example #4
0
 public virtual void update(ChargedWeapon weapon) {}
Example #5
0
 public virtual void handleInput(ChargedWeapon weapon) {}
Example #6
0
 public override void handleInput(ChargedWeapon weapon) {
     if (Input.GetButton("Fire1")) {
         weapon.currentState = new ChargedWeaponStateCharging();
     }
 }
Example #7
0
 public override void update(ChargedWeapon weapon) {
     GameObject.Instantiate(weapon.projectile, weapon.transform.position, weapon.transform.parent.rotation);
     weapon.currentState = new ChargedWeaponStateCooldown();
 }
Example #8
0
 public void Failed(ChargedWeapon weapon)
 {
     ActiveEffects[weapon].Failed();
 }
Example #9
0
 public void StopCharging(ChargedWeapon weapon)
 {
     ActiveEffects[weapon].StopCharging();
 }