private void ObstacleOnOnHit( IObstacle bumper ) {
     AudioClip randomClip = HitAudioClips.GetRandom();
     if ( randomClip != null ) {
         m_audioSource.clip = randomClip;
         m_audioSource.Play();
     }
     else {
         Debug.LogWarningFormat( "#{0}# No available audio sources.", GetType().Name );
     }
 }
Example #2
0
        protected bool PhaseCanceled(Unit9 ally, IObstacle obstacle, UsableAbility usableAbility)
        {
            if (!ally.IsCasting || !ally.IsControllable)
            {
                return true;
            }

            if (usableAbility?.Owner?.Equals(ally) == false)
            {
                return true;
            }

            var isDisable = obstacle.EvadableAbility.Ability is IDisable disable && (disable.IsStun() || disable.IsSilence());

            if (!isDisable)
            {
                return false;
            }

            ally.BaseUnit.Stop(false, true);
            return true;
        }
Example #3
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!base.CanBeCasted(ally, enemy, obstacle))
            {
                return(false);
            }

            if (this.attributeShiftStr.Enabled)
            {
                return(false);
            }

            if (!ally.CanBeHealed)
            {
                return(false);
            }

            if (ally.Agility <= 1)
            {
                return(false);
            }

            if (ally.Health > 2000)
            {
                if (this.forceUse.Contains(obstacle.EvadableAbility.Ability.Id))
                {
                    return(true);
                }

                if (this.attributeShiftAgi.Enabled)
                {
                    return(true);
                }

                return(false);
            }

            return(true);
        }
Example #4
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.IsAbilityEnabled(obstacle))
            {
                return(false);
            }

            if (!this.Ability.CanBeCasted(false))
            {
                return(false);
            }

            var castRange = this.ActiveAbility.CastRange;
            var radius    = this.ActiveAbility.Radius;
            var jumpRange = this.firesnapCookie.JumpRange;
            var maxRange  = this.ActiveAbility.Range;
            var minRange  = jumpRange - radius;

            var targets = EntityManager9.Units.Where(
                x => x.IsUnit && (x.IsMyHero || (!x.IsHero || x.IsIllusion)) && x.IsAlly(this.Owner) && x.IsAlive &&
                x.Distance(enemy) < maxRange && x.Distance(enemy) > minRange && x.Distance(this.Owner) < castRange)
                          .OrderBy(x => x.IsMyHero);

            foreach (var unit in targets)
            {
                var delay              = this.ActiveAbility.GetCastDelay(unit);
                var targetPosition     = unit.GetPredictedPosition(delay - this.ActiveAbility.ActivationDelay);
                var targetJumpPosition = targetPosition.Extend2D(unit.InFront(2000), jumpRange);
                var enemyPosition      = enemy.GetPredictedPosition(delay);

                if (targetJumpPosition.Distance2D(enemyPosition) < radius)
                {
                    this.target = unit;
                    return(true);
                }
            }

            return(false);
        }
Example #5
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!base.CanBeCasted(ally, enemy, obstacle))
            {
                return(false);
            }

            //todo check if target is in obstacle
            this.blinkTarget = EntityManager9.Units
                               .Where(
                x => x.IsUnit && !x.Equals(this.Owner) && x.IsAlive && !x.IsInvulnerable && x.IsAlly(ally) &&
                x.Distance(ally) < this.ActiveAbility.CastRange && x.Distance(ally) > this.ActiveAbility.CastRange / 3)
                               .OrderBy(x => x.Distance(this.FountainPosition))
                               .FirstOrDefault();

            if (this.blinkTarget == null)
            {
                return(false);
            }

            return(true);
        }
Example #6
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!base.CanBeCasted(ally, enemy, obstacle))
            {
                return(false);
            }

            var health = ally.Health;
            var damage = obstacle.GetDamage(ally);

            if (damage < health)
            {
                return(false);
            }

            if (this.healAbility == null)
            {
                //grave etc.
                return(true);
            }

            if (!ally.CanBeHealed)
            {
                return(false);
            }

            if (ally.MaximumHealth - health < damage)
            {
                return(false);
            }

            if (damage >= health + this.healAbility.GetHealthRestore(ally))
            {
                return(false);
            }

            return(true);
        }
Example #7
0
        public bool IsObstacleIgnored(Unit9 unit, IObstacle obstacle)
        {
            if (this.LevelIgnore > 0 && this.Ability.Level <= this.LevelIgnore)
            {
                return(true);
            }

            if (this.TimeIgnore > 0 && Game.GameTime / 60 > this.TimeIgnore)
            {
                return(true);
            }

            if (this.DamageIgnore > 0)
            {
                var damagePercentage = (obstacle.GetDamage(unit) / unit.Health) * 100;
                if (damagePercentage < this.DamageIgnore)
                {
                    return(true);
                }
            }

            return(false);
        }
Example #8
0
 public void FindClosestObstacle()
 {
     m_CurrentClosestDistance = m_InteractMaxDist;
     m_ClosestObstacle        = null;
     for (int i = 0; i < GameManager.Instance.getAllObstacleCount(); i++)
     {
         if (GameManager.Instance.m_AllObstacles[i] != null && GameManager.Instance.m_AllObstacles[i] is IObstacle &&
             (GameManager.Instance.m_AllObstacles[i] as IObstacle).m_CanBeInteractedWith)
         {
             float oDist = Vector2.Distance(m_PlayerInfo.position, GameManager.Instance.m_AllObstacles[i].transform.position);
             if (oDist < m_CurrentClosestDistance)
             {
                 m_ClosestObstacle        = GameManager.Instance.m_AllObstacles[i] as IObstacle;
                 m_CurrentClosestDistance = oDist;
             }
             GameManager.Instance.m_AllObstacles[i].GetComponent <SpriteRenderer>().color = Color.white;
         }
     }
     if (m_ClosestObstacle != null)
     {
         m_ClosestObstacle.GetComponent <SpriteRenderer>().color = Color.yellow;
     }
 }
Example #9
0
        public override bool CanBeCasted(Unit9 ally, Unit9 enemy, IObstacle obstacle)
        {
            if (!this.enabled.IsActive)
            {
                return(false);
            }

            var ability = obstacle.EvadableAbility.Ability;

            if (ability.IsDisable())
            {
                if (ally.StatusResist >= 0.75)
                {
                    return(false);
                }
            }
            else if (!ability.IsUltimate && obstacle.GetDamage(ally) < ally.Health)
            {
                return(false);
            }

            return(base.CanBeCasted(ally, enemy, obstacle));
        }
Example #10
0
    private void OnTriggerEnter(Collider other)
    {
        Laser laser = other.GetComponentInParent <Laser>();

        if (laser != null)         // Ignore if we collided with laser.
        {
            return;
        }

        IObstacle obstacle = other.GetComponentInParent <IObstacle>();

        if (obstacle == null || causerObstacle == obstacle ||     // || IsChild(laser) || IsParent(laser)
            hittedObstacle == obstacle)
        {
            return;
        }

        Debug.Log("OnTriggerEnter: " + color.ToString() + ", Other: " + other.transform.parent.name);

        DrawLaser(false, true);
        // Let registered objects know, that this laser changed.
        OnObjectChanged?.Invoke();
    }
Example #11
0
    void ReadObstacleSet(XElement element)
    {
        IList <IObstacle> obstacles = new List <IObstacle>();

        foreach (XElement subElement in element.Elements("Obstacle"))
        {
            IObstacle template = _objectStorage.ObstacleTemplates[subElement.Attribute("type").Value];

            float     x        = float.Parse(subElement.Attribute("x").Value);
            float     y        = float.Parse(subElement.Attribute("y").Value);
            float     z        = float.Parse(subElement.Attribute("z").Value);
            IObstacle obstacle = new Obstacle
            {
                Alias         = template.ObstacleType.ToString(),
                ObstacleType  = template.ObstacleType,
                SpawnPosition = new Vector3(x, y, z),
                DamagePercent = template.DamagePercent,
                Health        = template.Health
            };
            obstacles.Add(obstacle);
        }
        _objectStorage.ObstacleSet.Add(int.Parse(element.Attribute("id").Value), obstacles);
    }
Example #12
0
    public void SetHittedObstacle(IObstacle obstacle)
    {
        if (hittedObstacle != null)
        {
            hittedObstacle.OnObjectChanged -= OnObstacleChanged;
        }
        if (obstacle != null)
        {
            obstacle.OnObjectChanged += OnObstacleChanged;
        }

        hittedObstacle = obstacle;
        MonoBehaviour mb = obstacle as MonoBehaviour;

        if (mb != null)
        {
            hittedObstacleGO = mb.gameObject;
        }
        else
        {
            hittedObstacleGO = null;
        }
    }
Example #13
0
    private void CalcDestination(RaycastHit[] hits, out IObstacle obstacle, out Vector3 hitPoint, out Vector3 hitNormal)
    {
        foreach (RaycastHit hit in hits)
        {
            obstacle = hit.collider ? hit.collider.GetComponentInParent <IObstacle>() : null;
            if (obstacle == null)
            {
                continue;
            }

            // Calculating laser hit position with obstacle.
            bool isBlock = obstacle.CalcLaserHitPos(this, hit.point, hit.normal, out hitPoint, out hitNormal);
            if (isBlock)
            {
                Debug.Log("CalcDestination: " + color.ToString());
                return;
            }
        }
        // If nothing blocking the laser.
        obstacle  = null;
        hitPoint  = transform.position + transform.forward * maxLaserLength;
        hitNormal = Vector3.zero;
        return;
    }
Example #14
0
    private float IsHit(IObstacle obstacle)
    {
        foreach (var key in _objectStorage.Bullets.Keys)
        {
            foreach (IBullet bullet in _objectStorage.Bullets[key])
            {
                if (IsActive(obstacle.Collider2D) && bullet.Collider2D.IsTouching(obstacle.Collider2D))
                {
                    switch (obstacle.ObstacleType)
                    {
                    case ObstacleType.WallType1:
                    case ObstacleType.WallType3:
                    case ObstacleType.WallType4:
                    {
                        bullet.GameObject.SetActive(false);
                        return(0);
                    }

                    case ObstacleType.WallType5:
                    case ObstacleType.WallType6:
                    {
                        bullet.GameObject.SetActive(false);
                        return(bullet.Damage);
                    }

                    case ObstacleType.WallType2:
                    case ObstacleType.WallType7:
                    {
                        return(0);
                    }
                    }
                }
            }
        }
        return(0);
    }
Example #15
0
    private IEnumerator DrawLaserByObstacleCoroutine(IObstacle obstacle, Vector3 hitPoint, Vector3 hitNormal)
    {
        Debug.Log("Drawing: " + color.ToString());
        IsDrawing = true;
        // Remove any children, if there are.
        RemoveChildren();
        // Setting new hitted obstacle.
        SetHittedObstacle(obstacle);
        // Actually drawing the laser.
        yield return(DrawLaserCoroutine(hitPoint));

        IsDrawing = false;
        if (obstacle != null)
        {
            Debug.DrawLine(hitPoint, hitPoint + hitNormal, Color.red, 10f);

            // SetHittedObstacle(null);
            // Notify the obstacle, that this laser hitted him.
            obstacle.OnLaserHitted(this, hitPoint, hitNormal);
            EnableHitEffects(hitNormal);

            // SetHittedObstacle(obstacle);
        }
    }
Example #16
0
 private void CalculateHealth(IEntity entity, float damage)
 {
     if (damage > 0)
     {
         IUnit unit = entity as IUnit;
         if (unit != null)
         {
             unit.Behaviour.CurrentHealth -= damage;
             if (unit.Behaviour.CurrentHealth <= 0)
             {
                 if (unit.UnitType != UnitType.Player)
                 {
                     ShowBonus(unit);
                     ShowCoin(unit);
                     CalculateExperience(unit.ExperienceValue);
                     _player.Behaviour.CurrentHealth += _player.Behaviour.Bloodthirstiness;
                 }
                 unit.GameObject.SetActive(false);
                 unit.Text.SetActive(false);
             }
         }
         IObstacle obstacle = entity as IObstacle;
         if (obstacle != null)
         {
             obstacle.Health -= damage;
             if (obstacle.Health <= 0)
             {
                 obstacle.GameObject.SetActive(false);
             }
         }
         //else
         //{
         //    unit.Behaviour.CurrentHealth -= damage;
         //}
     }
 }
Example #17
0
 public override bool IgnoreRemainingTime(IObstacle obstacle, UsableAbility usableAbility)
 {
     return(obstacle.IsModifierObstacle || obstacle is ChronosphereObstacle);
 }
Example #18
0
 public void RemoveStop(IObstacle stop)
 {
     _stops.Remove(stop);
     if (_stops.Count > 0)
     {
         NextStop = _stops.Select(s => s.WorldPosition.X - s.StopDistance).Min();
     }
     else
     {
         NextStop = null;
     }
 }
Example #19
0
 public override float GetRequiredTime(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     this.castPosition = enemy.Position.Extend2D(ally.Position, 250);
     return(this.ActiveAbility.GetHitTime(this.castPosition));
 }
 void Start()
 {
     _collider = GetComponent <CircleObstacle> ();
     h         = Random.Range(-1f, 1f);
     v         = Random.Range(-1f, 1f);
 }
Example #21
0
 // Adds obstacles to the game
 private void addToGame(List<IObstacle> list, IObstacle iObstacle)
 {
     list.Add(iObstacle);
     addToGame((Unit)iObstacle);
 }
Example #22
0
 public void HandlePendingCollisionWith(IObstacle obstacle) {
     if (IsOperational) {    // avoid initiating collision avoidance if dead but not yet destroyed
         // Note: no need to filter out other colliders as the CollisionDetection layer 
         // can only interact with itself or the AvoidableObstacle layer. Both use SphereColliders
         __WarnIfOrbitalEncounter(obstacle);
         _helm.HandlePendingCollisionWith(obstacle);
     }
 }
Example #23
0
            internal void HandlePendingCollisionWith(IObstacle obstacle) {
                if (_caPropulsionJobs == null) {
                    _caPropulsionJobs = new Dictionary<IObstacle, Job>(2);
                }
                DisengageForwardPropulsion();
                DisengageReversePropulsion();
                DisengageDriftCorrection();

                var mortalObstacle = obstacle as AMortalItem;
                if (mortalObstacle != null) {
                    // obstacle could die while we are avoiding collision
                    mortalObstacle.deathOneShot += CollidingObstacleDeathEventHandler;
                }

                //D.Log(ShowDebugLog, "{0} engaging Collision Avoidance to avoid {1}.", DebugName, obstacle.DebugName);
                EngageCollisionAvoidancePropulsionFor(obstacle);
            }
Example #24
0
        // Note: No need for TopographyPropChangedHandler as FullSpeedValues get changed when density (and therefore CurrentDrag) changes
        // No need for GameSpeedPropChangedHandler as speedPerSec is no longer used

        #endregion

        /// <summary>
        /// Handles a pending collision with the provided obstacle.
        /// </summary>
        /// <param name="obstacle">The obstacle.</param>
        internal void HandlePendingCollisionWith(IObstacle obstacle) {
            _engineRoom.HandlePendingCollisionWith(obstacle);
        }
Example #25
0
    public void OnBallDrop(IObstacle obstacle)
    {
        //Debug.Log("Bumper = " + obstacle.GetScore() + " " + obstacle.GetTrigger().name);
        Destroy(obstacle.GetTrigger().gameObject);

        TotalScore.Add(CurrentScore);
        CurrentScore = 0;
        CacheTotalScore = TotalScore.Sum();

        CreateBall(false);
    }
Example #26
0
 public void OnTriangle(IObstacle obstacle)
 {
     CurrentScore += obstacle.GetScore();
 }
Example #27
0
 public void OnNone(IObstacle obstacle)
 {
 }
Example #28
0
 public void OnBumper(IObstacle obstacle)
 {
     //Debug.Log("Bumper = " + obstacle.GetScore() + obstacle.GetTrigger().name);
     CurrentScore += obstacle.GetScore();
 }
Example #29
0
 public void OnBorder(IObstacle obstacle)
 {
 }
 private void OnHit(IObstacle obstacle)
 {
     DeactivateChild(obstacle);
 }
 private void RecordObstacleExitingWhilePaused(IObstacle obstacle) {
     if (_exitingObstaclesEncounteredWhilePaused == null) {
         _exitingObstaclesEncounteredWhilePaused = new List<IObstacle>();
     }
     if (CheckForPreviousPausedEntryOf(obstacle)) {
         // while paused, previously entered and now exited so eliminate record as no action should be taken when unpaused
         D.Warn("{0} removing exiting obstacle {1} already recorded as entered while paused.", DebugName, obstacle.DebugName);
         _enteringObstaclesEncounteredWhilePaused.Remove(obstacle);
         return;
     }
     _exitingObstaclesEncounteredWhilePaused.Add(obstacle);
 }
Example #32
0
 private void __WarnIfOrbitalEncounter(IObstacle obstacle) {
     if (CurrentState != ShipState.AssumingCloseOrbit && !IsInOrbit) {
         return;
     }
     string orbitStateMsg = null;
     if (CurrentState == ShipState.AssumingCloseOrbit) {
         orbitStateMsg = "assuming close";
     }
     else if (IsInCloseOrbit) {
         orbitStateMsg = "in close";
     }
     else if (IsInHighOrbit) {
         orbitStateMsg = "in high";
     }
     if (orbitStateMsg != null) {
         D.Warn("{0} has recorded a pending collision with {1} while {2} orbit.", DebugName, obstacle.DebugName, orbitStateMsg);
     }
 }
Example #33
0
 private static void DrawRectangle(IObstacle obstacle, Graphics g, System.Drawing.Color color)
 {
     var rectObstacle = (RectangleObstacle) obstacle;
     g.FillRectangle(new SolidBrush(System.Drawing.Color.FromArgb(128, color)), rectObstacle.X * 10, rectObstacle.Y * 10, rectObstacle.Width * 10, rectObstacle.Length * 10);
     g.DrawRectangle(new Pen(System.Drawing.Color.FromArgb(192, color)), rectObstacle.X * 10, rectObstacle.Y * 10, rectObstacle.Width * 10, rectObstacle.Length * 10);
     g.DrawEllipse(new Pen(color), rectObstacle.X * 10 - 2, rectObstacle.Y * 10 - 2, 4, 4);
     g.DrawEllipse(new Pen(color), (rectObstacle.X + rectObstacle.Width) * 10 - 2, rectObstacle.Y * 10 - 2, 4, 4);
     g.DrawEllipse(new Pen(color), (rectObstacle.X + rectObstacle.Width) * 10 - 2, (rectObstacle.Y + rectObstacle.Length) * 10 - 2, 4, 4);
     g.DrawEllipse(new Pen(color), rectObstacle.X * 10 - 2, (rectObstacle.Y + rectObstacle.Length) * 10 - 2, 4, 4);
 }
 private void OnEnable() {
     m_obstacle = GetComponent<IObstacle>();
     m_audioSource = GetComponent<AudioSource>();
     m_obstacle.OnHit += ObstacleOnOnHit;
 }
Example #35
0
 public void addToGame(IObstacle obstacle)
 {
     obstacles.Add(obstacle);
     addToGame((Unit)obstacle);
 }
Example #36
0
 public void HandlePendingCollisionAverted(IObstacle obstacle) {
     if (IsOperational) {
         _helm.HandlePendingCollisionAverted(obstacle);
     }
 }
Example #37
0
 protected virtual void DestroyObstacle(IObstacle obstacle)
 {
     Mars.RemoveObstacle(obstacle);
 }
Example #38
0
 public override bool Use(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     this.MoveCamera(this.movePosition);
     return(this.Owner.BaseUnit.Move(this.movePosition, false, true));
 }
Example #39
0
 public override bool IgnoreRemainingTime(IObstacle obstacle, UsableAbility usableAbility)
 {
     return(this.modifierCountersIgnoreTime.Contains(usableAbility.Ability.Id));
 }
Example #40
0
 public override bool Use(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     return(base.Use(enemy, enemy, obstacle));
 }
Example #41
0
 public override float GetRequiredTime(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     this.movePosition = this.Owner.Position.Extend2D(enemy.Position, 25);
     return(this.Owner.GetTurnTime(this.movePosition) + (GameManager.Ping / 2000f) + 0.05f);
 }
 private void DeactivateChild(IObstacle obstacle)
 {
     obstacle.IsObjectEnabled = false;
     Debug.Log("Child Deactivated. Current Children: " + ActiveChildren);
 }
Example #43
0
 public ToVector2ListAdapter(IObstacle obstacle)
     : this(obstacle.Polymer)
 {
 }
Example #44
0
            private void EngageCollisionAvoidancePropulsionFor(IObstacle obstacle) {
                D.Assert(!_caPropulsionJobs.ContainsKey(obstacle));
                Vector3 worldSpaceDirectionToAvoidCollision = (_shipData.Position - obstacle.Position).normalized;

                GameDate errorDate = new GameDate(new GameTimeDuration(5F));    // HACK
                string jobName = "{0}.CollisionAvoidanceJob".Inject(DebugName);
                Job caJob = _jobMgr.StartGameplayJob(OperateCollisionAvoidancePropulsionIn(worldSpaceDirectionToAvoidCollision, errorDate), jobName, isPausable: true, jobCompleted: (jobWasKilled) => {
                    D.Assert(jobWasKilled); // CA Jobs never complete naturally
                });
                _caPropulsionJobs.Add(obstacle, caJob);
            }
Example #45
0
 public override bool IgnoreRemainingTime(IObstacle obstacle, UsableAbility usableAbility)
 {
     return(obstacle is ModifierAllyObstacle);
 }
Example #46
0
            internal void HandlePendingCollisionAverted(IObstacle obstacle) {
                D.AssertNotNull(_caPropulsionJobs);

                Profiler.BeginSample("Local Reference variable creation", _ship);
                var mortalObstacle = obstacle as AMortalItem;
                Profiler.EndSample();
                if (mortalObstacle != null) {
                    Profiler.BeginSample("Unsubscribing to event", _ship);
                    mortalObstacle.deathOneShot -= CollidingObstacleDeathEventHandler;
                    Profiler.EndSample();
                }
                //D.Log(ShowDebugLog, "{0} dis-engaging Collision Avoidance for {1} as collision has been averted.", DebugName, obstacle.DebugName);

                Profiler.BeginSample("DisengageCA", _ship);
                DisengageCollisionAvoidancePropulsionFor(obstacle);
                Profiler.EndSample();

                if (!IsCollisionAvoidanceEngaged) {
                    // last CA Propulsion Job has completed
                    Profiler.BeginSample("Resume Propulsion", _ship);
                    EngageOrContinuePropulsion();   //ResumePropulsionAtIntendedSpeed(); // UNCLEAR resume propulsion while turning?
                    Profiler.EndSample();
                    if (_ship.IsTurning) {
                        // Turning so defer drift correction. Will engage when turn complete
                        return;
                    }
                    Profiler.BeginSample("Engage Drift Correction", _ship);
                    EngageDriftCorrection();
                    Profiler.EndSample();
                }
                else {
                    string caObstacles = _caPropulsionJobs.Keys.Select(obs => obs.DebugName).Concatenate();
                    D.Log(ShowDebugLog, "{0} cannot yet resume propulsion as collision avoidance remains engaged avoiding {1}.", DebugName, caObstacles);
                }
            }
Example #47
0
 public override bool Use(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     return(this.ActiveAbility.UseAbility(this.tree, false, true));
 }
Example #48
0
 private void DisengageCollisionAvoidancePropulsionFor(IObstacle obstacle) {
     D.Assert(_caPropulsionJobs.ContainsKey(obstacle), obstacle.DebugName);
     _caPropulsionJobs[obstacle].Kill();
     _caPropulsionJobs.Remove(obstacle);
 }
Example #49
0
 public override float GetRequiredTime(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     return(this.ActiveAbility.GetHitTime(this.tree.Position));
 }
 private void CheckLightSwitch( IObstacle sourceObject ) {
     foreach ( LightSwitch lightSwitch in m_lightSwitches ) {
         lightSwitch.IsEnabled = m_invert ? !sourceObject.IsObjectEnabled : sourceObject.IsObjectEnabled;
     }
 }
Example #51
0
 public override float GetRequiredTime(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     return(base.GetRequiredTime(ally, enemy, obstacle) + 0.1f);
 }
Example #52
0
 public void RemoveStop(IObstacle stop)
 {
     _stops.Remove(stop);
     //if (_stops.Count > 0)
     //{
     //    NextStop = _stops.Select(s => s.WorldPosition.X - s.StopDistance).Min();
     //}
     //else
     //{
     //    NextStop = null;
     //}
 }
 private void OnEnable() {
     m_lightSwitches = GetComponentsInChildren<LightSwitch>();
     m_obstacle = GetComponent<IObstacle>();
     m_obstacle.OnHit += CheckLightSwitch;
     CheckLightSwitch( m_obstacle );
 }
Example #54
0
 private static void DrawPolygon(IObstacle obstacle, Graphics g, System.Drawing.Color color)
 {
     var polygonObstacle = (PolygonObstacle) obstacle;
     var points = new System.Drawing.Point[polygonObstacle.Vertices.Count];
     for (var i = 0; i < polygonObstacle.Vertices.Count; i++)
     {
         points[i] = new System.Drawing.Point((int) polygonObstacle.Vertices[i].X*10, (int) polygonObstacle.Vertices[i].Y*10);
         g.DrawEllipse(new Pen(color), points[i].X - 2, points[i].Y - 2, 4, 4);
     }
     g.FillPolygon(new SolidBrush(System.Drawing.Color.FromArgb(128, color)), points);
     g.DrawPolygon(new Pen(System.Drawing.Color.FromArgb(192, color)), points);
 }
 /// <summary>
 /// Returns <c>true</c> if the provided exitingObstacle has also been
 /// recorded as having entered while paused, <c>false</c> otherwise.
 /// </summary>
 /// <param name="obstacle">The exitingObstacle.</param>
 /// <returns></returns>
 private bool CheckForPreviousPausedEntryOf(IObstacle exitingObstacle) {
     if (_enteringObstaclesEncounteredWhilePaused.IsNullOrEmpty()) {
         return false;
     }
     return _enteringObstaclesEncounteredWhilePaused.Contains(exitingObstacle);
 }
Example #56
0
 /// <summary>
 /// Handles a pending collision that was averted with the provided obstacle. 
 /// </summary>
 /// <param name="obstacle">The obstacle.</param>
 internal void HandlePendingCollisionAverted(IObstacle obstacle) {
     _engineRoom.HandlePendingCollisionAverted(obstacle);
 }
Example #57
0
 public override bool IgnoreRemainingTime(IObstacle obstacle, UsableAbility usableAbility)
 {
     return(true);
 }
Example #58
0
 public void AddStop(IObstacle stop)
 {
     _stops.Add(stop);
     //if (!NextStop.HasValue || NextStop.Value > (stop.WorldPosition.X - stop.StopDistance))
     //{
     //    NextStop = stop.WorldPosition.X - stop.StopDistance;
     //}
 }
Example #59
0
 public override bool Use(Unit9 ally, Unit9 enemy, IObstacle obstacle)
 {
     this.MoveCamera(this.tree.Position);
     return(this.ActiveAbility.UseAbility(this.tree, false, true));
 }
Example #60
0
 public void HostAsteroidGeneration(IObstacle astro)
 {
     generatedAsteroid = true;
     asteroid = astro;
 }