public RangedAttacks RangedAttack(AttackHandler handler, ref RangedAttacks prefab, RangedAttacks currentAttack, InputAction.CallbackContext ctx) { if (handler.playerManager.energy.currentEnergy - energyCost > 0 && !prefab.coolingdown) { if (ctx.started) { GameObject attack = ObjectPooler.SharedInstance.GetPooledObject(tag); attack.transform.position = handler.transform.position; attack.transform.rotation = handler.transform.rotation; attack.SetActive(true); currentAttack = attack.GetComponent <RangedAttacks>(); currentAttack.performer = handler.caster; return(currentAttack); } if (currentAttack != null) { if (ctx.performed) { currentAttack.OnTriggered(handler.caster); return(currentAttack); } if (ctx.canceled) { currentAttack.OnReleased(); } } return(currentAttack); } return(null); }
protected override void Start() { base.Start(); projectileFactory = GameObject.FindGameObjectsWithTag("ProjectileFactory")[0].GetComponent <ProjectileFactory>(); RangedAttacks.Add(new Delegates.EmptyDel(ShootProjectiles)); RangedAttacks.Add(new Delegates.EmptyDel(ShootLargerProjectile)); }
public void _OnTertiaryAbility(InputAction.CallbackContext ctx) { tertiaryAttack = TertiaryRange.RangedAttack(this, ref TertiaryRange, tertiaryAttack, ctx);; if (ctx.canceled) { StartCoroutine(SecondaryRange.FireRate()); } }
public void _OnPrimaryAbility(InputAction.CallbackContext ctx) { primaryAttack = PrimaryRange.RangedAttack(this, ref PrimaryRange, primaryAttack, ctx); if (ctx.canceled) { StartCoroutine(PrimaryRange.FireRate()); } }
void OnEnable() { rotationRange = Random.Range(-135, 135); rangedAttacks = GetComponent <RangedAttacks>(); distanceToTarget = Vector3.Distance(rangedAttacks.origin, rangedAttacks.targetPoint); currentDistance = 0.1f; flightPercentage = 0.1f; }
void Start() { cam = Camera.main; rangedAttacks = GetComponent <RangedAttacks>(); }
void Awake() { attack = GetComponent <RangedAttacks>(); attackMesh = GetComponent <MeshRenderer>(); }