Ejemplo n.º 1
0
        /*
         * Record an object to the starObjects list
         *
         */
        public void AddStarObject(int type, int row, int col)
        {
            // remember this object for later use
            StarObject s = new StarObject();

            s.Row  = row;   // row on sector map
            s.Col  = col;   // column on sector map
            s.Type = type;  // type of object

            // hit points for the object
            s.Health = (type == GameObjects.ASTEROID ? 20 : (type == GameObjects.KLINGON ? 80 : 100));
            starObjects.Add(s);
        }
Ejemplo n.º 2
0
        /*
         * Return the object located at row,col
         */
        public StarObject GetGameObject(int row, int col)
        {
            StarObject response = null;

            for (int i = 0; i < starObjects.Count(); i++)
            {
                if (starObjects.ElementAt(i).Row == row && starObjects.ElementAt(i).Col == col)
                {
                    response = starObjects.ElementAt(i);
                    break;
                }
            }

            return(response);
        }