コード例 #1
0
ファイル: Puck.cs プロジェクト: bluquar/electricfieldhockey
        public static Puck GetPuck(PuckType type)
        {
            List <PuckDef> defs = new List <PuckDef>();

            foreach (PuckDef pd in puckDefs)
            {
                if (pd._type == type)
                {
                    defs.Add(pd);
                    break;
                }
            }

            Puck p = new Puck(defs[0]);

            p.XAcceleration = 0;
            p.XVelocity     = 0;
            p.YAcceleration = 0;
            p.YVelocity     = 0;


            return(p);
        }
コード例 #2
0
        private void CreatePuck(float x, float y, PuckType type)
        {
            Puck p = Puck.GetPuck(type);

            p.XPosition = x;
            p.YPosition = y;

            p.XPositionPrevious = x;
            p.YPositionPrevious = y;

            if (_levelSelected == 5)
            {
                p.XVelocity = 10;
            }

            p.Trail = new List <Point>();
            p.Trail.Add(new Point((int)x, (int)y));
            p.Trail.Add(new Point((int)x, (int)y));

            p.Bitmap = _puckBitmaps[p.BmpID];

            _activeGameObjects.Add(p);
            _activePucks.Add(p);
        }