Exemple #1
0
        public RModel(ParameterSet parm)
        {
            ModelInfo m;
            m.modelName = parm.GetString("ModelName");
            Name = m.modelName;

            ShadowDrawLists = new FastList<RModelInstance>[Sun.NUM_CASCADES];
            for (int i = 0; i < ShadowDrawLists.Length; i++)
                ShadowDrawLists[i] = new FastList<RModelInstance>();

            if (parm.HasParm("BumpMap"))
                IsBumpMapped = true;
            if (parm.HasParm("Shininess"))
                Shininess = parm.GetFloat("Shininess");
            if (parm.HasParm("SpecularPower"))
                SpecularPower = parm.GetFloat("SpecularPower");
            if (parm.HasParm("SpecularMap"))
                IsSpecularMapped = true;
            if (parm.HasParm("CastsShadows"))
                CastsShadows = parm.GetBool("CastsShadows");
            if (parm.HasParm("ReceivesShadows"))
                ReceivesShadows = parm.GetBool("ReceivesShadows");
            if (parm.HasParm("AlphaBlend"))
                AlphaBlend = parm.GetBool("AlphaBlend");

            m.textureName = "";
            if (parm.HasParm("Texture"))
                m.textureName = parm.GetString("Texture");

            modelDictionary.Add(m, this);
            Renderer.Instance.AddRModel(this);
        }
 public static void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
 {
     if (worldParm.HasParm("DieOnTrigger"))
         actorParm.AddParm("DieOnTrigger", worldParm.GetBool("DieOnTrigger"));
     if (worldParm.HasParm("InputAction"))
         actorParm.AddParm("InputAction", worldParm.GetString("InputAction"));
 }
        public static new void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
        {
            System.Diagnostics.Debug.Assert(worldParm.HasParm("InputAction"), "ButtonPushTriggerVolume requires an input action!");
            actorParm.AddParm("InputAction", worldParm.GetString("InputAction"));

            if (worldParm.HasParm("KillOnButtonPush"))
                actorParm.AddParm("KillOnButtonPush", worldParm.GetBool("KillOnButtonPush"));
        }
        public static new void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
        {
            System.Diagnostics.Debug.Assert(worldParm.HasParm("NewDir"), "Rotate Camera requires a new direction!");
            actorParm.AddParm("NewDir", worldParm.GetVector3("NewDir"));

            if (worldParm.HasParm("RotateRight"))
                actorParm.AddParm("RotateRight", worldParm.GetBool("RotateRight"));
            if(worldParm.HasParm("RotationTime"))
                actorParm.AddParm("RotationTime", worldParm.GetFloat("RotationTime"));
        }
        /// <summary>
        /// Read trigger specific parameters from the world parm and add them to the actor parm
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        public static new void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
        {
            if (worldParm.HasParm("Count"))
                actorParm.AddParm("Count", worldParm.GetInt("Count"));
            if (worldParm.HasParm("Freq"))
                actorParm.AddParm("Freq", worldParm.GetFloat("Freq"));
            if (worldParm.HasParm("SpawnInWaves"))
                actorParm.AddParm("SpawnInWaves", worldParm.GetBool("SpawnInWaves"));
            if (worldParm.HasParm("DelayForFirst"))
                actorParm.AddParm("DelayForFirst", worldParm.GetFloat("DelayForFirst"));
            if (worldParm.HasParm("ConstantSpawns"))
                actorParm.AddParm("ConstantSpawns", worldParm.GetBool("ConstantSpawns"));
            if (worldParm.HasParm("EnemyList"))
                actorParm.AddParm("EnemyList", worldParm.GetBool("EnemyList"));

            System.Diagnostics.Debug.Assert(worldParm.HasParm("ActorType"), "SpawnActorTriggerVolume requires an actor type to spawn!");
            actorParm.AddParm("ActorType", worldParm.GetString("ActorType"));

            System.Diagnostics.Debug.Assert(worldParm.HasParm("SpawnPos"), "SpawnActorTriggerVolume requires a position to spawn at!");
            actorParm.AddParm("SpawnPos", worldParm.GetString("SpawnPos"));
        }
        /// <summary>
        /// Read trigger specific parameters from the world parm and add them to the actor parm
        /// </summary>
        /// <param name="parm"></param>
        /// <returns></returns>
        public static new void ParseParmSet(ref ParameterSet actorParm, ref ParameterSet worldParm)
        {
            //check for the bare minimum required parms
            System.Diagnostics.Debug.Assert(worldParm.HasParm("ControllerInput0"), "TutorialStopTriggerVolume requires a ControllerInput0!");
            System.Diagnostics.Debug.Assert(worldParm.HasParm("GuitarInput0"), "TutorialStopTriggerVolume requires a GuitarInput0!");

            System.Diagnostics.Debug.Assert(worldParm.HasParm("ControllerImage0"), "TutorialStopTriggerVolume requires a ControllerImage0!");
            System.Diagnostics.Debug.Assert(worldParm.HasParm("GuitarImage0"), "TutorialStopTriggerVolume requires a GuitarImage0!");

            System.Diagnostics.Debug.Assert(worldParm.HasParm("ControllerImagePos0"), "TutorialStopTriggerVolume requires a ControllerImagePos0!");
            System.Diagnostics.Debug.Assert(worldParm.HasParm("ControllerImageSize0"), "TutorialStopTriggerVolume requires a ControllerImageSize0!");
            System.Diagnostics.Debug.Assert(worldParm.HasParm("GuitarImagePos0"), "TutorialStopTriggerVolume requires a GuitarImagePos0!");
            System.Diagnostics.Debug.Assert(worldParm.HasParm("GuitarImageSize0"), "TutorialStopTriggerVolume requires a GuitarImageSize0!");

            int count = 0;

            while (worldParm.HasParm("ControllerInput"+count))
            {
                actorParm.AddParm("ControllerInput"+count, worldParm.GetString("ControllerInput"+count));

                actorParm.AddParm("GuitarInput"+count, worldParm.GetString("GuitarInput"+count));

                actorParm.AddParm("ControllerImage"+count, worldParm.GetString("ControllerImage"+count));

                actorParm.AddParm("GuitarImage"+count, worldParm.GetString("GuitarImage"+count));

                actorParm.AddParm("ControllerImagePos"+count, worldParm.GetString("ControllerImagePos"+count));
                actorParm.AddParm("ControllerImageSize"+count, worldParm.GetString("ControllerImageSize"+count));
                actorParm.AddParm("GuitarImagePos"+count, worldParm.GetString("GuitarImagePos"+count));
                actorParm.AddParm("GuitarImageSize"+count, worldParm.GetString("GuitarImageSize"+count));

                //optional parms
                if (worldParm.HasParm("StrumRequired"+count))
                    actorParm.AddParm("StrumRequired"+count, worldParm.GetBool("StrumRequired"+count));

                if (worldParm.HasParm("AllInputsRequired"+count))
                    actorParm.AddParm("AllInputsRequired"+count, worldParm.GetBool("AllInputsRequired"+count));

                if (worldParm.HasParm("SpawnEnemy"+count))
                    actorParm.AddParm("SpawnEnemy"+count, worldParm.GetBool("SpawnEnemy"+count));

                if (worldParm.HasParm("KillEnemies"+count))
                    actorParm.AddParm("KillEnemies"+count, worldParm.GetBool("KillEnemies"+count));
                if (worldParm.HasParm("TriggerDelay"+count))
                    actorParm.AddParm("TriggerDelay"+count, worldParm.GetFloat("TriggerDelay"+count));

                count++;
            }

            if (worldParm.HasParm("EndLevel"))
                actorParm.AddParm("EndLevel", worldParm.GetBool("EndLevel"));

            actorParm.AddParm("Num", count);
        }
        //note if we keep the base values the same, a lot of this code can be removed
        public override void ConvertTo(EnemyType e, ref ParameterSet parm)
        {
            if ((e != EnemyType.Heavy && e != EnemyType.HeavyAOE) || e == type)
                return;

            bloodOnDamage = true;
            if (parm.HasParm("Speed"))
                speed = parm.GetFloat("Speed");
            if (parm.HasParm("AttackDamage"))
                attackDmg = parm.GetFloat("AttackDamage");
            if (parm.HasParm("AttackRange"))
                attackRange = (float)Math.Pow(parm.GetFloat("AttackRange"), 2);
            if (parm.HasParm("PercAnimationBeforeAttack"))
                percAnimBeforeAttack = parm.GetFloat("PercAnimationBeforeAttack");
            if (parm.HasParm("TimeForAttack"))
                attackTime = parm.GetFloat("TimeForAttack");

            pointsForKilling = 50;
            if (parm.HasParm("PointsForKilling"))
                pointsForKilling = parm.GetInt("PointsForKilling");
            spawnerIndex = -1;

            if (Stage.ActiveStage.Parm.HasParm("AIHeavySpeedScalar"))
                speed *= Stage.ActiveStage.Parm.GetFloat("AIHeavySpeedScalar");

            if (Stage.ActiveStage.Parm.HasParm("AIHeavyDamageScalar"))
            {
                float increase = Stage.ActiveStage.Parm.GetFloat("AIHeavyDamageScalar");
                attackDmg *= increase;
                attackSpecialDmg *= increase;
            }

            //look for more parms here
            if (parm.HasParm("TurnSpeed"))
                turnSpeed = parm.GetFloat("TurnSpeed");
            if (parm.HasParm("TimeForAttackSpecial"))
                timeForAttackSpecial = parm.GetInt("TimeForAttackSpecial");
            if (parm.HasParm("PercAnimationBeforeAttackRight"))
                percAnimBeforeAttackRight = parm.GetFloat("PercAnimationBeforeAttackRight");
            if (parm.HasParm("PercAnimationBeforeAttackSpecial"))
                percAnimBeforeAttackSpecial = parm.GetFloat("PercAnimationBeforeAttackSpecial");
            if (parm.HasParm("AttackSpecialDamage"))
                attackSpecialDmg = parm.GetFloat("AttackSpecialDamage");
            if (parm.HasParm("MinPunches"))
                minPunches = parm.GetInt("MinPunches");
            if (parm.HasParm("MaxPunches"))
                maxPunches = parm.GetInt("MaxPunches");
            if (parm.HasParm("SlamAttackForce"))
                attackForce = parm.GetFloat("SlamAttackForce");
            if (parm.HasParm("EndWithSlam"))
                shouldSlam = parm.GetBool("EndWithSlam");

            jumpSpeed = 10;

            if (actor.PhysicsObject.physicsType == PhysicsObject.PhysicsType.CylinderCharacter)
            {
                actor.PhysicsObject.CylinderCharController.HorizontalMotionConstraint.Speed = speed;
                actor.PhysicsObject.CollisionInformation.CollisionRules.Group = PhysicsQB.heavyAIGroup;
            }

            actor.GetAgent<HealthAgent>().Convert(ref parm);

            shouldAttack = true;
            target = PlayerAgent.Player;
            state = AIState.Moving;
            FaceTargetSnappedToPlane();
            type = e;
        }
        public void Convert(ref ParameterSet parm)
        {
            if (parm.HasParm("Health"))
                startingHealth = this.health = parm.GetFloat("Health");

            switch (actor.Name)
            {
                case "EnemyWeak":
                    if (Stage.ActiveStage.Parm.HasParm("AIWeakHealthScalar"))
                        health *= Stage.ActiveStage.Parm.GetFloat("AIWeakHealthScalar");
                    break;
                case "EnemyRanged":
                    if (Stage.ActiveStage.Parm.HasParm("AIRangedHealthScalar"))
                        health *= Stage.ActiveStage.Parm.GetFloat("AIRangedHealthScalar");
                    break;
                case "EnemyHeavy":
                    if (Stage.ActiveStage.Parm.HasParm("AIHeavyHealthScalar"))
                        health *= Stage.ActiveStage.Parm.GetFloat("AIHeavyHealthScalar");
                    break;
            }

            infiniteHealth = false;
            startsWithShield = shielded = false;
            percDamageAbsorbedByShield = 0;
            numHitsForDisarm = 0;
            if (parm.HasParm("InfiniteHealth"))
                infiniteHealth = parm.GetBool("InfiniteHealth");
            if (parm.HasParm("Shielded"))
                startsWithShield = this.shielded = parm.GetBool("Shielded");
            if (parm.HasParm("ShieldDmgAbsorbPerc"))
                this.percDamageAbsorbedByShield = parm.GetFloat("ShieldDmgAbsorbPerc");
            if (parm.HasParm("ShutdownInsteadOfKill"))
                shutdownInsteadOfKill = parm.GetBool("ShutdownInsteadOfKill");
            if (parm.HasParm("NumHitsForDisarm"))
                numHitsForDisarm = startingHitsForDisarm = parm.GetInt("NumHitsForDisarm");
        }
        public void PostLoadInit(ParameterSet parm)
        {
            Green = input.GetInputAction("A");
            Red = input.GetInputAction("B");
            PauseGame = input.GetInputAction("IsPauseGame");
            MenuSelect = input.GetInputAction("IsMenuSelect");
            MenuCancel = input.GetInputAction("IsMenuCancel");
            MenuUp = input.GetInputAction("IsMenuUp");
            MenuDown = input.GetInputAction("IsMenuDown");
            MenuRight = input.GetInputAction("IsMenuRight");
            MenuLeft = input.GetInputAction("IsMenuLeft");

            if (parm.HasParm("DontPause"))
                dontPause = parm.GetBool("DontPause");
        }
 public RModelInstance(ParameterSet parm)
 {
     model = RModel.GetRModel(parm);
     if (parm.HasParm("DontDraw"))
         dontDraw = parm.GetBool("DontDraw");
 }