Пример #1
0
        private void Spawn(
            Vector2 origin, Vector2 direction, List <DmlObject> speeds,
            string[] paramNames, DmlObject[] values,
            DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            bool local = parent != null;

            double    speed;
            DmlObject newObj;
            DmlBullet newBullet;

            foreach (DmlObject s in speeds)
            {
                speed = (double)(s.Value);

                newObj    = factory.Instantiate(origin, system);
                newBullet = (DmlBullet)(newObj.Value);

                newBullet.Direction = direction;
                newBullet.Speed     = speed;

                for (int i = 0; i < paramCount; i++)
                {
                    newObj.SetVar(paramNames[i], values[i]);
                }

                if (local)
                {
                    parent.Children.Add(newBullet);
                }
                system.AddBullet(newBullet);
            }
        }
Пример #2
0
        private void Spawn(
            List <DmlObject> origins, List <DmlObject> directions, List <DmlObject> speeds,
            string[] paramNames, DmlObject[] values,
            DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            if (origins.Count != directions.Count || origins.Count != speeds.Count || directions.Count != speeds.Count)
            {
                throw new BehaviourException("Origins, Directions and Speeds must all have the same number of elements.");
            }

            bool local = parent != null;

            Vector2   origin, direction;
            double    speed;
            DmlObject newObj;
            DmlBullet newBullet;

            for (int i = 0; i < origins.Count; i++)
            {
                origin    = (Vector2)(origins[i].Value);
                direction = (Vector2)(directions[i].Value);
                speed     = (double)(speeds[i].Value);

                newObj    = factory.Instantiate(origin, system);
                newBullet = (DmlBullet)(newObj.Value);

                newBullet.Direction = direction;
                newBullet.Speed     = speed;

                for (int j = 0; j < paramCount; j++)
                {
                    newObj.SetVar(paramNames[j], values[j]);
                }

                if (local)
                {
                    parent.Children.Add(newBullet);
                }
                system.AddBullet(newBullet);
            }
        }
Пример #3
0
        private void Spawn(
            Vector2 origin, Vector2 direction, double speed,
            string[] paramNames, DmlObject[] values,
            DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            DmlObject newObj    = factory.Instantiate(origin, system);
            DmlBullet newBullet = (DmlBullet)newObj.Value;

            newBullet.Direction = direction;
            newBullet.Speed     = speed;

            for (int i = 0; i < paramCount; i++)
            {
                newObj.SetVar(paramNames[i], values[i]);
            }

            if (parent != null)
            {
                parent.Children.Add(newBullet);
            }
            system.AddBullet(newBullet);
        }
Пример #4
0
        private void Spawn(
        	List<DmlObject> origins, List<DmlObject> directions, List<DmlObject> speeds, 
        	string[] paramNames, DmlObject[] values,
        	DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            if (origins.Count != directions.Count || origins.Count != speeds.Count || directions.Count != speeds.Count)
                throw new BehaviourException("Origins, Directions and Speeds must all have the same number of elements.");

            bool local = parent != null;

            Vector2 origin, direction;
            double speed;
            DmlObject newObj;
            DmlBullet newBullet;

            for (int i = 0; i < origins.Count; i++)
            {
                origin = (Vector2)(origins[i].Value);
                direction = (Vector2)(directions[i].Value);
                speed = (double)(speeds[i].Value);

                newObj = factory.Instantiate(origin, system);
                newBullet = (DmlBullet)(newObj.Value);

                newBullet.Direction = direction;
                newBullet.Speed = speed;

                for (int j = 0; j < paramCount; j++)
                    newObj.SetVar(paramNames[j], values[j]);

                if (local)
                    parent.Children.Add(newBullet);
                system.AddBullet(newBullet);
            }
        }
Пример #5
0
        private void Spawn(
        	Vector2 origin, Vector2 direction, List<DmlObject> speeds, 
        	string[] paramNames, DmlObject[] values,
        	DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            bool local = parent != null;

            double speed;
            DmlObject newObj;
            DmlBullet newBullet;

            foreach (DmlObject s in speeds)
            {
                speed = (double)(s.Value);

                newObj = factory.Instantiate(origin, system);
                newBullet = (DmlBullet)(newObj.Value);

                newBullet.Direction = direction;
                newBullet.Speed = speed;

                for (int i = 0; i < paramCount; i++)
                    newObj.SetVar(paramNames[i], values[i]);

                if (local)
                    parent.Children.Add(newBullet);
                system.AddBullet(newBullet);
            }
        }
Пример #6
0
        private void Spawn(
        	Vector2 origin, Vector2 direction, double speed,
        	string[] paramNames, DmlObject[] values,
        	DmlBullet parent, DmlBulletFactory factory, DmlSystem system)
        {
            DmlObject newObj = factory.Instantiate(origin, system);
            DmlBullet newBullet = (DmlBullet)newObj.Value;
            newBullet.Direction = direction;
            newBullet.Speed = speed;

            for (int i = 0; i < paramCount; i++)
                newObj.SetVar(paramNames[i], values[i]);

            if (parent != null)
                parent.Children.Add(newBullet);
            system.AddBullet(newBullet);
        }