Пример #1
0
        public Solid Interaction()//o q este solido faz com os outros ao redor
        {
            DynamicSolid dynamicFound = null;

            if (Who is PlayableSolid)
            {
                var dinamics = DynamicSolid.DynamicSolids;// from dinm in solids where dinm is DynamicSolid select dinm;

                foreach (DynamicSolid solid in dinamics)
                {
                    if (solid.Equals(Who))
                    {
                        continue;
                    }
                    if (Yi < solid.Yf && Yf > solid.Yi && Xi < solid.Xf && Xf > solid.Xi)//se o solid eh candidato a colidir nos lados do solidMoving
                    {
                        dynamicFound = solid;
                        break;
                    }
                }
            }
            else
            {
                dynamicFound = GameManager.instance.player.box;
            }

            if (dynamicFound != null && dynamicFound.MyEnt != null)
            {
                dynamicFound.MyEnt.BeHit(Who.MyEnt.Hit(bonusDamage), Who.MyEnt);
            }
            TimesTicked = TimesToTick + 10;
            //DispatcherTimer
            return(dynamicFound);
            //return new Solid(0, 0, 0, 0);
        }
Пример #2
0
 public HitSolid(double xi, double yi, double width, double height, DynamicSolid who, double spd) : base(xi, yi, width, height, spd)
 {
     Background = new SolidColorBrush(Color.FromArgb(50, 50, 0, 0));
     //solids.Remove(this);
     g   = 0;
     Who = who;
     hits.Add(this);
 }