Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using BattleCore.Events;
- using BattleCore;
- namespace Drone
- {
- class MakeDrone
- {
- // This will hold all packet info to be updated by dronetimer
- private PlayerPositionEvent _Position = new PlayerPositionEvent();
- /// <summary>
- /// Drone PlayerPosition
- /// </summary>
- public PlayerPositionEvent Position
- {
- get { return _Position; }
- set { _Position = value; }
- }
- // Tracks weapons
- WeaponTracker _WepTrack = new WeaponTracker();
- // Controls energy
- EnergyControl _Energy = new EnergyControl();
- // Controls rotation
- Rotation _Rotation = new Rotation();
- // Tracks players to see who is closest
- PlayerTracker _PlayTrack = new PlayerTracker();
- // Drone timer interval
- double _Rate;
- /// <summary>
- /// All variables needed by drone.
- /// </summary>
- /// <param name="DronePosition">Position packet info.</param>
- /// <param name="rate">Interval between updates to game.</param>
- /// <param name="range">How far from drone player has to be before it initiates.</param>
- /// <param name="rotation">Rotation drone turns back to when there are no targets left.</param>
- public void SetVariables(PlayerPositionEvent DronePosition, double rate, ushort range, byte rotation)
- {
- // Entering all settings required by drone from cfg
- _Position = DronePosition;
- _Rotation.SetVariables(_Position.MapPositionX, _Position.MapPositionY,rotation);
- _Rate = rate;
- _WepTrack.Rate = (ushort)rate;
- _PlayTrack.SetVariables(_Position.MapPositionX, _Position.MapPositionY, range);
- }
- public void SetVariables2(ushort maxenergy, double rechargerate, ushort bombalive, ushort bulletalive, ushort bombspeed,ushort bombthrust, ushort bulletspeed)
- {
- _Energy.SetVariables(maxenergy, rechargerate, _Rate);
- _WepTrack.SetVariables(bombalive, bulletalive, bombspeed,bombthrust, bulletspeed);
- }
- /// <summary>
- /// Update rotation and recharge.
- /// </summary>
- public void UpdateDrone()
- {
- // ROTATION
- if (!_PlayTrack.ListEmpty)
- _Rotation.UpdatedRotation(_Position, _Rotation.RotationToTarget(_PlayTrack.ClosestPlayer.MapPositionX, _PlayTrack.ClosestPlayer.MapPositionY));
- else if (_PlayTrack.ListEmpty)
- _Rotation.NoTarget(_Position);
- // RECHARGE
- _Energy.RechargeEnergy(_Position);
- // Weapon Tracking
- _WepTrack.UpdateWeaponTracker();
- }
- //-------------------------------------\\
- // Energy |
- //-------------------------------------//
- public void Damage(string assaulter,ushort damage)
- {
- _Energy.DealDamage(assaulter,damage,_Position);
- }
- public bool Alive
- { get { return _Energy.IsAlive; } }
- public string Killer
- { get { return _Energy.BotKiller; } }
- //-------------------------------------\\
- // Weapon Tracker |
- //-------------------------------------//
- public Queue<WeaponTracker.WeaponFired> ExpiredShots
- {
- get { return _WepTrack.ExpiredShots; }
- set { _WepTrack.ExpiredShots = value; }
- }
- public WeaponTracker.WeaponFired LastFired
- {
- get { return _WepTrack.LastFired; }
- set { _WepTrack.LastFired = value; }
- }
- //-------------------------------------\\
- // Player Tracker |
- //-------------------------------------//
- /// <summary>
- /// Player movement within drone range
- /// </summary>
- /// <param name="position">PlayerPosition Packet</param>
- public void NearMovement(PlayerPositionEvent position)
- {
- _PlayTrack.PlayerMovement(position);
- string wep = position.Weapon.Type.ToString().ToLower();
- if (wep.Contains("bullet") || wep.Contains("bomb") || wep.Contains("thor"))
- {
- _WepTrack.NewShot(position);
- }
- }
- /// <summary>
- /// Search and remove player from list.
- /// </summary>
- /// <param name="PlayerName">Player name.</param>
- public void RemovePlayer(string PlayerName)
- {
- _PlayTrack.RemovePlayer(PlayerName);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment