public Projectile(long id, double mass, double x, double y, double speedX, double speedY, double angle, double angularSpeed, double radius, long carId, long playerId, ProjectileType type) : base(id, mass, x, y, speedX, speedY, angle, angularSpeed, radius) { this.carId = carId; this.playerId = playerId; this.type = type; }
public Projectile NewProjectile(ProjectileType pType) { Projectile newProjectile = null; switch(pType) { case ProjectileType.BlasterBolt: newProjectile = Instantiate(blasterBoltPrefab) as Projectile; break; case ProjectileType.RedBlasterBolt: newProjectile = Instantiate(redBlasterBoltPrefab) as Projectile; break; case ProjectileType.PurpleBlasterBolt: newProjectile = Instantiate(purpleBlasterBoltPrefab) as Projectile; break; } if (newProjectile) { newProjectile.transform.parent = transform; newProjectile.gameObject.SetActive(false); _projectiles[pType].Add(newProjectile); } return newProjectile; }
public void RefreshWeaponBox(ProjectileType type, int count, bool startReload = false, float duration = 0) { weaponBoxes[type].UpdateCount(count); if (startReload) { weaponBoxes[type].StartReload(duration); } }
public static void Add(NetworkMessage message, Location fromLocation, Location toLocation, ProjectileType projectile) { message.AddByte((byte)ServerPacketType.Projectile); message.AddLocation(fromLocation); message.AddLocation(toLocation); message.AddByte((byte)projectile); }
void getStatsForType(ProjectileType type_) { switch (type_) { case ProjectileType.NORMAL_BULLET: damage = 2; speed = 200; break; case ProjectileType.NORMAL_BULLET_UPGRADE: damage = 3; speed = 200; break; case ProjectileType.DOUBLE_BULLET: damage = 3; speed = 200; break; case ProjectileType.NORMAL_MISSLE: damage = 4; speed = 150; break; case ProjectileType.DOUBLE_MISSLE: damage = 5; speed = 150; break; } }
public void FireProjectile(Transform tar, float time, ProjectileType type, bool isHoming) { transform.localScale = new Vector3 (15, 15, 15); GameObject particle; particle = Instantiate (Resources.Load ("FireParticle") as GameObject, transform.position, transform.rotation) as GameObject; //Saved values i GameObject cloneTarget; cloneTarget = new GameObject (); cloneTarget.transform.position = tar.position; if (!isHoming) tar = cloneTarget.transform; orgin = transform.position; targetPositionAtFire = transform.position; target = tar; transitTime = time + 1; Destroy (particle, time); distanceCovered = 0; transform.LookAt(tar); //Calulate control point based on information given controlPoint = Vector3.Lerp(orgin, target.position, 0.5f); controlPoint += Vector3.up * (Vector3.Distance(orgin, tar.position) / 2); //Start the Event StartCoroutine (StartEvent (type)); deathTimer = transitTime; }
public Projectile(Vector2 Location, Vector2 Direction, float Speed, Texture2D Texture, int Damage, Boolean IsPlayer, Vector2 Target, ProjectileType ProjectileType = ProjectileType.Cannon, float RateOfTurn = 0f, float FlightTime = 3f, int Health = 10) { v2Location = Location; v2Target = Target; Direction.Normalize(); v2Direction = Direction; fSpeed = Speed; fRateOfTurn = RateOfTurn; ptType = ProjectileType; t2dTexture = Texture; rectHitBox.Width = Texture.Width; rectHitBox.Height = Texture.Height; if (ProjectileType == ProjectileType.Cannon) fFlightTime = FlightTime * 3f; else fFlightTime = FlightTime; iDamage = Damage; iHealth = Health; bActive = true; bPlayer = IsPlayer; CurrentAngle = (float)Math.Atan2((double)v2Direction.Y, (double)v2Direction.X); SetHitbox(); }
public bool CheckHit(Vector2 pos, Vector2 speed, ProjectileType type, bool grenade) { //if (!Active) return false; if (HP <= 0) return false; bool isHit = false; if ((pos - CenterPosition).Length() <= (type!= ProjectileType.Grenade?(15 * scale):(20*scale))) { isHit = true; HP -= (!grenade?0.2f:0.1f); GameManager.ParticleController.AddMetalDebris(pos, speed*0.2f); if(!grenade) AudioController.PlaySFX("metalhit" + (randomNumber.Next(4) +1), 0.5f, 0f, 0.3f, Position); if(randomNumber.Next(20)==1) AudioController.PlaySFX("ricochet", 0.4f, 0f, 0.3f, Position); if (HP <= 0) Die(); } return isHit; }
public static bool Defeats(ProjectileType type1, ProjectileType type2) { return type2 == ProjectileType.Fragile || type1 == ProjectileType.Fire && type2 == ProjectileType.Ice || type1 == ProjectileType.Ice && type2 == ProjectileType.Water || type1 == ProjectileType.Water && type2 == ProjectileType.Fire || type1 == ProjectileType.Fire && type2 == ProjectileType.Tree; }
public AProjectile(Projectile proj) { Type = proj.Type; X = proj.X; Y = proj.Y; Speed = new Point(proj.SpeedX, proj.SpeedY); Radius = proj.Radius; }
public static bool Send(Objects.Client client, Objects.Location fromLocation, Objects.Location toLocation, ProjectileType effect) { ProjectilePacket p = new ProjectilePacket(client); p.FromPosition = fromLocation; p.ToPosition = toLocation; p.Effect = effect; return p.Send(); }
public override void CreateProjectile(ProjectileType type, Vector2 startPosition, Vector2 startVelocity) { switch (type) { case ProjectileType.Bullet: projectiles.Add(new Bullet(this.content, startPosition, startVelocity)); return; default: return; } }
/// <summary> /// Constructs a projectile with the given y velocity /// </summary> /// <param name="type">the projectile type</param> /// <param name="sprite">the sprite for the projectile</param> /// <param name="x">the x location of the center of the projectile</param> /// <param name="y">the y location of the center of the projectile</param> /// <param name="yVelocity">the y velocity for the projectile</param> public Projectile(ProjectileType type, Texture2D sprite, int x, int y, float yVelocity) { this.type = type; this.sprite = sprite; this.yVelocity = yVelocity; drawRectangle = new Rectangle(x - sprite.Width / 2, y - sprite.Height / 2, sprite.Width, sprite.Height); }
public CannonBase(Rang rang, float damage, float attackSpeed, ProjectileType projectileType, float projectileSpeed, CannonBaseType cannonBaseType) { Rang = rang; Damage = damage; AttackSpeed = attackSpeed; ProjectileType = projectileType; ProjectileSpeed = projectileSpeed; CannonBaseType = cannonBaseType; }
public Projectile(ProjectileType type_, Texture2D texture, Vector2 pos, Vector2 direct, float ang) { type = type_; sprite = texture; position = pos; getStatsForType(type); direct.Normalize(); velocity = direct * speed * -1; angle = ang; base.Initialize(); }
public void UpdateBufferData(int index, ProjectileType projectileType, ProjectileData data) { if (projectileType.Index != LastAccessedProjectileTypeIndex) { LastAccessedProjectileTypeIndex = projectileType.Index; LastAccessedRenderer = IndirectRenderers[LastAccessedProjectileTypeIndex]; } LastAccessedRenderer.UpdateBufferData(projectileType.BufferIndex, data); projectileType.BufferIndex++; }
public void popAmmo() { if (ammoCount > 0) { ammoCount--; } else { currentType = ProjectileType.None; } }
public void Add(Vector2 loc, Vector2 speed, double life, bool ownerhero, ProjectileType type) { foreach (Projectile p in Projectiles) { if (!p.Active) { p.Spawn(loc, speed, life, ownerhero, type); break; } } }
public BaseProjectile CreateProjectile(ProjectileType type, bool _isEnemy, int _damage, Vector3 _startPos, BaseObject _attacker, Vector3 _endPos, BaseObject _target) { BaseProjectile projectile = PrefabsManager.SpawnProjectile(type); projectile.Init(type, _isEnemy, _damage); projectile.InitPosition(_startPos, _endPos); projectile.InitObjects(_attacker, _target); projectileList.Add(projectile); return(projectile); }
public Projectile(Texture2D texture, Vector2 position, int width, Color color, float rotation, float scale, float drawLayer, int frames, ProjectileType type, Vector2 direction, float speed, ProjectileOwner owner) : base(texture, position, width, color, rotation, scale, drawLayer, frames) { this.Type = type; this.Owner = owner; this.Direction = direction; this.Speed = speed; this.IsActive = true; }
public override void CreateProjectile(ProjectileType type, Vector2 startPosition, Vector2 startVelocity) { switch (type) { case ProjectileType.Bullet: projectiles.Add(new Bullet(this.content, startPosition, startVelocity)); return; default: return; } }
public ProjectileParameters(ProjectileType _type, float _fuse, float _speed, float _detonateForce, float _radius, int _damage) { type = _type; fuse = _fuse; speed = _speed; detonationForce = _detonateForce; radius = _radius; damage = _damage; ImportProjectileDefaults(); }
public Projectile(TextureHandler t, HumptyDumpty humptyDumpty) { setDestination(humptyDumpty.Position); hitbox = new Rectangle((int)position.X, (int)position.Y, 10, 10); trajectory = new Rectangle((int)position.X, (int)position.Y, 2, 100); this.humptyDumpty = humptyDumpty; Random r = new Random(); projectileType = (ProjectileType)r.Next(7); texture = t.getProjectile(projectileType); }
protected Projectile() { mMuzzleSpeed = 5.0f; mVelocity = Vector3.zero; mPlayerId = 0; SetScale(GetScale() * 0.25f); SetCollisionRadius(0.125f); mCreateTime = Timing.sInstance.GetFrameStartTime(); projectileType = ProjectileType.SphericalLinear; }
public void Start() { Camera = Camera.main; Interval = INTERVAL; // If projectile type is not set, use default if (ProjectileType == null) { ProjectileType = ProjectileManager.Instance.GetProjectileType(0); } }
public void Set(bool alive, byte health, byte movementSpeed, ProjectileType weapontype, Point posCenter, Point target, byte spawning = spawnTime) { this.alive = (byte)(alive ? 2 : 0); Health = health; this.movementSpeed = movementSpeed; Position.Offset(posCenter - Position.Center); this.target = target; reattackTime = GetMaxCooldown(); WeaponType = weapontype; this.spawning = spawning; }
public Projectile(TextureHandler t, HumptyDumpty humptyDumpty) { setDestination(humptyDumpty.Position); hitbox = new Rectangle((int)position.X, (int)position.Y, 10, 10); trajectory = new Rectangle((int)position.X, (int)position.Y, 2, 100); this.humptyDumpty = humptyDumpty; Random r = new Random(); projectileType = (ProjectileType)r.Next(7); texture = t.getProjectile(projectileType); }
private int GetTypeIndex(ProjectileType type) { for (int i = 0; i < typeCount; i++) { if (type == types[i]) { return(i); } } return(-1); }
public void RemoveProjectile(ProjectileType proj) { for (int i = 0; i < ProjectileInventory.Count; i++) { if (ProjectileInventory[i] == proj) { ProjectileInventory.RemoveAt(i); // Make sure we only remove one projectile return; } } }
public void addAmmo(ProjectileType type) { if (type == currentType) { ammoCount++; } else { currentType = type; ammoCount = 1; } }
public Weapon(int id, string title, string slug, int burstCount, ProjectileType typeOfProjectile, int rateOfFire, int inaccuracy) { ID = id; Title = title; Slug = slug; Sprite = new ContentRef <Texture>(null, @"Data\Sprites & Spritesheets\Weapons\" + slug + @".Texture.res"); BurstCount = burstCount; TypeOfProjectile = typeOfProjectile; RateOfFire = rateOfFire; Inaccuracy = inaccuracy; }
public void SendProjectile(Location from, Location to, ProjectileType projectile) { NetworkMessage outMessage = new NetworkMessage(); ProjectilePacket.Add( outMessage, from, to, projectile ); Send(outMessage); }
public Projectile CreateProjectile(ProjectileType pType, Vector3 pos, Vector3 target, Quaternion rot, float speed) { Projectile projectile = CreateObject(pType, pos, rot, ProjectileManager.Instance.projParent); projectile.Initialize(); ProjectileManager.Instance.managingSet.Add(projectile); projectile.projType = pType; projectile.speed = speed; projectile.target = target; return(projectile); }
public void Spawn(Vector2 pos, Vector2 speed, double life, bool heroowner, ProjectileType type) { Active = true; Position = pos; Speed = speed; Life = life; OwnedByHero = heroowner; Type = type; alpha = 1f; rot = Helper.V2ToAngle(Speed); }
/// <summary> /// Gets the projectile sprite for the given projectile type /// </summary> /// <param name="type">the projectile type</param> /// <returns>the projectile sprite for the type</returns> public static Texture2D GetProjectileSprite(ProjectileType type) { // replace with code to return correct projectile sprite based on projectile type if (type == ProjectileType.FrenchFries) { return(frenchFriesSprite); } else { return(teddyBearProjectileSprite); } }
public override void OnItemLoaded(Item item) { base.OnItemLoaded(item); selectedType = (ProjectileType)weaponTypeEnums.GetValue(projectileType); if (selectedType.Equals(ProjectileType.Pierce)) { item.gameObject.AddComponent <ItemSimpleProjectile>(); } // TODO: Add additional projectile types in future versions //else if (selectedType.Equals(ProjectileType.Explosive)) item.gameObject.AddComponent<Weapons.SimpleExplosive>(); //else if (selectedType.Equals(ProjectileType.Energy)) item.gameObject.AddComponent<Weapons.PlasmaBolt>(); }
public Player(Window window) { _Bitmap = new Bitmap("player", "IsopodPlayer.png"); _HealthBarBitmap = new Bitmap("healthBar", "healthBarEmpty.png"); _HealthBitmap = new Bitmap("health", "healthVial.png"); X = (window.Width - Width) / 2; Y = (window.Height - Height) / 2; _Health = 100; _AliveTime = new Timer("Alive Time"); _AliveTime.Start(); _ProjectileType = ProjectileType.bullet; }
public void Init(float _damage, float _speed, float _travelDist, Vector2 _direction, ProjectileType _projectileType = ProjectileType.Normal, AttackType _attackType = AttackType.Basic) { m_initialized = true; m_damage = _damage; m_speed = _speed; m_travelDist = _travelDist; m_direction = _direction; m_startPos = transform.position; m_projectileType = _projectileType; m_attackType = _attackType; }
/// <summary> /// Gets the projectile sprite for the given projectile type /// </summary> /// <param name="type">the projectile type</param> /// <returns>the projectile sprite for the type</returns> public static Texture2D GetProjectileSprite(ProjectileType type) { // replace with code to return correct projectile sprite based on projectile type switch (type) { case ProjectileType.FrenchFries: return(frenchFriesSprite); case ProjectileType.TeddyBear: return(teddyBearProjectileSprite); } return(null); }
public ProjectileFactory CreateFactory(ProjectileType type, int instability) { foreach (ProjectileFactory fact in factories) { if (fact.type == type) { ProjectileFactory copy = fact.Copy(); copy.instability = instability; return(copy); } } return(null); }
public Projectile(ProjectileType type, int position, int bottom, Directions direction, int speed, int damage, ConsoleColor color, Background background) { Type = type; Speed = speed; Damage = damage; Position = position; Bottom = bottom; Direction = direction; frames = 0; this.background = background; distance = type == ProjectileType.PELLET ? 12 : 100; TextColor = color; }
IEnumerator agasFireball(GameObject target, ProjectileType pt = ProjectileType.Linear, ProjectileSpeed ps = ProjectileSpeed.Fast, float degreeModifier = 3f) { attacking = true; GameObject temp = Instantiate(ghostball, agas.transform.position, Quaternion.identity); yield return(null); temp.GetComponent <Projectile>().Configure(target, pt, ps, degreeModifier); attacking = false; }
/// <summary> /// /// </summary> /// <param name="level">Current level.</param> /// <param name="projectileType">Type of the projectile to shoot.</param> /// <param name="sourceOffset">Offset of the source of projectiles from the Entity Node.</param> /// <param name="rateOfFire">Number of projectiles to shoot per minute.</param> protected Shooter(ILevelManager level, ProjectileType projectileType, Vector3 sourceOffset, float rateOfFire) : base(level) { this.projectileType = projectileType; this.SourceOffset = sourceOffset; this.RateOfFire = rateOfFire; this.shotDelay = 60 / RateOfFire; this.searchDelay = 0; ReceiveSceneUpdates = true; }
// Use this for initialization void Start() { audioSource = GetComponent <AudioSource> (); rb = GetComponent <Rigidbody2D> (); spriteRenderer = GetComponent <SpriteRenderer> (); CurrentProjectile = ProjectileType.Std; state = TankState.alive; alphaLevel = 1.0f; tFire = 0.0f; angle = Mathf.Deg2Rad * transform.rotation.eulerAngles.z; spriteRenderer.color = new Color(colour.r, colour.g, colour.b, alphaLevel); SetFireDelay(); }
protected FireProjectileAction( string actorId, ProjectileType projectileType, int power, Func <EncounterPosition, EncounterPath> pathFunction, int speed ) : base(actorId, ActionType.FIRE_PROJECTILE) { this.ProjectileType = projectileType; this.Power = power; this.PathFunction = pathFunction; this.Speed = speed; }
public virtual void Shoot(Vector2 shotVel, Vector2 shotPos, Vector2 shotDir, ProjectileType type) { if (type == ProjectileType.VOLCANO) { VolcanoProjectile shot = new VolcanoProjectile(m_world, shotPos, m_ProjectileSpriteSize, m_ProjectileSprite, shotVel, shotDir, MovableType.Projectile, type, this); this.m_world.Add(shot); } else { Projectile shot = new Projectile(m_world, shotPos, m_ProjectileSpriteSize, m_ProjectileSprite, shotVel, shotDir, MovableType.Projectile, type, this); this.m_world.Add(shot); } }
public void PlaybackGammaHit() { isNewBeta = true; Destroy(graphic.gameObject); ptype = ProjectileType.E; graphic = (Instantiate(particlePrefabsSmall[(int)ptype], transform.position, transform.rotation) as GameObject).transform; graphic.parent = transform; theSpeed = speeds[(int)ptype] * 0.9f; curEnergy = energies[(int)ptype]; energyLossPerDensityPerUnit = energyLosses[(int)ptype] * (SelectZoomLevelGUI.selectedButton == 2?macroGammaBetaFudge : 1); originalEnergy = curEnergy; transform.rotation = Quaternion.LookRotation(MacroModeGUI.bounceDir); }
public void AddAmmoType(string name, ProjectileType type) { if (freeAmmoID.Count > 0) { ammoDatabase.Add(new Ammo(freeAmmoID.Dequeue(), name, type)); } else { ammoDatabase.Add(new Ammo(maxID, name, type)); maxID++; } EditorUtility.SetDirty(this); }
public Projectile(GameWorld pGameWorld, uint pTeam, ProjectileType pType, float pXPos, float pYPos, float pRotation, ProjectileKit pProjKit, Ship pTarget = null, Ship pOwner = null) { mXPos = pXPos; mYPos = pYPos; mType = pType; aaGameWorld = pGameWorld; mTeam = pTeam; SetProjType(); mRotation = pRotation; mProjKit = pProjKit; mTarget = pTarget; mOwner = pOwner; mDispObject = new DisplayObject(aaGameWorld.aaDisplay, mAssetKit.ASSET_NAME, mXPos, mYPos, (int)mAssetKit.ORIGIN.X, (int)mAssetKit.ORIGIN.Y, Constants.LAYER_PROJECTILE_DEPTH, mAssetKit.SRC_RECTX, mAssetKit.SRC_RECTY, mAssetKit.SRC_RECTWIDTH, mAssetKit.SRC_RECTHEIGHT, mRotation, false); }
public Projectile(Projectile p) { position = new Vertex(p.position); type = p.type; lifeTime = p.lifeTime; exploded = p.exploded; playerProjectile = p.playerProjectile; if(p.srcMonster != null) srcMonsterId = p.srcMonster.id; missileTarget = p.missileTarget; stopped = p.stopped; exploding = p.exploding; explodeTime = p.explodeTime; laserDepth = p.laserDepth; }
void Start() { player = GameObject.FindGameObjectWithTag("Player").GetComponent<Controller2D>(); sprite = GetComponent<SpriteRenderer>(); animationController = GetComponent<Animator>(); projectileCollider = GetComponent<Collider2D>(); initalXOffset = projectileCollider.offset.x; initalYOffset = projectileCollider.offset.y; hit = false; decaying = false; projectileType = (GameControl.gameControl.playerClass == 3) ? ProjectileType.Arrow : ProjectileType.MagicMissle; weaponType = (GameControl.gameControl.playerClass == 3) ? "Bow" : "Staff"; projectileNumber = EquipmentDatabase.equipmentDatabase.equipment[GameControl.gameControl.profile1Weapon].equipmentTier; UpdateDirection(); }
public void Spawn(float d, ProjectileType t, Vector2 v, Controller.Owner o, float m, bool hacked) { StopAllCoroutines(); if (hacked) StartCoroutine(enableCollisions()); despawnTimer = 0; rigid = GetComponent<Rigidbody2D>(); damage = d; projectileType = t; setDamage(); owner = o; rigid.velocity = v; setLayer(); procChance = m; }
public void Spawn(Vector2 pos, float landingheight, Vector2 speed, double life, bool heroowner, ProjectileType type, float pow, Color tint) { Active = true; Position = pos; Speed = speed; Life = life; OwnedByHero = heroowner; Type = type; Power = pow; Tint = tint; landingHeight = landingheight; alpha = 1f; rot = Helper.V2ToAngle(Speed); }
/// <summary> /// Creates a new projectile for the level based on its type. It's position is updated and then added to the list of projectiles in the game. /// </summary> /// <param name="type"></param> /// <param name="position"></param> /// <returns></returns> public void CreateProjectile(ProjectileType type, Vector2 spawnPosition, Game game, ProjectileAlignment alignment) { Projectile newProjectile = null; switch (type) { case ProjectileType.BasicLaser: newProjectile = new BasicLaser(game, alignment); break; case ProjectileType.ChargedLaser: newProjectile = new ChargedLaser(game, alignment); break; } newProjectile.Position = spawnPosition; ProjectileList.Add(newProjectile); }
public ProjectileController(IGameObject owner, Vector2 position, Vector2 velocity, ProjectileType type, int damage, String texturePath) { Rectangle bounds = new Rectangle((int)position.X - 1, (int)position.Y - 1, 3, 3); m_collider = new Collider(this, bounds, ColliderType.Projectile); Owner = owner; Velocity = velocity; Damage = damage; Tint = Color.White; Freezes = false; m_position = position; m_type = type; m_texture = new GameTexture(texturePath); }
public void Init(Vector2 goalPos, ProjectileType type, float speed) { this.goalPos = goalPos; this.type = type; GetComponent<SpriteRenderer>().sprite = SpriteLibrary.I.GetProjectileSprite(type); //Set velocity Vector2 dir = (goalPos - (Vector2)transform.position).normalized; Vector2 vel = dir * speed; rb.AddForce(vel, ForceMode2D.Impulse); //Set rotation transform.rotation = Tools.DirectionToQuaternion(dir); }
public override bool ParseMessage(NetworkMessage msg, PacketDestination destination) { int position = msg.Position; if (msg.GetByte() != (byte)IncomingPacketType.Projectile) return false; Destination = destination; Type = IncomingPacketType.Projectile; FromPosition = msg.GetLocation(); ToPosition = msg.GetLocation(); Effect = (ProjectileType)msg.GetByte(); return true; }
public static Projectile Create(ProjectileType type) { var result = new Projectile(); switch (type) { case ProjectileType.Torpedo: break; case ProjectileType.Skattershot: break; case ProjectileType.Hardshell: break; case ProjectileType.Nuke: break; case ProjectileType.Knockshot: break; } return result; }
//----------------------------------------------------------------------------- // Constructors //----------------------------------------------------------------------------- public Projectile() { EnablePhysics(PhysicsFlags.Flying); syncAnimationWithAngle = false; syncAnimationWithDirection = false; owner = null; eventCollision = null; eventLand = null; angle = 0; direction = 0; crashAnimation = null; bounceOnCrash = false; projectileType = ProjectileType.Physical; }
IEnumerator StartEvent(ProjectileType type) { //While traveling towards the target while (Vector3.Distance(transform.position, target.position) >= .25f) { //If its a missle type if (type == ProjectileType.Missle) { distanceCovered += Time.deltaTime; float fracJour = distanceCovered / transitTime; transform.position = Vector3.Lerp(orgin, target.position, fracJour); yield return null; } //If its a bomb type else if (type == ProjectileType.Bomb) { distanceCovered += Time.deltaTime; float fracJour = distanceCovered / transitTime; transform.position = BezierVec3(orgin, controlPoint, target.position, fracJour); yield return null; } //Or if its not yet programmed, destory the object else { print("Projectile type has not algorithm."); Destroy(this.gameObject); } deathTimer -= Time.deltaTime; if (deathTimer <= 0) { print("Projectile has lived too long."); Destroy(this.gameObject); } if(Vector3.Dot(transform.forward, target.position - transform.position) < 0) { print("Projectile passed its target"); Destroy(this.gameObject); } } ResolveProjectile(); }