樽クラス
Inheritance: MonoBehaviour
 public static List<Barrel> ChainedBarrels(Barrel explodeBarrel)
 {
     var level1 = Barrels.Where(x => x.Bottle.LSDistance(explodeBarrel.Bottle.Position) < 700);
     var level2 = Barrels.Where(x => level1.Any(y => y.Bottle.LSDistance(x.Bottle.Position) < 700));
     var level3 = Barrels.Where(x => level2.Any(y => y.Bottle.LSDistance(x.Bottle.Position) < 700));
     return
         level3.ToList();
 }
Example #2
0
 void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel)
 {
     if (info.DelayRelativeTo == AttackDelayType.Preparation)
     {
         if (info.Delay > 0)
         {
             tick = info.Delay;
         }
         else
         {
             PlayAttackAnimation(self);
         }
     }
 }
Example #3
0
 void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
 {
     if (info.DelayRelativeTo == AttackDelayType.Attack)
     {
         if (info.Delay > 0)
         {
             tick = info.Delay;
         }
         else
         {
             PlaySound(self);
         }
     }
 }
Example #4
0
        // Ordered barrels should be produced and delivered.
        // If the customer has ordered several barrels of this beer style and those are not delivered yet, the brewery must deliver the earliest order (FIFO principle - First In First Out)
        public void CreateDeliveryBarrel(Guid id, BeerStyle beerStyle, DateTime deliveryDate)
        {
            var tempCustomer = customers.Where(o => o.Id == id).FirstOrDefault();

            // We select ordered barrels of this beer style and sort these by ascending
            LinkedList <Barrel> orderBarrels = new LinkedList <Barrel>(tempCustomer.OrderedBarrels.Where(o => o.BeerStyle.Equals(beerStyle)).OrderBy(o => o.OrderDate));

            // Get the barrel with the earliest order date and deliver it
            Barrel tempBarrel = orderBarrels.First.Value;

            tempBarrel.DeliveryDate = deliveryDate;
            tempCustomer.DeliveredBarrels.AddLast(tempBarrel);
            tempCustomer.OrderedBarrels.Remove(tempBarrel);
        }
Example #5
0
    public void LoadClip(int rounds)
    {
        Barrel barrel = (inventory.ActiveEntry.Value.Item as RangedWeapon).liveBarrel;

        int open = barrel.clipSize - clipCount;

        Magazine magazine = inventory.GetActiveMagazine();

        if (open <= 0)
        {
            Debug.Log("Clip Full");

            return;
        }

        if (rounds > open)
        {
            if (magazine.count >= open)
            {
                inventory.UnLoadActiveMagazine(open);

                clipCount += open;
            }

            else
            {
                inventory.UnLoadActiveMagazine(magazine.count);

                clipCount += magazine.count;
            }
        }

        else
        {
            if (magazine.count >= rounds)
            {
                inventory.UnLoadActiveMagazine(rounds);

                clipCount += rounds;
            }

            else
            {
                inventory.UnLoadActiveMagazine(magazine.count);

                clipCount += magazine.count;
            }
        }
    }
Example #6
0
        // The rate of fire of the dummy weapon determines the launch cycle as each shot
        // invokes Attacking()
        void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
        {
            if (IsTraitDisabled)
            {
                return;
            }

            if (a.Info.Name != Info.SpawnerArmamentName)
            {
                return;
            }

            // Issue retarget order for already launched ones
            foreach (var slave in slaveEntries)
            {
                if (slave.IsLaunched && slave.IsValid)
                {
                    slave.SpawnerSlave.Attack(slave.Actor, target);
                }
            }

            var se = GetLaunchable();

            if (se == null)
            {
                return;
            }

            se.IsLaunched = true;             // mark as launched

            // Launching condition is timed, so not saving the token.
            if (Info.LaunchingCondition != null)
            {
                conditionManager.GrantCondition(self, Info.LaunchingCondition);
            }
            ////conditionManager.GrantCondition(self, Info.LaunchingCondition, Info.LaunchingTicks);

            SpawnIntoWorld(self, se.Actor, self.CenterPosition);

            // Queue attack order, too.
            self.World.AddFrameEndTask(w =>
            {
                // The actor might had been trying to do something before entering the carrier.
                // Cancel whatever it was trying to do.
                se.SpawnerSlave.Stop(se.Actor);

                se.SpawnerSlave.Attack(se.Actor, target);
            });
        }
Example #7
0
 // Use this for initialization
 void Start()
 {
     host           = this.gameObject.transform.parent.GetComponent <BaseUnit>();
     barrel         = this.gameObject.GetComponentInChildren <Barrel>();
     weapon         = barrel.getWeapon();
     idleRotation   = transform.rotation;
     targetRotation = idleRotation;
     host.setupWeapons();
     if (debugging)
     {
         print("turned 45");
     }
     transform.Rotate(new Vector3(0, 1, 0), 45);
     InvokeRepeating("setDistances", .1f, .4f);
 }
 /// <summary>
 /// build stl files from ring data
 /// </summary>
 /// <param name="correctedRingList"></param>
 /// <param name="flatFileName"></param>
 /// <param name="rolledFileName"></param>
 static void SaveRolledSTLFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
 {
     try
     {
         var v3rolledPtList = correctedRingList.AsCartGridData();
         var _flatStlFile   = new StlFile();
         var trimesh        = new TriMesh();
         trimesh.BuildFromGrid(v3rolledPtList);
         StlFile.SaveBinary(trimesh, fileName);
     }
     catch (Exception)
     {
         throw;
     }
 }
        static void SaveFlatPlyFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, double unrollRadius, string fileName, IProgress <int> progress)
        {
            try
            {
                var outputFilename = BuildFileName(fileName, "_flat", ".ply");
                var colorCodedData = DataColorCode.ColorCodeData(barrel, options, correctedRingList, options.SurfaceColorCode);

                var v3FlatStripList = DataUtil.UnrollCylinder(colorCodedData, options.SurfaceFileScaleFactor, unrollRadius);
                SavePly(v3FlatStripList, outputFilename, progress);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #10
0
        /// <summary>
        /// In this class the second parameter is the number of paths
        /// </summary>
        /// <param name="pathdata"></param>
        /// <param name="increment"></param>
        /// <returns></returns>
        public ShapeCollection CreatePaths(PathData pathdata, double increment)
        {
            ShapeCollection pc = new ShapeCollection();

            pc.PatternName = pathdata.Name;
            if (pathdata.PathType == PatternType.barrel)
            {
                Barrel           b    = pathdata as Barrel;
                RadialOffsetPath path = b.OutlineAsOffsets((int)(1 / increment));
                Polygon          poly = CreatePolygonFrom(path, b.ToolPosition);
                (poly.RenderTransform as CompositeTransform).Rotation = b.Phase;
                pc.AddShape(poly);
            }
            return(pc);
        }
Example #11
0
    // Start is called before the first frame update
    public virtual void Start()
    {
        ufoPos        = GameObject.Find("UFO").transform; //find UFO Pos when tank spawns
        theTB         = FindObjectOfType <Barrel>();
        shootingRange = GameObject.Find("Shooting Range").transform;
        tankRb        = GetComponent <Rigidbody2D>();
        lM            = FindObjectOfType <LevelManager>();

        lM.currentNumOfTanks += 1; //add 1 tank to the current number of tanks
        healthSlider.gameObject.SetActive(false);

        ChangeMovementType(MovementType.stayIdle);

        //Invoke("Patrol", 5);
    }
Example #12
0
        private bool AllowChargedEjectionOnUp(Barrel barrel)
        {
            if (barrel.triggerType != Barrel.TriggerType.Charged)
            {
                return(false);
            }

            bool ejectCharged = barrel.charged && barrel.ejectChargedOnUp;

            if (!ejectCharged && barrel.ejectChargedOnUp && barrel.HasQueue)
            {
                ejectCharged = true;
            }
            return(ejectCharged);
        }
Example #13
0
 public Barrel TakeBarrelFromInventory(int index)
 {
     if (index <= barrels.Count - 1)
     {
         Barrel returnItem = barrels[index];
         barrels.RemoveAt(index);
         return(returnItem);
     }
     else
     {
         Barrel returnItem = barrels[barrels.Count - 1];
         barrels.RemoveAt(barrels.Count - 1);
         return(returnItem);
     }
 }
        public BarrelXsectionProfile(Barrel barrel, DataOutputOptions options, int currentPassCount, double axialLocation, string machineSpeedFileName)
        {
            _options       = options;
            _currentPassCt = currentPassCount;

            _barrel   = barrel;
            _axialLoc = axialLocation;

            _nominalLandDiam = _barrel.DimensionData.ActualLandDiam;


            _machineSpeedList = new MachineRasterSpeeds(machineSpeedFileName);

            BuildMeasurementSet();
        }
Example #15
0
    protected override void Start()
    {
        // Spawn bombs!
        for (int i = 0; i < max_bombs; ++i)
        {
            GameObject obj = Instantiate(barrel_prefab, owning_player.transform.position + new Vector3(0, 5, 0), Quaternion.identity);

            Barrel bomb = obj.GetComponent <Barrel>();
            bomb.owning_player = owning_player;

            GenerateDropVector(bomb);
        }

        Destroy(gameObject);
    }
Example #16
0
    //When calling this function, the grenade will explode
    void Explode()
    {
        Instantiate(explosionEffect, transform.position, transform.rotation);
        Collider[] collidersToDestroy = Physics.OverlapSphere(transform.position, radius);

        //This will reach all the objects that are near the grenade explosion that could take damage from grenade's explosion
        foreach (Collider nearbyObject in collidersToDestroy)
        {
            Destructible dest   = nearbyObject.GetComponent <Destructible>();
            Barrel       barrel = nearbyObject.GetComponent <Barrel>();
            EnemyHealth  enemy  = nearbyObject.GetComponent <EnemyHealth>();

            //The destructible will take damage
            if (dest != null)
            {
                dest.TakeDamage(damage);
            }

            //The barrels will take damage
            if (barrel != null)
            {
                barrel.TakeDamage(damage);
            }

            //The enemies will take damage
            if (enemy != null)
            {
                enemy.TakeDamage(damage);
            }
        }

        Collider[] collidersToMove = Physics.OverlapSphere(transform.position, radius);

        //This will reach the objects nearby that could be moved, which means that when the barrel exploses close to them, they will move a little
        foreach (Collider nearbyObject in collidersToMove)
        {
            Rigidbody rb = nearbyObject.GetComponent <Rigidbody>();

            //The objects will response to the gravity force
            if (rb != null)
            {
                rb.AddExplosionForce(force, transform.position, radius);
            }
        }

        //At the last grenade will get destroyed
        Destroy(gameObject);
    }
        static void SaveRolledPlyFile(Barrel barrel, DataOutputOptions options, CylGridData correctedRingList, string fileName, IProgress <int> progress)
        {
            try
            {
                var outputFilename = BuildFileName(fileName, "_rolled", ".ply");

                var colorCodedData = DataColorCode.ColorCodeData(barrel, options, correctedRingList, options.SurfaceColorCode);

                var v3StripList = colorCodedData.AsCartGridData();
                SavePly(v3StripList, outputFilename, progress);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #18
0
    void Start()
    {
        gameState = GameState.INGAME;

        Time.timeScale = 1;

        mouseActivate = false;

        barScript = barrel.GetComponent <Barrel> ();


        foreach (GameObject enemy in enemyList)
        {
            enemyList.Add(enemy);
        }
    }
Example #19
0
    static Barrel FindClosestBarrel(int x, int y, int currentOrientation)
    {
        Barrel res     = null;
        int    minDist = int.MaxValue;

        foreach (var bar in barrels.Where(b => !b.Used))
        {
            int dist = HexagonDist(x, y, bar.X, bar.Y, currentOrientation);
            if (dist < minDist)
            {
                minDist = dist;
                res     = bar;
            }
        }
        return(res);
    }
Example #20
0
    /**
     * @pre: None.
     * @post: Gun's parts should be rolled, ready for stats to be calculated.
     * @param: None.
     * @return: Stub for now, should return if build occurs with no issues function returns correctly.
     */

    public override bool BuildGun()
    {
        parts          = new GunPart[NUM_PARTS];
        ammo           = Instantiate(RollAmmo(), this.transform);
        barrel         = Instantiate(RollBarrel(), this.transform);
        caliber        = Instantiate(RollCaliber(), this.transform);
        cyclicModifier = Instantiate(RollCyclicModifier(), this.transform);
        cyclicModifier.Attach(this);
        magazine    = Instantiate(RollMagazine(), this.transform);
        sight       = Instantiate(RollSight(), this.transform);
        stock       = Instantiate(RollStock(), this.transform);
        underBarrel = Instantiate(RollUnderBarrel(), this.transform);
        underBarrel.Attach(this);
        readyForUse = true;
        return(true);
    }
    private Transform[] CollectAllTransforms(AoEDamageEvent aoeEvent)
    {
        Transform[] aiTransforms     = AI_Behaviour.GetEnemiesWithinRadius(aoeEvent.SourcePosition, aoeEvent.Radius);
        Transform[] barrelTransforms = Barrel.GetBarrelsWithinRadius(aoeEvent.SourcePosition, aoeEvent.Radius);
        Transform[] all = new Transform[aiTransforms.Length + barrelTransforms.Length + 1];
        aiTransforms.CopyTo(all, 0);
        barrelTransforms.CopyTo(all, 0);

        if (Vector3.Distance(PlayerController.Position, aoeEvent.SourcePosition) < aoeEvent.Radius)
        {
            Transform playerTransform = PlayerController.GameObject.transform;
            all[all.Length - 1] = playerTransform;
        }

        return(all);
    }
Example #22
0
 public void CheckForCombo(List <Tile> comboTiles, Tile currentTile, bool usingCombo)
 {
     //print("CHECK FOR COMBO : " + currentTile);
     if (currentTile != null && !IsWall(currentTile) && !IsWater(currentTile))
     {
         comboTiles.Add(currentTile);
         if (currentTile.GetPawnOnTile() is Barrel)
         {
             Barrel barrel = currentTile.GetPawnOnTile() as Barrel;
             if (!ComboManager.instance.BarrelAlreadyInCombo(barrel))
             {
                 comboTiles.AddRange(ComboManager.instance.AddBarrelToComboPreview(barrel, usingCombo));
             }
         }
     }
 }
        public void MonkeyCache_FileStore()
        {
            var barrel = Barrel.Create(DirectoryPath);

            LoopAction(Iterations, () =>
            {
                barrel.Add("TestKey", 123, TimeSpan.FromDays(1));
                barrel.Get <int>("TestKey");

                var getOrSetResult = barrel.Get <string>("GetOrSet_TestKey");
                if (getOrSetResult == null)
                {
                    barrel.Add("GetOrSet_TestKey", "Hello World", TimeSpan.FromDays(1));
                }
            });
        }
Example #24
0
    private void Shoot()
    {
        gunAnimation.ApplyRecoil();
        _muzzleFlash.Play();
        _muzzleFlash.Play();
        playerAmmo.currentDMRAmmo--;
        gunShot.Play();

        //shot spread
        Quaternion rotation       = Quaternion.LookRotation(_playerCam.transform.forward);
        Quaternion randomRotation = Random.rotation;

        rotation = Quaternion.RotateTowards(rotation, randomRotation, Random.Range(0f, _spreadAngle));

        //checks raycast hit
        RaycastHit hit;

        if (Physics.Raycast(_playerCam.transform.position, rotation * Vector3.forward, out hit, _range))
        {
            CritTarget critTarget = hit.transform.GetComponentInChildren <CritTarget>();
            if (critTarget != null)
            {
                critTarget.TakeDamage(DamageFallOff(hit));
            }

            Target target = hit.transform.GetComponentInChildren <Target>();
            if (target != null)
            {
                target.TakeDamage(DamageFallOff(hit));
            }

            Barrel barrel = hit.transform.GetComponent <Barrel>();
            if (barrel != null)
            {
                barrel.TakeDamage(_maxDamage);
            }

            if (hit.rigidbody != null)
            {
                hit.rigidbody.AddForce(-hit.normal * _impactForce);
            }

            GameObject Impact = Instantiate(_impactEffect, hit.point, Quaternion.LookRotation(hit.normal));
            Impact.transform.SetParent(hit.transform);
            Destroy(Impact, _impactTime);
        }
    }
    private void Shoot()
    {
        _anim.Play("Shooting", 0, 0);
        // Reset the timer.
        _timer = 0f;
        // Play the gun shot audioclip.
        _gunAudioSource.Play();
        // Enable the light.
        _gunLight.enabled = true;
        // Stop the particles from playing if they were, then start the particles.
        //_gunParticleSystem.Stop();
        _gunParticleSystem.Play();
        // Enable the line renderer and set it's first position to be the end of the gun.
        //_gunLineRenderer.enabled = true;
        _gunLineRenderer.SetPosition(0, transform.position);
        // Set the shootRay so that it starts at the end of the gun and points forward from the barrel.
        _shootRay.origin    = transform.position;
        _shootRay.direction = transform.forward;
        if (Physics.Raycast(_shootRay, out _shootHit, range, _shootableMask))
        {
            // Try and find an EnemyHealth script on the gameobject hit.
            Barrel barrel = _shootHit.collider.GetComponent <Barrel>();
            if (barrel != null)
            {
                barrel.Death();
            }

            //EnemyHealth enemyHealth = shootHit.collider.GetComponent<EnemyHealth>();

            // If the EnemyHealth component exist...
            //if (enemyHealth != null)
            //{
            // ... the enemy should take damage.
            //  enemyHealth.TakeDamage(damagePerShot, shootHit.point);
            //}

            // Set the second position of the line renderer to the point the raycast hit.
            _gunLineRenderer.SetPosition(1, _shootHit.point);
            Debug.Log("Shot Barrel");
        }
        // If the raycast didn't hit anything on the shootable layer...
        else
        {
            // ... set the second position of the line renderer to the fullest extent of the gun's range.
            _gunLineRenderer.SetPosition(1, _shootRay.origin + _shootRay.direction * range);
        }
    }
Example #26
0
        protected override WVec CalculateMuzzleOffset(Actor self, Barrel barrel)
        {
            var offset = base.CalculateMuzzleOffset(self, barrel);

            if (this.wsb.DefaultAnimation.CurrentSequence is not OffsetsSpriteSequence sequence)
            {
                return(offset);
            }

            var wst         = self.TraitOrDefault <WithOffsetsSpriteTurret>();
            var weaponPoint = this.info.BurstOffsets[(this.Weapon.Burst - this.Burst) % this.info.BurstOffsets.Length];

            var sprite = this.wsb.DefaultAnimation.Image;

            if (sequence.EmbeddedOffsets.ContainsKey(sprite))
            {
                var offsets = sequence.EmbeddedOffsets[sprite];
                var weaponOrTurretOffset = offsets.FirstOrDefault(p => p.Id == (wst == null ? weaponPoint : 0));

                if (weaponOrTurretOffset != null)
                {
                    offset = new(offset.X + weaponOrTurretOffset.X * 32, offset.Y + weaponOrTurretOffset.Y * 32, offset.Z);
                }
            }

            if (wst?.DefaultAnimation.CurrentSequence is not OffsetsSpriteSequence turretSequence)
            {
                return(offset);
            }

            sprite = wst.DefaultAnimation.Image;

            if (!turretSequence.EmbeddedOffsets.ContainsKey(sprite))
            {
                return(offset);
            }

            var turretOffsets = turretSequence.EmbeddedOffsets[sprite];
            var weaponOffset  = turretOffsets.FirstOrDefault(p => p.Id == weaponPoint);

            if (weaponOffset != null)
            {
                offset = new(offset.X + weaponOffset.X * 32, offset.Y + weaponOffset.Y * 32, offset.Z);
            }

            return(offset);
        }
Example #27
0
            internal static void AttackBarrel()
            {
                if (livebarrels.Count == 0)
                {
                    return;
                }
                Barrel bartar = Math.ClosestBarrel(Player.ServerPosition.To2D());

                if (bartar == null)
                {
                    return;
                }
                if (Player.ServerPosition.Distance(bartar.BarrelObj.Position) < Player.AttackRange && bartar.BarrelObj.IsValidTarget() && bartar.BarrelObj.IsTargetable)
                {
                    Player.IssueOrder(GameObjectOrder.AttackUnit, bartar.BarrelObj);
                }
            }
Example #28
0
        /// <summary>
        /// 技能行为发生时的动作
        /// </summary>
        public override void SkillAction()
        {
            int     n = (int)AODGameLibrary.Helpers.RandomHelper.RandomInt(0, 7);
            Vector3 m;

            if (MargedUnit.Target.Position - MargedUnit.SkillPosition(n) != Vector3.Zero)
            {
                m = Vector3.Normalize(MargedUnit.Target.Position - MargedUnit.SkillPosition(n));
            }
            else
            {
                m = MargedUnit.Face;
            }

            ParticleLine pl;

            pl = (ParticleLine)GameWorld.Content.Load <ParticleLine>(EffectLine).Clone();

            pl.Origin    = MargedUnit.SkillPosition(n);
            pl.Direction = m;
            GameWorld.AddParticleShape(pl);
            pl.Flash();

            Barrel b = new Barrel(MargedUnit.SkillPosition(n), m, FloatValues[0], FloatValues[1], FloatValues[2]);

            foreach (VioableUnit u in GameWorld.GameItemManager.BoundingCollection)
            {
                if (u != null && u != MargedUnit)
                {
                    if (Vector3.Distance(u.Position, MargedUnit.Position) < Range)
                    {
                        if (Collision.IsCollided(u, b))
                        {
                            u.GetDamage(Damage.CreateFromDamage(Damage.CreateFromDamage(Damage, MargedUnit), MargedUnit));
                            if (!u.Heavy)
                            {
                                u.GetImpulse(m * FloatValues[3]);
                            }
                        }
                    }
                }
                Color c = Color.BlueViolet;
                c.A = (byte)(0.1f * c.A);
                GameWorld.ScreenEffectManager.Blink(c, 0.2f);
            }
        }
Example #29
0
        public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
        {
            if (a.Info.Name != info.Armament)
            {
                return;
            }

            visible[barrel] = true;
            var sequence = info.Sequence;

            if (info.SplitFacings)
            {
                sequence += Traits.Util.QuantizeFacing(getFacing(), info.FacingCount).ToString();
            }

            anims[barrel].Animation.PlayThen(sequence, () => visible[barrel] = false);
        }
Example #30
0
        void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
        {
            if (a == null || barrel == null || !armaments.Contains(a))
            {
                return;
            }

            var sequence = a.Info.MuzzleSequence;

            if (a.Info.MuzzleSplitFacings > 0)
            {
                sequence += Util.QuantizeFacing(getFacing(), a.Info.MuzzleSplitFacings).ToString();
            }

            visible[barrel] = true;
            anims[barrel].Animation.PlayThen(sequence, () => visible[barrel] = false);
        }
Example #31
0
        protected override void RegisterTypes(IContainerRegistry containerRegistry)
        {
            containerRegistry.RegisterSingleton <IAppInfo, AppInfoImplementation>();
            containerRegistry.RegisterForNavigation <NavigationPage>();
            containerRegistry.RegisterForNavigation <EquipmentPage, EquipmentPageViewModel>();
            containerRegistry.RegisterForNavigation <AddOrEditEquipmentPage, AddOrEditEquipmentPageViewModel>();
            containerRegistry.RegisterForNavigation <ViewEquipmentPage, ViewEquipmentPageViewModel>();
            containerRegistry.AutoRegisterByInterfaceName("IGetAll");
            containerRegistry.AutoRegisterByInterfaceName("IPost");
            containerRegistry.AutoRegisterByInterfaceName("IPut");
            containerRegistry.AutoRegisterByInterfaceName("IGet");
            Barrel.Create(OfflineDatabasePath());
            Barrel.ApplicationId = "LocalDb";

            containerRegistry.RegisterInstance(CrossMedia.Current);
            containerRegistry.RegisterInstance(Barrel.Current);
        }
Example #32
0
 public static void chainManagerOnDelete(Barrel deletedBarrel)
 {
     //Pour chaque chaine de barrils
     for (int i=0;i<barrelChains.Count;i++)
     {
         if(barrelChains[i].Contains(deletedBarrel)) //Si la chaine contient ce barril
         {
             //On l'enleve
             int index = barrelChains[i].IndexOf(deletedBarrel);
             barrelChains[i].RemoveAt(index);
             //Si la chaine contient que ce barril, on enleve toute la chaine
             if(barrelChains[i].Count==0)
             {
                 barrelChains.RemoveAt(i);
             }
         }
     }
 }
Example #33
0
 //Correct given position so it will connect to barrel to that position at max range
 public static Vector2 correctThisPosition(Vector2 position, Barrel barrelToConnect)
 {
     double vX = position.X - barrelToConnect.barrel.Position.X;
     double vY = position.Y - barrelToConnect.barrel.Position.Y;
     double magV = Math.Sqrt(vX * vX + vY * vY);
     double aX = Math.Round(barrelToConnect.barrel.Position.X + vX / magV * 680);
     double aY = Math.Round(barrelToConnect.barrel.Position.Y + vY / magV * 680);
     Vector2 newPosition = new Vector2(Convert.ToInt32(aX), Convert.ToInt32(aY));
     return newPosition;
 }
Example #34
0
 void INotifyAttack.Attacking(Actor self, Target target, Armament a, Barrel barrel)
 {
     if (a != null && a.Info.AmmoPoolName == Info.Name)
         TakeAmmo();
 }
Example #35
0
 void INotifyAttack.PreparingAttack(Actor self, Target target, Armament a, Barrel barrel)
 {
 }
Example #36
0
        private static void Game_OnUpdate(EventArgs args)
        {
            if (Player.IsDead) return;
            if (GetBool("main.settings.r")) Casts.R();
            if (GetBool("main.settings.ignite")) Casts.Ignite();
            if (ManalimiterCheck("main.settings.w.wm") && GetBool("main.settings.w.enabled")) Casts.W();
            targetedBarrelQ = null;
            targetedBarrelQ = Math.ClosestBarrelWherePosInExplosionRange(Player.ServerPosition.To2D());
            if (GetBool("main.settings.aqe")) Casts.AQE();

            switch (orbwalker.ActiveMode)
            {
                case Orbwalking.OrbwalkingMode.Combo:
                    Combo();
                    break;
                case Orbwalking.OrbwalkingMode.Mixed:
                    Harass();
                    break;
                case Orbwalking.OrbwalkingMode.LaneClear:
                case Orbwalking.OrbwalkingMode.LastHit:
                    Clear();
                    break;
            }
        }
Example #37
0
 public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
 {
     --charges;
     timeToRecharge = info.ReloadDelay;
 }
 private void DrawingSurface_Loaded(object sender, RoutedEventArgs e)
 {
     var el = new Barrel(new Point(100, 100));
     AddElement(el);
     el = new Barrel(new Point(210, 210));
     AddElement(el);
 }
Example #39
0
 public void Attacking(Actor self, Target target, Armament a, Barrel barrel)
 {
     if (a.Info.AmmoPoolName == Info.Name)
         TakeAmmo();
 }
Example #40
0
        //Donne le barril le plus proche d'une position pour enchainer jusuqu'au barril donné
        public static Barrel giveClosestToChainToBarrel(Vector3 closestToThisPosition, Barrel barrelToChainTo)
        {
            Barrel closest = null;
            //Cherche la chaine contenant ce barril
            for (int i=0;i<barrelChains.Count;i++)
            {
                if (barrelChains[i].Contains(barrelToChainTo))
                {
                    for (int k=0;k<barrelChains[i].Count;k++)
                    {
                        if (!barrelChains[i].Any())
                            return null;
                        float bestSoFar = -1;

                        for (int j = 0; j < barrelChains[i].Count; j++)
                        {
                            if (bestSoFar == -1 || barrelChains[i][j].barrel.Distance(closestToThisPosition) < bestSoFar)
                            {
                                bestSoFar = barrelChains[i][j].barrel.Distance(closestToThisPosition);
                                closest = barrelChains[i][j];
                            }
                        }
                    }
                }
            }
            return closest;
        }