public void InitializeFireDataTime(FireData fireData, int face)
        {
            Point3 point        = CellFace.FaceToPoint3(face);
            int    x            = fireData.Point.X + point.X;
            int    y            = fireData.Point.Y + point.Y;
            int    z            = fireData.Point.Z + point.Z;
            int    cellContents = base.SubsystemTerrain.Terrain.GetCellContents(x, y, z);
            Block  block        = BlocksManager.Blocks[cellContents];

            switch (face)
            {
            case 4:
                break;

            case 0:
                fireData.Time0 = block.FireDuration * m_random.Float(0.75f, 1.25f);
                break;

            case 1:
                fireData.Time1 = block.FireDuration * m_random.Float(0.75f, 1.25f);
                break;

            case 2:
                fireData.Time2 = block.FireDuration * m_random.Float(0.75f, 1.25f);
                break;

            case 3:
                fireData.Time3 = block.FireDuration * m_random.Float(0.75f, 1.25f);
                break;

            case 5:
                fireData.Time5 = block.FireDuration * m_random.Float(0.75f, 1.25f);
                break;
            }
        }
Beispiel #2
0
        public static void AddAutoSetFuse(ModuleWeaponGun __instance)
        {
            TimedFuseData timedFuse = __instance.GetComponentInParent <TimedFuseData>();

            if (timedFuse == null)
            {
                FireData fireData = (FireData)m_FiringData.GetValue(__instance);
                if (fireData == null)
                {
                    fireData = __instance.GetComponent <FireData>();
                    m_FiringData.SetValue(__instance, fireData);
                }
                if (fireData != null)
                {
                    WeaponRound round = fireData.m_BulletPrefab;
                    if (round != null && round is Projectile projectile)
                    {
                        float lifetime             = (float)m_LifeTime.GetValue(projectile);
                        bool  explodeAfterLifetime = (bool)m_ExplodeAfterLifetime.GetValue(projectile);

                        // We check if projectile has a lifetime, and it explodes after it (no use setting fuse if fixed lifetime anyway)
                        if (explodeAfterLifetime && lifetime > 0f)
                        {
                            timedFuse = __instance.gameObject.AddComponent <TimedFuseData>();
                            timedFuse.always_present = false;
                        }
                    }
                }
            }
        }
    public virtual void Fire(FireData fireData)
    {
        this.fireData = fireData;
        owner         = stayOnOwner ? PhotonNetwork.GetPhotonView(fireData.ownerID).transform : null;

        OnFire(this);
    }
        public ActionResult DeleteConfirmed(decimal id)
        {
            FireData fireData = db.FireDatas.Find(id);

            db.FireDatas.Remove(fireData);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public void InitializeFireDataTimes(FireData fireData)
 {
     InitializeFireDataTime(fireData, 0);
     InitializeFireDataTime(fireData, 1);
     InitializeFireDataTime(fireData, 2);
     InitializeFireDataTime(fireData, 3);
     InitializeFireDataTime(fireData, 5);
 }
    public override void Fire(FireData fireData)
    {
        base.Fire(fireData);

        for (int i = 0; i < animatedProjectiles.Count; i++)
        {
            animatedProjectiles[i].gameObject.SetActive(true);
            animatedProjectiles[i].Fire(fireData);
        }
    }
 public ActionResult Edit([Bind(Include = "latitude,longitude,brightness,scan,track,acq_date,acq_time,satellite,instrument,confidence,version,bright_t31,frp,daynight,type,full_address,street,city,state,postcode")] FireData fireData)
 {
     if (ModelState.IsValid)
     {
         db.Entry(fireData).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(fireData));
 }
Beispiel #8
0
            private static void Postfix(ref ModuleWeaponFlamethrower __instance)
            {
                FireData fireData = __instance.GetComponentInParent <FireData>();

                if (fireData != null)
                {
                    fireData.m_MuzzleVelocity = 0.0f;
                }
                return;
            }
Beispiel #9
0
 public void InitData(FireData data)
 {
     m_Player     = PlayerManager.m_Main.GetPlayerTransform();
     m_LifeTime   = data.m_LifeTime;
     m_ChangeTime = data.m_ChangeTime;
     m_Speed      = data.m_Speed;
     m_Damage     = data.m_Damage;
     m_OverTime   = Time.time + data.m_LifeTime;
     m_Type       = data.m_Type;
     transform.LookAt(m_Player);
 }
Beispiel #10
0
 private void Awake()
 {
     if (device == null)
     {
         device = GetComponent <EnergyDevice>();
     }
     if (fd == null)
     {
         fd = GetComponentInParent <FireData>();
     }
     particleSystemFlames = transform.GetChild(0).GetChild(0).gameObject;
     IncreaseFireTimer    = Time.time + fd.levelDuration;
 }
        public void AddFire(int x, int y, int z, float expandability)
        {
            Point3 point = new Point3(x, y, z);

            if (!m_fireData.ContainsKey(point))
            {
                FireData fireData = new FireData();
                fireData.Point             = point;
                fireData.FireExpandability = expandability;
                InitializeFireDataTimes(fireData);
                m_fireData[point] = fireData;
            }
        }
Beispiel #12
0
            private static bool Prefix(ref Projectile __instance, FireData fireData, out float __state)
            {
                __state = (float)m_LifeTime.GetValue(__instance);

                // Do timed fuse setting
                TimedFuseData timedFuse = fireData.GetComponentInParent <TimedFuseData>();

                if (timedFuse != null)
                {
                    m_LifeTime.SetValue(__instance, timedFuse.m_FuseTime + timedFuse.offset);
                }
                return(true);
            }
        // GET: FireDatas/Delete/5
        public ActionResult Delete(decimal id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            FireData fireData = db.FireDatas.Find(id);

            if (fireData == null)
            {
                return(HttpNotFound());
            }
            return(View(fireData));
        }
Beispiel #14
0
 public void SetFireIsLow(bool isLow)
 {
     isHighFire = !isLow;
     if (isLow)
     {
         activeFireData = lowFire;
         //lowFire.SetNormalizedStrength(fireParticles, 0);
     }
     else
     {
         activeFireData = highFire;
         //highFire.SetNormalizedStrength(fireParticles, 0);
     }
     SetStrength(0);
 }
Beispiel #15
0
    public void Fire(FireData fireData)
    {
        this.fireData = fireData;
        OnFire(this);
        //SetColors();

        if (moveType == MoveType.Impact)
        {
            rb.AddForce(transform.forward * fireData.speed, ForceMode.Impulse);
        }

        if (randomizeSize)
        {
            RandomizeSize();
        }
    }
Beispiel #16
0
 private void OnEnable()
 {
     // FIXME:
     //if (fd != null && fd.targetedHolder.fireSpots != null)
     //{
     //    for (int i = 0; i < fd.targetedHolder.fireSpots.childCount; i++)
     //    {
     //        if (fd.targetedHolder.fireSpots.GetChild(i).childCount == 0)
     //        {
     //            StartFire(fd.targetedHolder.fireSpots.GetChild(i));
     //            return;
     //        }
     //    }
     //}
     fd = null;
     Destroy(gameObject);
 }
Beispiel #17
0
    private void Start()
    {
        TimeUtil.FrameRateIndependent = false;
        field = DanmakuField.FindClosest(this);
        group = DanmakuGroup.List();
        FireData data = prefab;

        group.Bind(data);
        if (field)
        {
            field.Bind(data);
        }

        Spiral(data.Infinite(Modifier.Rotate(rotation))).Execute();
        //Spiral(data.Infinite(Modifier.Rotate(-3f)).WithColor(Color.blue)).Execute();
        //InvokeRepeating("DAALL", 10, 10);
    }
Beispiel #18
0
 private static void Postfix(ref ModuleWeaponGun __instance)
 {
     CannonBarrel[] cannonBarrels = (CannonBarrel[])m_CannonBarrels.GetValue(__instance);
     if (cannonBarrels != null)
     {
         foreach (CannonBarrel cannonBarrel in cannonBarrels)
         {
             if (cannonBarrel.beamWeapon)
             {
                 FireData fireData = (FireData)m_FiringData.GetValue(__instance);
                 if (fireData != null)
                 {
                     fireData.m_MuzzleVelocity = 0f;
                 }
                 return;
             }
         }
     }
     return;
 }
Beispiel #19
0
 public override void Start(RAIN.Core.AI ai)
 {
     base.Start(ai);
     if (m_IsInit == false)
     {
         m_IsInit   = true;
         m_Shoter   = Resources.Load <GameObject>("Prefabs/Shot3");
         m_FireData = new FireData();
         m_FireData.m_ChangeTime = 0.6f;
         m_FireData.m_LifeTime   = 10f;
         m_FireData.m_Speed      = 7f;
         m_FireData.m_Damage     = 50;
     }
     if (m_Shoter != null)
     {
         GameObject obj = GameObject.Instantiate(m_Shoter, ai.Body.transform.position, m_Shoter.transform.rotation);
         obj.GetComponent <Shoter>().InitData(m_FireData);
         ai.WorkingMemory.SetItem("DelayTime", 2.5f);
     }
 }
Beispiel #20
0
    public override void Start(RAIN.Core.AI ai)
    {
        base.Start(ai);
        if (m_IsInit == false)
        {
            m_IsInit   = true;
            m_Shoter   = Resources.Load <GameObject>("Prefabs/Shot1");
            m_Shoter2  = Resources.Load <GameObject>("Prefabs/Shot2");
            m_AddSoul  = Resources.Load <GameObject>("Prefabs/AddSoul");
            m_FireData = new FireData();
            m_FireData.m_ChangeTime = 0.9f;
            m_FireData.m_LifeTime   = 8f;
            m_FireData.m_Speed      = 5f;
            m_FireData.m_Damage     = 20f;
        }


        if (m_Shoter != null)
        {
            int r = Random.Range(0, 3);
            m_FireData.m_Type = 0;
            if (r == 0)
            {
                GameObject obj = GameObject.Instantiate(m_Shoter, ai.Body.transform.position, m_Shoter.transform.rotation);
                obj.GetComponent <Shoter>().InitData(m_FireData);
            }
            else if (r == 1)
            {
                GameObject obj = GameObject.Instantiate(m_Shoter2, ai.Body.transform.position, m_Shoter.transform.rotation);
                obj.GetComponent <Shoter>().InitData(m_FireData);
            }
            else
            {
                GameObject obj = GameObject.Instantiate(m_AddSoul, ai.Body.transform.position, m_Shoter.transform.rotation);
                m_FireData.m_Type = 1;
                obj.GetComponent <Shoter>().InitData(m_FireData);
            }
            ai.WorkingMemory.SetItem("DelayTime", 1.5f);
        }
    }
            static void Postfix(ref Projectile __instance, Vector3 fireDirection, FireData fireData, ModuleWeapon weapon, Tank shooter = null, bool seekingRounds = false, bool replayRounds = false)
            {
                FieldInfo field_LastFireDirection = typeof(Projectile)
                                                    .GetField("m_LastFireDirection", BindingFlags.NonPublic | BindingFlags.Instance);

                Vector3 vector = fireDirection * fireData.m_MuzzleVelocity;

                if (!replayRounds)
                {
                    field_LastFireDirection.SetValue(__instance, Random2(vector, fireData.m_BulletSprayVariance));
                    vector = (Vector3)field_LastFireDirection.GetValue(__instance);
                }
                else
                {
                    vector = (Vector3)field_LastFireDirection.GetValue(__instance);
                }
                if (shooter != null)
                {
                    vector += shooter.rbody.velocity;
                }
                __instance.rbody.velocity = vector;
            }
    public IOutputGenerator GetTransactionObject(string org)
    {
        if (typeClassLookup.TryGetValue(org, out typeValue))
        {
            switch (typeValue.ToString())
            {
            case "policeData":
                transactionObject = new Transaction <PoliceData>()
                {
                    Data = new PoliceData(), params = null
                };

            case "FireData":
                transactionObject = new Transaction <FireData>()
                {
                    Data = new FireData(), params = null
                };
            }
        }
        return(transactionObject);
    }
}
Beispiel #23
0
            public static void Postfix(ref TargetAimer __instance)
            {
                try
                {
                    Visible  target   = __instance.Target;
                    FireData fireData = __instance.GetComponentInParent <FireData>();
                    if (fireData != null && __instance.HasTarget && target.IsNotNull() && !Singleton.Manager <ManPauseGame> .inst.IsPaused && ((target.type == ObjectTypes.Vehicle && target.tank.IsNotNull()) || (target.type == ObjectTypes.Block && target.block.IsNotNull())))
                    {
                        TankBlock block = (TankBlock)ProjectilePatch.m_Block.GetValue(__instance);
                        Tank      tank  = (bool)(UnityEngine.Object)block ? block.tank : (Tank)null;

                        string        name      = block ? block.name : "UNKNOWN";
                        TimedFuseData timedFuse = __instance.GetComponentInParent <TimedFuseData>();

                        bool enemyWeapon = tank == null || !ManSpawn.IsPlayerTeam(tank.Team);

                        if (((enemyWeapon && WeaponAimSettings.EnemyLead) || (!enemyWeapon && WeaponAimSettings.PlayerLead)) && !(fireData is FireDataShotgun) && fireData.m_MuzzleVelocity > 0.0f)
                        {
                            Vector3     AimPointVector = (Vector3)ProjectilePatch.m_TargetPosition.GetValue(__instance);
                            Vector3     relDist        = AimPointVector - __instance.transform.position;
                            WeaponRound bulletPrefab   = fireData.m_BulletPrefab;

                            bool useGravity = false;
                            if (bulletPrefab != null && bulletPrefab is Projectile projectile && projectile.rbody != null)
                            {
                                if (projectile is MissileProjectile missileProjectile)
                                {
                                    useGravity = missileProjectile.rbody.useGravity || WeaponAimSettings.BallisticMissile;
                                }
                                else
                                {
                                    useGravity = projectile.rbody.useGravity;
                                }
                            }

                            Rigidbody rbodyTank = __instance.GetComponentInParent <Tank>().rbody;

                            Vector3 angularToggle    = rbodyTank.angularVelocity;
                            Vector3 relativeVelocity = (__instance.Target.rbody ? __instance.Target.rbody.velocity : Vector3.zero) - (rbodyTank.velocity + angularToggle);

                            float   time = relDist.magnitude / fireData.m_MuzzleVelocity;
                            Vector3 relativeAcceleration = target.type == ObjectTypes.Vehicle ? TargetManager.GetAcceleration(target.tank) : Vector3.zero;

                            if (useGravity)
                            {
                                relativeAcceleration -= Physics.gravity;
                            }

                            float   exactTime    = BallisticEquations.SolveBallisticArc(__instance.transform.position, fireData.m_MuzzleVelocity, AimPointVector, relativeVelocity, relativeAcceleration);
                            Vector3 adjIntercept = AimPointVector + (relativeVelocity * time);
                            if (exactTime != Mathf.Infinity)
                            {
                                time         = exactTime;
                                adjIntercept = AimPointVector + (relativeVelocity * time) + ((relativeAcceleration + (useGravity ? Physics.gravity : Vector3.zero)) / 2 * time * time);
                            }

                            if (timedFuse != null)
                            {
                                timedFuse.m_FuseTime = time;
                            }

                            ProjectilePatch.m_TargetPosition.SetValue(__instance, adjIntercept);
                        }
                        // Either disabled for enemy, or is a beam weapon
                        else
                        {
                            if (timedFuse != null)
                            {
                                timedFuse.m_FuseTime = 0.0f;
                            }
                        }
                    }
                }
                catch (NullReferenceException exception)
                {
                    Console.WriteLine("[WeaponAimMod] TargetAimer.UpdateTarget PATCH FAILED");
                    Console.WriteLine(exception.Message);
                }
            }
Beispiel #24
0
 public static float Rotation(FireData fd)
 {
     return fd.Rotation;
 }
Beispiel #25
0
        public static void ManipulateBarrels(List <TankBlock> blockList, string request, Dictionary <CannonBarrel, float> memory, float average)
        {
            FieldInfo field_NumCannonBarrels = typeof(ModuleWeaponGun) // Holy mess!
                                               .GetField("m_NumCannonBarrels", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_CannonBarrels = typeof(ModuleWeaponGun)
                                            .GetField("m_CannonBarrels", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_BarrelTransform = typeof(ModuleWeaponGun)
                                              .GetField("m_BarrelTransform", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_FiringData = typeof(ModuleWeaponGun)
                                         .GetField("m_FiringData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_WeaponModule = typeof(ModuleWeaponGun)
                                           .GetField("m_WeaponModule", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_ShotCooldown = typeof(ModuleWeaponGun)
                                           .GetField("m_ShotCooldown", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_transform = typeof(Transform)
                                        .GetField("transform", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_AnimState = typeof(CannonBarrel)
                                        .GetField("animState", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            /*MethodInfo method_Setup = typeof(CannonBarrel)
             *  .GetMethod("Setup", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
             * MethodInfo method_CapRecoilDuration = typeof(CannonBarrel)
             *  .GetMethod("CapRecoilDuration", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);*/

            foreach (TankBlock block in blockList)
            {
                ModuleWeaponGun weapon = block.GetComponent <ModuleWeaponGun>();
                int             value_NumCannonBarrels = (int)field_NumCannonBarrels.GetValue(weapon);
                if (value_NumCannonBarrels != 0)
                {
                    Array value_CannonBarrels = (Array)field_CannonBarrels.GetValue(weapon);
                    for (int i = 0; i < value_CannonBarrels.Length; i++)
                    {
                        /*Transform value_BarrelTransform = (Transform)field_BarrelTransform.GetValue(weapon);
                         * if (value_BarrelTransform == null) // Will this ever check true?
                         * {
                         *  field_BarrelTransform.SetValue(weapon, field_transform.GetValue(value_CannonBarrels.GetValue(i)));
                         * }*/
                        CannonBarrel thisBarrel         = (CannonBarrel)value_CannonBarrels.GetValue(i);
                        FireData     value_FiringData   = (FireData)field_FiringData.GetValue(weapon);
                        ModuleWeapon value_WeaponModule = (ModuleWeapon)field_WeaponModule.GetValue(weapon);
                        float        value_ShotCooldown = (float)field_ShotCooldown.GetValue(weapon);
                        //method_Setup.Invoke(value_CannonBarrels.GetValue(i), new object[] { value_FiringData, value_WeaponModule });
                        //method_CapRecoilDuration.Invoke(value_CannonBarrels.GetValue(i), new object[] { value_ShotCooldown });
                        object value_AnimState = field_AnimState.GetValue(thisBarrel);
                        if (value_AnimState != null)
                        {
                            PropertyInfo prop_GetSpeed = value_AnimState.GetType()
                                                         .GetProperty("speed", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);
                            PropertyInfo prop_SetSpeed = value_AnimState.GetType()
                                                         .GetProperty("speed", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty);
                            PropertyInfo prop_GetLength = value_AnimState.GetType()
                                                          .GetProperty("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);
                            PropertyInfo prop_SetLength = value_AnimState.GetType()
                                                          .GetProperty("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty);
                            if (request == "SAVE")
                            {
                                memory.Add(thisBarrel, (float)prop_GetSpeed.GetValue(value_AnimState));
                            }
                            else if (request == "UPDATE")
                            {
                                prop_SetSpeed.SetValue(value_AnimState, memory[thisBarrel] / average);
                            }
                            else if (request == "CLEAN")
                            {
                                prop_SetSpeed.SetValue(value_AnimState, memory[thisBarrel]);
                                memory.Remove(thisBarrel);
                            }
                        }
                    }
                }
            }
        }
Beispiel #26
0
 public static void SetSpeed(FireData fd, float speed)
 {
     fd.Speed = speed;
 }
Beispiel #27
0
 public FireDamage(FireData data, Target target) : base(DamageTypes.FIRE, target)
 {
     _fireData = data;
 }
Beispiel #28
0
 public static void Accelerate(FireData fd, float delta)
 {
     fd.Speed += delta;
 }
 public static float AngularSpeed(FireData fd)
 {
     return fd.AngularSpeed;
 }
 public static void AngularAccelerate(FireData fd, float delta)
 {
     fd.AngularSpeed += delta;
 }
 public static void SetAngularSpeed(FireData fd, float speed)
 {
     fd.AngularSpeed = speed;
 }
Beispiel #32
0
	// Use this for initialization
	void Start () {
        pattern = this.gameObject.GetComponent<Patterns>();
		data = this.gameObject.GetComponent<FireData>();
	}
    public override void Fire(FireData fireData)
    {
        base.Fire(fireData);

        target = GetClosestTarget(fireData.mousePos);
    }
Beispiel #34
0
 public static float Speed(FireData fd)
 {
     return fd.Speed;
 }
Beispiel #35
0
        public void ManipulateBarrels(List <ModuleWeaponGun> weaponList, string request)
        {
            FieldInfo field_NumCannonBarrels = typeof(ModuleWeaponGun) // Holy mess!
                                               .GetField("m_NumCannonBarrels", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_CannonBarrels = typeof(ModuleWeaponGun)
                                            .GetField("m_CannonBarrels", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_BarrelTransform = typeof(ModuleWeaponGun)
                                              .GetField("m_BarrelTransform", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_FiringData = typeof(ModuleWeaponGun)
                                         .GetField("m_FiringData", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_WeaponModule = typeof(ModuleWeaponGun)
                                           .GetField("m_WeaponModule", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_ShotCooldown = typeof(ModuleWeaponGun)
                                           .GetField("m_ShotCooldown", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_transform = typeof(Transform)
                                        .GetField("transform", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
            FieldInfo field_AnimState = typeof(CannonBarrel)
                                        .GetField("animState", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);

            /*MethodInfo method_Setup = typeof(CannonBarrel)
             *  .GetMethod("Setup", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
             * MethodInfo method_CapRecoilDuration = typeof(CannonBarrel)
             *  .GetMethod("CapRecoilDuration", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);*/

            foreach (ModuleWeaponGun weapon in weaponList)
            {
                int value_NumCannonBarrels = (int)field_NumCannonBarrels.GetValue(weapon);
                if (value_NumCannonBarrels != 0)
                {
                    Array value_CannonBarrels = (Array)field_CannonBarrels.GetValue(weapon);
                    for (int i = 0; i < value_CannonBarrels.Length; i++)
                    {
                        /*Transform value_BarrelTransform = (Transform)field_BarrelTransform.GetValue(weapon);
                         * if (value_BarrelTransform == null) // Will this ever check true?
                         * {
                         *  field_BarrelTransform.SetValue(weapon, field_transform.GetValue(value_CannonBarrels.GetValue(i)));
                         * }*/
                        CannonBarrel thisBarrel         = (CannonBarrel)value_CannonBarrels.GetValue(i);
                        FireData     value_FiringData   = (FireData)field_FiringData.GetValue(weapon);
                        ModuleWeapon value_WeaponModule = (ModuleWeapon)field_WeaponModule.GetValue(weapon);
                        float        value_ShotCooldown = (float)field_ShotCooldown.GetValue(weapon);
                        //method_Setup.Invoke(value_CannonBarrels.GetValue(i), new object[] { value_FiringData, value_WeaponModule });
                        //method_CapRecoilDuration.Invoke(value_CannonBarrels.GetValue(i), new object[] { value_ShotCooldown });
                        object value_AnimState = field_AnimState.GetValue(thisBarrel);
                        if (value_AnimState != null)
                        {
                            PropertyInfo prop_GetSpeed = value_AnimState.GetType()
                                                         .GetProperty("speed", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);
                            PropertyInfo prop_SetSpeed = value_AnimState.GetType()
                                                         .GetProperty("speed", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty);
                            PropertyInfo prop_GetLength = value_AnimState.GetType()
                                                          .GetProperty("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.GetProperty);
                            PropertyInfo prop_SetLength = value_AnimState.GetType()
                                                          .GetProperty("length", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty);
                            if (request == "SAVE")
                            {
                                this.weaponSpeedMemory.Add(thisBarrel, (float)prop_GetSpeed.GetValue(value_AnimState));
                            }
                            else if (request == "UPDATE")
                            {
                                prop_SetSpeed.SetValue(value_AnimState, this.weaponSpeedMemory[thisBarrel] / this.allSegments["WeaponCooldown"].GetAverages());
                            }
                            else if (request == "CLEAN")
                            {
                                prop_SetSpeed.SetValue(value_AnimState, this.weaponSpeedMemory[thisBarrel]);
                                this.weaponSpeedMemory.Remove(thisBarrel);
                            }
                            //float value_length = (float)prop_GetLength.GetValue(value_AnimState);
                            //Console.WriteLine("FFW! Pre. Length = " + (float)prop_GetLength.GetValue(value_AnimState) + " . Speed = " + (float)prop_GetSpeed.GetValue(value_AnimState));

                            /*float modifier = this.allSegments["WeaponCooldown"].GetAveragesByKey(weapon, 2);
                             * if (modifier == 0.0f)
                             * {
                             *  modifier = this.allSegments["WeaponCooldown"].GetAveragesByKey(weapon, 1);
                             * }
                             * if (value_length > modifier)
                             * {
                             *  //prop_SetSpeed.SetValue(value_AnimState, value_length / modifier);
                             * }*/
                            //Console.WriteLine("FFW! Post. Length = " + (float)prop_GetLength.GetValue(value_AnimState) + " . Speed = " + (float)prop_GetSpeed.GetValue(value_AnimState));

                            /*if (value_length > this.allSegments["WeaponCooldown"].GetAveragesByKey(weapon, 2))
                             * {
                             *  prop_SetSpeed.SetValue(value_AnimState, value_length / this.allSegments["WeaponCooldown"].GetAveragesByKey(weapon, 2));
                             * }*/
                        }
                    }
                }
            }
        }
Beispiel #36
0
 protected void AddFire(BalanceAction <TUnit> action)
 {
     action.Init(SelfUnit, this, BalanceActionType.Fire);
     FireData.Add(action);
 }
Beispiel #37
0
 public static void Rotate(FireData fd, float rotation)
 {
     fd.Rotation += rotation;
 }
 public static IEnumerable<Danmaku> Fire(this IEnumerable<Danmaku> danmakus,
                         FireData data,
                         bool useRotation = true,
                         Func<Danmaku, bool> filter = null)
     {
     Vector2 tempPos = data.Position;
     float tempRot = data.Rotation;
     danmakus.ForEach(delegate(Danmaku danmaku) {
                          data.Position = danmaku.Position;
                          if (useRotation)
                              data.Rotation = danmaku.Rotation;
                          data.Fire();
                      },
                      filter);
     data.Position = tempPos;
     data.Rotation = tempRot;
     return danmakus;
 }
Beispiel #39
0
 public static void SetRotation(FireData fd, float rotation)
 {
     fd.Rotation = rotation;
 }