コード例 #1
0
        public void Update(Map map)
        {
            Update(map, this);
            PlayerTakeDamage(5, this);
            DamageToNPC(map, this);

            Vector2Object hitPos = null;

            if (OutOfmap(this, out hitPos) == true)
            {
            }

            if (RemoveOnMapCollision(map.MapTree, this, out hitPos) == true)
            {
            }

            if (CollisionWithMovables(map, this, out hitPos) == true)
            {
            }


            if (_wet == true)
            {
                Game1.mapLive.MapProjectiles.Remove(this);
            }
            else
            {
                if (CompareF.LineVsMap(map.WaterTree, _track).Count > 0)
                {
                    _velocity /= 4;
                }
            }
        }
コード例 #2
0
ファイル: RainDrop.cs プロジェクト: BlueBananasaurus/BP
        public void Update()
        {
            _oldPosition      = _position;
            _offset           = Vector2.Normalize(_velocity) * 32;
            _position        += _velocity * Game1.Delta;
            _track.Line.Start = _oldPosition;
            _track.Line.End   = _position + _offset;

            List <Vector2Object> intersectionsPlayer = CompareF.LineIntersectionRectangle(Game1.PlayerInstance.Boundary, new LineObject(Game1.PlayerInstance, _track.Line));

            //if (intersectionsPlayer != null && intersectionsPlayer.Count > 0)
            //{
            //    Game1.mapLive.mapParticles.Remove(this);
            //}

            //foreach (Inpc npc in npcs)
            //{
            //    List<VectorObject> intersections = CompareF.LineIntersectionRectangle(npc, new LineObject(npc, _track.Line));

            //    if (intersections != null && intersections.Count > 0)
            //    {
            //        Game1.mapLive.mapParticles.Remove(this);
            //        break;
            //    }
            //    else if (CompareF.RectangleVsVector2(npc.Boundary, _track.Line.End) == true)
            //    {
            //        Game1.mapLive.mapParticles.Remove(this);
            //        break;
            //    }
            //}

            if (CompareF.LineVsMap(Game1.mapLive.MapTree, _track).Count > 0)
            {
                Game1.mapLive.mapParticles.Remove(this);
            }

            //foreach (IRectangleGet rec in elevators)
            //{
            //    List<VectorObject> intersections = CompareF.LineIntersectionRectangle(rec,new LineObject(rec, _track.Line));

            //    if (intersections !=null && intersections.Count>0)
            //    {
            //        Game1.mapLive.mapParticles.Remove(this);
            //    }
            //    else if(CompareF.RectangleVsVector2(rec, _track.Line.End) == true)
            //    {
            //        Game1.mapLive.mapParticles.Remove(this);
            //    }
            //}

            if (CompareF.LineIntersectionRectangle(Game1.mapLive.MapBoundary, _track).Count > 0)
            {
                Game1.mapLive.mapParticles.Remove(this);
            }

            if (CompareF.RectangleFVsRectangleF(Camera2DGame.Boundary, _track.Line.LineBoundingBox()) == false)
            {
                Game1.mapLive.mapParticles.Remove(this);
            }
        }
コード例 #3
0
        public static bool StrikeLightning(Vector2 position, Inpc npc, short damage)
        {
            if (npc.Friendly == false)
            {
                if (LineSegmentF.Lenght(npc.Boundary.Origin, position) < 256)
                {
                    LineSegmentF _ray = new LineSegmentF(npc.Boundary.Origin, position);

                    if (CompareF.LineVsMap(Game1.mapLive.MapTree, new LineObject(Game1.mapLive, _ray)).Count == 0)
                    {
                        Game1.mapLive.mapLightings.Add(new Lightning(npc.Boundary.Origin, position, Game1.debug_thin, 6));
                        Game1.mapLive.mapLightings.Add(new Lightning(npc.Boundary.Origin, position, Game1.debug_thin, 2));
                        npc.Stun();
                        npc.Push(new Vector2(0, -0.2f));
                        npc.KineticDamage(damage);
                        Camera2DGame.Shake(5, position);

                        Sound _strikeSound = new Sound(Game1.soundElectro, position);
                        Game1.Sounds3D.Add(_strikeSound);
                        Game1.Sounds3D[Game1.Sounds3D.IndexOf(_strikeSound)].Play();
                    }
                    return(true);
                }
            }

            return(false);
        }
コード例 #4
0
 protected void GetWet(Map map)
 {
     if (_wet == false)
     {
         if (CompareF.LineVsMap(map.WaterTree, _track).Count > 0)
         {
             _wet = true;
         }
     }
 }
コード例 #5
0
        protected bool RemoveOnMapCollision(MapTreeHolder map, IProjectile projectile, out Vector2Object hit)
        {
            hit = null;

            if (CompareF.LineVsMap(map, _track).Count > 0)
            {
                hit = CompareF.NearestVector(_track.Line.Start, CompareF.LineVsMap(map, _track));
                Game1.mapLive.MapProjectiles.Remove(projectile);
                return(true);
            }
            return(false);
        }