Ejemplo n.º 1
0
   public Enemy(String aiName,
       Vector2 position)
       : base(position, 
       Vector2.Zero, 
       Vector2.Zero, 
       new Vector2(MAX_VELOCITY_X, MAX_VELOCITY_Y),
       new Vector2(ACCELERATION_X, ACCELERATION_Y), 
       new Vector2(DECELERATION_X, DECELERATION_Y),
       TextureManager.GetTexture(TextureNames.PLAYER_TWO_IDLE))
   {
       behaviour = new AIStateMachine(XMLFILE, aiName);
       currentState = behaviour.GetCurrentState();
       
 
       // These should be loaded from either XML
       // or be statics in child-classes specific
       // to types of AIs.
       moveTime = new ParameterDouble();
       moveTime.alpha = 500;
       moveTime.beta = 500;
       moveTime.distribution = Distribution.Normal;
       // Temporary:
       timeBetweenFire = new ParameterDouble();
       timeBetweenFire.alpha = 1000;
       timeBetweenFire.beta = 1000;
       timeBetweenFire.distribution = Distribution.Normal;
   }
Ejemplo n.º 2
0
        /** 
         * Loads a Double parameter from the specified
         * XMLNode.
         **/
        public ParameterDouble LoadXMLParameterDouble(XmlNode node)
        {
            ParameterDouble newPar = new ParameterDouble();

            newPar.alpha = Convert.ToDouble(node.Attributes.GetNamedItem("alpha").Value);
            newPar.beta = Convert.ToDouble(node.Attributes.GetNamedItem("beta").Value);
            newPar.distribution = (Distribution)Enum.Parse(typeof(Distribution),
                Convert.ToString(node.Attributes.GetNamedItem("distribution").Value));

            return newPar;
        }
Ejemplo n.º 3
0
        /**
        * Loads emitter parameters from XML file.
        **/
        public void LoadXMLEmitter(XmlDocument emitter)
        {
            XmlNode emitterPars =
                emitter.SelectSingleNode("/ParticleSystem/EmitterParameters");
            XmlNode particlePars =
                emitter.SelectSingleNode("/ParticleSystem/ParticleParameters");
            /**
             * Load Emitter Parameters:
             **/
            //Location = LoadXMLVector3D(emitterPars.SelectSingleNode("location"));
            EmitDimensions = LoadXMLVector3D(emitterPars.SelectSingleNode("dimension"));
            MaxNumParticles =
                (int)(GlobalParticleLevels * Convert.ToInt32(emitterPars.SelectSingleNode("maxNumParticles").
                Attributes.GetNamedItem("x").Value));

            EmitRate =
                (int)(GlobalParticleLevels * Convert.ToInt32(emitterPars.SelectSingleNode("emitRate").
                Attributes.GetNamedItem("x").Value));
            MeanEmitDelay =
                Convert.ToDouble(emitterPars.SelectSingleNode("meanEmitDelay").
                Attributes.GetNamedItem("x").Value);
            EmitLifetime =
                Convert.ToDouble(emitterPars.SelectSingleNode("emitterLifetime").
                Attributes.GetNamedItem("x").Value);
            PermanentParticles =
                Convert.ToBoolean(emitterPars.SelectSingleNode("permanentParticles").
                Attributes.GetNamedItem("x").Value);

            /**
             * Load particle randomization parameters:
             **/
            position = LoadXMLParameter3D(particlePars.SelectSingleNode("position"));
            velocity = LoadXMLParameter3D(particlePars.SelectSingleNode("velocity"));
            /**
             * Speed and Direction: Not implemented yet. 
             **/
            // speed = LoadXMLParameterDouble(particlePars.SelectSingleNode("speed"));
            // direction = LoadXMLParameterDouble(particlePars.SelectSingleNode("direction"));
            acceleration = LoadXMLParameter3D(particlePars.SelectSingleNode("acceleration"));
            color = LoadXMLParameter3D(particlePars.SelectSingleNode("color"));
            angle = LoadXMLParameterDouble(particlePars.SelectSingleNode("angle"));
            angularVelocity = LoadXMLParameterDouble(particlePars.SelectSingleNode("angularVelocity"));
            transparency = LoadXMLParameterDouble(particlePars.SelectSingleNode("transparency"));
            transparencyDelta = LoadXMLParameterDouble(particlePars.SelectSingleNode("transparencyDelta"));
            size = LoadXMLParameterDouble(particlePars.SelectSingleNode("size"));
            size.alpha *= GlobalScaling;
            size.beta *= GlobalScaling;
            growth = LoadXMLParameterDouble(particlePars.SelectSingleNode("growth"));
            ttl = LoadXMLParameterDouble(particlePars.SelectSingleNode("ttl"));

        }
Ejemplo n.º 4
0
        /**
         * Transposes a parameter using magnitude and direction to 
         * one using a 3D vector.
         * TODO: Implement.
         **/
        public Parameter3D MagnitudeDirectionTo3DVector(
            ParameterDouble magnitude, 
            ParameterDouble direction) 
        {
            Parameter3D vector = new Parameter3D();
            
            /**
             * Randomly-distributed magnitude and direction variables
             * transformed to randomly-distributed 3d x,y,z vectors.
             **/

            return vector;
        }
Ejemplo n.º 5
0
        /// <summary>
        /// UNIMPLEMENTED: Transpose magnitude and direction parameters to a 3D (x, y, z)-based one.
        /// </summary>
        /// <param name="magnitude">The magnitude parameter.</param>
        /// <param name="direction">The direction parameter.</param>
        /// <returns>Randomly-distributed magnitude and direction variables
        /// transformed to randomly-distributed 3D vectors.</returns>
        public Parameter3D MagnitudeDirectionTo3DVector(
            ParameterDouble magnitude, 
            ParameterDouble direction) 
        {
            Parameter3D vector = new Parameter3D();

            // TODO: Implement.

            return vector;
        }