public override void TickActivePowerUp(TankPlayer player) { if (timeSinceCollected >= duration) { player.DiscardPowerUp(this); } }
protected override void OnStartRunning() { // Retrieve Scene camera & associated Entity camera = Camera.main; Entities.ForEach((Entity e, ref CameraControlComponent control) => { cameraControl = control; }); // Retrieve & cache player Tank entities if (playersQuery.CalculateLength() == 0) { throw new InvalidOperationException("No tank player entities detected"); } var players = playersQuery.ToEntityArray(Allocator.TempJob); { ComponentDataFromEntity <TankPlayer> tankPlayers = GetComponentDataFromEntity <TankPlayer>(); for (int i = 0; i < players.Length; i++) { TankPlayer tankPlayer = tankPlayers[players[i]]; if (tankPlayer.PlayerId == 0) { player1Entity = players[i]; } else if (tankPlayer.PlayerId == 1) { player2Entity = players[i]; } } players.Dispose(); } }
public override void OnDiscarded(TankPlayer player) { if (player.IsValid() && player.Base.IsValid()) { player.Base.MoveSpeed /= boostFactor; } base.OnDiscarded(player); }
public override void OnDiscarded(TankPlayer player) { if (player.IsValid() && player.Cannon.IsValid()) { player.Cannon.CannonCooldown /= boostFactor; } base.OnDiscarded(player); }
public virtual void Propel(Vector2 origin, Vector2 direction, float angle, float bulletSpeed = 1.0f) { _playerRef = GameObject.Find("tank-player").GetComponent <TankPlayer>(); _bulletOrigin = origin; _direction = direction; _bulletSpeed = bulletSpeed; }
static void Main(string[] args) { TankPlayer tP = new TankPlayer(); char key = ' '; while (((ConsoleKey)key) != ConsoleKey.Escape) { key = tP.Key; //Console.WriteLine(key); tP.Update(); } }
protected virtual void Init() { var go = Instantiate(DamageIndicatorPrefab, new Vector3(RigidbodyComponent.position.x, RigidbodyComponent.position.y, -1.0f), Quaternion.identity, DamageIndicatorsCanvas); _damageIndicatorBar = go.GetComponent <DamageIndicator>(); _originalColor = SpriteRendererComponent.color; _player = GameObject.Find("tank-player").GetComponent <TankPlayer>(); _direction = _player.RigidbodyComponent.position - RigidbodyComponent.position; _direction.Normalize(); }
public override void OnCollected(TankPlayer player) { timeSinceCollected = 0; startClientMeter(To.Single(player.GetClientOwner())); // This RPC only works if inheriting from ModelEntity if (!string.IsNullOrEmpty(active)) { using (Prediction.Off()) { activeEffect = Particles.Create(active, player.Base, ""); } } base.OnCollected(player); }
private void startClientMeter() // Set up the meter and start it counting down locally { clientCollector = Local.Pawn as TankPlayer; timeSinceCollected = 0; meter = GameHud.Current.RootPanel.ChildrenOfType <PowerUpFeed>().First().RegisterPowerUp(); meter.Icon.Style.BackgroundColor = iconColor; meter.Icon.Style.Dirty(); if (!string.IsNullOrEmpty(iconImage)) { meter.Icon.SetTexture(iconImage); } meter.ProgressBar.Style.BackgroundColor = meterColor; meter.ProgressBar.Style.Dirty(); meterWidth.Unit = LengthUnit.Pixels; _ = countDownMeter(); }
public virtual void OnCollected(TankPlayer player) // Called by player upon collecting us { IsCollected = true; collector = player; if (RandomSpawner.IsValid()) { RandomSpawner.IsPowerupWaiting = false; } mainParticles?.Destroy(false); fieldUpParticles?.Destroy(false); fieldDownParticles?.Destroy(false); if (ShouldEmitEffects) { using (Prediction.Off()) { Particles.Create(collected, Position + Vector3.Up * 0.5f); Sound.FromWorld("mtk_powerup", Position); } } player.AddPoints(1, "Powerup Collected"); }
protected override void OnStartRunning() { if (playersQuery.CalculateLength() == 0) { throw new InvalidOperationException("no player tanks detected"); } var players = playersQuery.ToEntityArray(Allocator.TempJob); ComponentDataFromEntity <TankPlayer> tankPlayers = GetComponentDataFromEntity <TankPlayer>(); for (int i = 0; i < players.Length; i++) { TankPlayer tankPlayer = tankPlayers[players[i]]; if (tankPlayer.PlayerId == 0) { player1Entity = players[i]; } else if (tankPlayer.PlayerId == 1) { player2Entity = players[i]; } } players.Dispose(); tankControls.InGame.Enable(); }
protected override void OnStartRunning() { // Retrieve tank player entities if (playersQuery.CalculateLength() == 0) { throw new InvalidOperationException("no player tanks detected"); } var players = playersQuery.ToEntityArray(Allocator.TempJob); ComponentDataFromEntity <TankPlayer> tankPlayers = GetComponentDataFromEntity <TankPlayer>(); for (int i = 0; i < players.Length; i++) { TankPlayer tankPlayer = tankPlayers[players[i]]; if (tankPlayer.PlayerId == 0) { player1Entity = players[i]; } else if (tankPlayer.PlayerId == 1) { player2Entity = players[i]; } } players.Dispose(); // Retrieve health masks Entities.WithAll <SpriteMask, HealthSlider>().ForEach((Entity e, SpriteMask spriteMask, ref HealthSlider healthSlider) => { if (healthSlider.PlayerId == 0) { player1HealthMask = spriteMask; } else { player2HealthMask = spriteMask; } }); }
public abstract void TickActivePowerUp(TankPlayer player);
void Start() { this._tank = new TankPlayer(); this._tank.Start(); this._weapon = new WeaponPlayer(); this._weapon.Start(); this._weapon.Tank = this._tank; this._isReadyToShot = true; this._bowObject = transform.FindChild("Bow").gameObject; }
public virtual void OnDiscarded(TankPlayer player) // Called by player upon discarding us { Delete(); }
public override void TickActivePowerUp(TankPlayer player) { player.Health = TankPlayer.MaxHealth; player.DiscardPowerUp(this); }
public override void OnCollected(TankPlayer player) { player.Cannon.CannonCooldown *= boostFactor; base.OnCollected(player); }
void Start() { this._bowAssembleSound = (AudioClip)Resources.Load ("Sounds/Player/BowAssemble"); this._tank = new TankPlayer(); this._tank.Start(); this._weapon = new WeaponPlayer(); this._weapon.Start(); this._weapon.Tank = this._tank; this._isReadyToShot = true; }
public override void OnDiscarded(TankPlayer player) { activeEffect?.Destroy(false); base.OnDiscarded(player); }
public override void OnCollected(TankPlayer player) { player.Base.MoveSpeed *= boostFactor; base.OnCollected(player); }