protected override void Start() { base.Start(); shootCooldownTimer = new CooldownTimer(shootCooldown); shootDurTimer = new ExpirationTimer(shootDur); }
public override void Shoot(Vector3 position, float rotation, float timeFloat, Vector3 speed, HealthPoints damageAddition, Fraction currentFraction) { if (_rigidbody2D == null) { _rigidbody2D = GetComponent <Rigidbody2D>(); } if (_damageSkill == null) { _damageSkill = GetComponent <DamageSkill>(); } if (_classInformation == null) { _classInformation = GetComponent <ClassInformation>(); } if (_timer == null) { _timer = new ExpirationTimer(timeFloat); _timer.OnExpiredTimer += DespawnAction; } if (_timer.ExpirationTime != timeFloat) { _timer.ExpirationTime = timeFloat; } _timer.Start(); _damageSkill.DamageValue = damageAddition; _classInformation.CurrentFraction = currentFraction; _rigidbody2D.position = position; //_rigidbody2D.rotation = rotation; _rigidbody2D.velocity = speed; }
public override bool Attack(DirectionVector direction) { if (_shootTimer == null) { _shootTimer = new ExpirationTimer(_skillSet.ShootDeltaTime); _shootTimer.OnExpiredTimer += AttackAction; } if (_shootTimer.ExpirationTime != _skillSet.ShootDeltaTime) { _shootTimer.ExpirationTime = _skillSet.ShootDeltaTime; } if (_isCanAttack) { Projectile projectile = ObjectsAPI.SpawnObject(_projectile.gameObject).GetComponent <Projectile>(); float rotation = direction.Value.VectorAngle(); float projectileSpeed = _skillSet.ProjectileSpeed; projectile.Shoot(transform.position, rotation, 1, direction.Value * projectileSpeed, _damageSkill.DamageValue, _classInformation.CurrentFraction); _isCanAttack = false; _shootTimer.Start(); return(true); } return(false); }
private void Update() { transform.forward = targetPoint - transform.position; if (fired && delayTimer.expired) { delayTimer = null; fired = false; var proj = Instantiate(subProjectile, transform.position, subProjectile.transform.rotation); if (parent) { proj.transform.parent = transform; } if (fireAtTarget) { proj.Fire(targetPoint - transform.position); } else { proj.Fire(); } shootSound?.PlayAtPoint(transform.position); if (destroyAfterFiring) { Destroy(gameObject, linger); } } }
public GameManager() { connectedPlayers = new List <ConnectedPlayer>(); insultExpiration = new ExpirationTimer(60); voteExpiration = new ExpirationTimer(30); endExpiration = new ExpirationTimer(5); }
protected override void Start() { base.Start(); flashTimer = new ExpirationTimer(redFlashTime); penaltyTimer = new ExpirationTimer(damageDisableTime); characterMotor = GetComponentInChildren <CharacterMotor>(); }
// Use this for initialization protected override void Start() { base.Start(); brain = GetComponent <Brain>(); motor = GetComponent <CharacterMotor>(); dashTimer = new CooldownTimer(dashCooldown); dashInvulnTimer = new ExpirationTimer(dashInvuln); dashExpTimer = new ExpirationTimer(dashDuration); }
public void Awake() { Initialize(); enabled = true; connectedPlayers = new List <ConnectedPlayer>(); inst = this; insultExpiration = new ExpirationTimer(60); voteExpiration = new ExpirationTimer(30); endExpiration = new ExpirationTimer(5); }
public override void Fire(Vector3 direction, bool align = true) { base.Fire(direction, align); this.direction = direction; this.align = align; delayTimer = new ExpirationTimer(delay); delayTimer.Set(); targetPoint = transform.position + direction; }
public static Game CreateGame() { string code = GetRoomCode(); ExpirationTimer timer = new ExpirationTimer(serverExpiration); timer.Set(); GameManager manager = new GameManager(); int id = GetId(); games[code] = Tuple.Create(code, id, timer, manager); return(games[code]); }
private void Start() { src = GetComponent <AudioSource>(); if (fadeAfter > 0) { fadeTimer = new ExpirationTimer(fadeAfter); } if (PlayAutomatically) { Play(); } }
// Use this for initialization protected override void Start() { base.Start(); mhbImpl = transform.root.GetComponent <SBR.Brain>().activeController as MohawkBossImpl; motor = GetComponentInParent <CharacterMotor>(); anim = GetComponent <Animator>(); leapTimer = new ExpirationTimer(leapTime); chargeTimer = new ExpirationTimer(chargeTime); damageTimer = new ExpirationTimer(1); shootCooldown = new CooldownTimer(1 / fireRate); shootTimer = new ExpirationTimer(1); warnings.parent = null; }
// Use this for initialization void Start() { changeTimer = new ExpirationTimer(2); text = GetComponent <Text>(); lines = new List <string>(); lineNum = 0; foreach (var line in subtitles.text.Split('\n')) { var l = line.Trim(); if (l.Length > 0 && !Regex.IsMatch(l, @"^\d+")) { lines.Add(l); } } }
// Use this for initialization void Start() { sprite = GetComponentInChildren <SpriteRenderer>().transform; machine = GetComponent <StateMachine>(); gun = GetComponentInChildren <Weapon>(); animator = GetComponentInChildren <Animator>(); enemySeenTimer = new ExpirationTimer(5.0f); State patrol = new State(Patrol); State attack = new State(Attack); Transition patrolToAttack = new Transition(patrol, attack, TargetInView, ResetShootTimer); Transition attackToPatrol = new Transition(attack, patrol, TargetLost); machine.AddState(patrol); machine.AddState(attack); machine.AddTransition(patrolToAttack); machine.AddTransition(attackToPatrol); }
private void OnEnable() { if (_currentTimer == null) { if (_isIntervalTimer) { _intervalTimer = new IntervalTimer(_time); _intervalTimer.OnTickTimer += OnTimerTick; _currentTimer = _intervalTimer; } else { _expirationTimer = new ExpirationTimer(_time); _expirationTimer.OnExpiredTimer += OnTimerTick; _currentTimer = _expirationTimer; } } _currentTimer.Start(); }
/// <summary> /// Closes the producers in the pool and performs any cleanup necessary /// for resources used by the <see cref="TransportProducerPool" />. /// </summary> /// /// <returns>A task to be resolved on when the operation has completed.</returns> /// public virtual async Task CloseAsync(CancellationToken cancellationToken = default) { try { ExpirationTimer.Dispose(); } catch (Exception) { } var pendingCloses = new List <Task> { EventHubProducer.CloseAsync(cancellationToken) }; foreach (var poolItem in Pool.Values) { pendingCloses.Add(poolItem.PartitionProducer.CloseAsync(cancellationToken)); } Pool.Clear(); await Task.WhenAll(pendingCloses).ConfigureAwait(false); }
private void OnEnable() { timer = new ExpirationTimer(time); timer.Set(); select.Select(); }
protected override void Start() { base.Start(); reloadTimer = new ExpirationTimer(reloadTime); magazine = magSize; }
// Use this for initialization void Awake() { expressionExpiration = new ExpirationTimer(10); image = GetComponent <Image>(); anim = GetComponent <Animator>(); }
public Magazine(int size, float reloadTime) { reload = new ExpirationTimer(reloadTime); remainingShots = size; this.clipSize = size; }
public Magazine(int capacity, float reload) { remaining = this.capacity = capacity; reloadTimer = new ExpirationTimer(reload); }
// Use this for initialization void Start() { waveTimer = new ExpirationTimer(0); SpawnWave(currentWave); }
// Use this for initialization void Start() { timer = new ExpirationTimer(splitTime); timer.Set(); }