예제 #1
0
        public override IPacketWriter BuildForceSpeed(float modifier, SpeedType type = SpeedType.Run)
        {
            var          opcode = type == SpeedType.Swim ? global::Opcodes.SMSG_FORCE_SWIM_SPEED_CHANGE : global::Opcodes.SMSG_FORCE_SPEED_CHANGE;
            PacketWriter writer = new PacketWriter(Sandbox.Instance.Opcodes[opcode], opcode.ToString());

            writer.WriteUInt64(Guid);
            return(this.BuildForceSpeed(writer, modifier));
        }
예제 #2
0
파일: BGMManager.cs 프로젝트: TimonYoon/Dev
    void ChangeBGM(SpeedType destSpeed)
    {
        if (coroutineChangeBGM != null)
        {
            StopCoroutine(coroutineChangeBGM);
        }

        coroutineChangeBGM = StartCoroutine(ChangeBGMA(destSpeed));
    }
예제 #3
0
 public DriveComponent(SpeedType speedType, int speed)
 {
     this.SpeedType      = speedType;
     this.Speed          = speed;
     this.State          = DriveState.Idle;
     this.FlowField      = null;
     this.MovementVector = new Vector2I();
     this.Destination    = new XPos();
 }
예제 #4
0
 public DriveComponent(SpeedType speedType, int speed,
                       DriveState state, IFlowField flowField, Vector2I movementVector, XPos destination)
 {
     this.SpeedType      = speedType;
     this.Speed          = speed;
     this.State          = state;
     this.FlowField      = flowField;
     this.MovementVector = movementVector;
     this.Destination    = destination;
 }
 public void UpdateSpeedometer(float v, VehicleType vehicleType, SpeedType dt = SpeedType.KPH)
 {
     if (vehicleType == VehicleType.Car)
     {
         SpeedometerText.text = v.ToString("000") + "\n<size=16>" + dt.ToString() + "/h</size>";
     }
     else if (vehicleType == VehicleType.Jet)
     {
         SpeedometerText.text = v.ToString("000") + "\n<size=16> KMT/h</size>";
     }
 }
예제 #6
0
 public void SetDesiredSpeed(SpeedType newSpeed)
 {
     if (newSpeed != desiredSpeed)
     {
         if (NavAgent != null)
         {
             NavAgent.avoidancePriority = UnityEngine.Random.Range(0, 21) + Mathf.FloorToInt(Mathf.InverseLerp(0.8f, 5f, SpeedFromEnum(newSpeed)) * 80f);
         }
         desiredSpeed = newSpeed;
     }
 }
예제 #7
0
 public void Set(SpeedType type)
 {
     if (type == SpeedType.Walk)
     {
         current = walk;
     }
     else if (type == SpeedType.Run)
     {
         current = run;
     }
 }
 public bool Search(string str)
 {
     if (WorldID.ToString().Contains(str) || PathID.ToString().Contains(str) || PathIDType.ToString().Contains(str) ||
         PatrolType.ToString().Contains(str) || SpeedType.ToString().Contains(str))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #9
0
 /// <summary>
 /// Will set speed type to one of three options after each click
 /// </summary>
 public void ToggleSpeed()
 {
     if (_cSpeed == SpeedType.QuarterSpeed)
     {
         _cSpeed = SpeedType.HalfSpeed;
     }
     else if (_cSpeed == SpeedType.HalfSpeed)
     {
         _cSpeed = SpeedType.FullSpeed;
     }
     else
     {
         _cSpeed = SpeedType.QuarterSpeed;
     }
 }
예제 #10
0
    public void BPMThird(GameObject go)
    {
        switch (st)
        {
        case SpeedType.Third:
            st = SpeedType.Default;
            go.GetComponent <Image>().color = new Color32(255, 255, 255, 255);
            break;

        default:
            st = SpeedType.Third;
            go.GetComponent <Image>().color -= new Color32(160, 160, 160, 0);
            break;
        }
    }
예제 #11
0
파일: BGMManager.cs 프로젝트: TimonYoon/Dev
 void Update()
 {
     if (Time.timeScale < 2f)
     {
         speedType = SpeedType.Normal;
     }
     else if (Time.timeScale >= 2f && Time.timeScale < 3f)
     {
         speedType = SpeedType.Double;
     }
     else
     {
         speedType = SpeedType.Triple;
     }
 }
    private void OnEnable()
    {
        // Define when the editor opens
        tractionType = TractionType.none;
        speedType    = SpeedType.none;
        breakType    = BreakType.none;

        m_createVehicleIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/CreateVehicleIcon.png");
        m_engineSettingsIcon       = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/EngineSettingsIcon.png");
        m_bodySettingsIcon         = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/BodySettingsIcon.png");
        m_sedanTemplateIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/SedanTemplateIcon.png");
        m_JipTemplateIcon          = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/JipTemplateIcon.png");
        m_TruckTemplateIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/TruckTemplateIcon.png");
        m_BusTemplateIcon          = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/BusTemplateIcon.png");
        m_CustomEngineSettingsIcon = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/CustomVehicleIcon.png");
    }
예제 #13
0
    public static string ReturnSpeedFormatted(double value, SpeedType type)
    {
        string returnValue = "";

        switch (type)
        {
        case SpeedType.Kph:
            returnValue = String.Format("{0:0.#}", value);
            break;

        case SpeedType.Mph:
            returnValue = String.Format("{0:0.#}", value / 1.60934d);
            break;
        }

        return(returnValue);
    }
예제 #14
0
파일: BGMManager.cs 프로젝트: TimonYoon/Dev
    IEnumerator ChangeBGMA(SpeedType destSpeed)
    {
        //bool isFinishFadeOut = false;
        bool isFinishFadeIn = false;

        //대상 속도 음악 재생
        audioSourceList[(int)destSpeed].Play();

        //기존 음악, 새로 재생한 음악 크로스페이드
        while (!isFinishFadeIn)
        {
            for (int i = 0; i < audioSourceList.Count; i++)
            {
                AudioSource audio = audioSourceList[i];

                //목표 속도 음악은 볼륨 업
                if (i == (int)destSpeed)
                {
                    audio.volume += CrossFadeSpeed * Time.deltaTime;
                    if (audio.volume > 1f)
                    {
                        isFinishFadeIn = true;
                        audio.volume   = 1f;
                    }
                }
                //목표 속도 음악 아닌 애들은 볼륨 다운
                else if (i != (int)destSpeed)
                {
                    audio.volume -= CrossFadeSpeed * Time.deltaTime;
                }
            }

            yield return(null);
        }

        for (int i = 0; i < audioSourceList.Count; i++)
        {
            if (i != (int)destSpeed)
            {
                audioSourceList[i].volume = 0f;
                audioSourceList[i].Stop();
            }
        }

        coroutineChangeBGM = null;
    }
예제 #15
0
 public SpeedPowerUp(Vector2 spritePosition, SpeedType speedType) : base(spritePosition, "speedUp")
 {
     if (speedType == SpeedType.UP)
     {
         speedIncrement        = 2f;
         Type                  = PowerUpType.SpeedUp;
         timeToDeactivePowerUp = 15f;
     }
     else
     {
         Type                  = PowerUpType.SpeedDown;
         speedIncrement        = -2f;
         texture               = GfxManager.GetSpritesheet("speedDown").Item1;
         timeToDeactivePowerUp = 10f;
         clipOnPicked          = AudioManager.GetAudioClip("powerUp2");
     }
 }
        public void SetSpeedType(SpeedType type)
        {
            if (type == SpeedType.Accel)
            {
                if (_speedType == SpeedType.Deaccel)
                {
                    _speedType = SpeedType.None;
                }
                else if (_speedType == SpeedType.None)
                {
                    _speedType = SpeedType.Accel;
                }
            }
            if (type == SpeedType.Deaccel)
            {
                if (_speedType == SpeedType.Accel)
                {
                    _speedType = SpeedType.None;
                }
                else if (_speedType == SpeedType.None)
                {
                    _speedType = SpeedType.Deaccel;
                }
            }
            switch (_speedType)
            {
            case SpeedType.None:
                _desiredFOV = _normalFov;
                break;

            case SpeedType.Accel:
                _desiredFOV = _accelFov;
                break;

            case SpeedType.Deaccel:
                _desiredFOV = _normalFov;
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(type), type, null);
            }
        }
예제 #17
0
    public float SpeedFromEnum(SpeedType newSpeed)
    {
        switch (newSpeed)
        {
        case SpeedType.Crouch:
            return(0.8f);

        case SpeedType.SlowWalk:
            return(1.5f);

        case SpeedType.Walk:
            return(2.5f);

        case SpeedType.Sprint:
            return(5f);

        default:
            return(0f);
        }
    }
예제 #18
0
        public bool MoveY(double pos, SpeedType speedType)
        {
            bool result = false;

            MotionMgr.GetInstace().AbsMove(AxisY, pos, (double)speedType);
            Stopwatch stopwatch = new Stopwatch();

            stopwatch.Restart();
            do
            {
                if (stopwatch.ElapsedMilliseconds > 30000)
                {
                    return(false);
                }
                if (MotionMgr.GetInstace().IsAxisNormalStop(AxisY) == AxisState.NormalStop)
                {
                    return(true);
                }

                Thread.Sleep(10);
            }while (true);
        }
예제 #19
0
        public SetSpeed(SpeedType speedType, float value) : base(EventType.SetSpeed)
        {
            SpeedType = speedType;
            switch (speedType)
            {
            case SpeedType.Bpm:
                BeatsPerMinute = value;
                BpmMultiplier  = 1.0f;
                break;

            case SpeedType.Multiplier:
                BeatsPerMinute = 100;
                BpmMultiplier  = value;
                break;

            case SpeedType.NotAvailable:
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(speedType), speedType, null);
            }
        }
예제 #20
0
    public bool PayMovementAllowance(int cost, SpeedType type)
    {
        Speed speed = speedArray[(int)type];

        // if (cost > speed.currentValue && speed.currentValue != speed.baseSpeed)
        if (cost > speed.GetMoveLeft() && speed.HasSpentMovePoints())
        {
            //noMoveLeft = true;
            //this means we cannot move because we cannot pay the price!
            return(false);
        }
        //TODO , as we pay the price we should reduce all movement types
        speed.PaySpeed(cost);

        /*
         *      if (speed.currentValue <= 0)
         *      {
         *              speed.currentValue = 0;
         *              //noMoveLeft = true;
         *      }*/
        return(true);
    }
예제 #21
0
        public void SetSpeed(int speedPercent)
        {
            if (_current != speedPercent)
            {
                if (speedPercent == 80)
                {
                    _type = SpeedType.Fixed;
                }
                else if (speedPercent < 80)
                {
                    _type      = SpeedType.Skip;
                    _frequency = 80 / (80 - speedPercent);
                }
                else
                {
                    _type      = SpeedType.Extra;
                    _frequency = 80 / (speedPercent - 80);
                }

                _current = speedPercent;
            }
        }
        public static float convert_from_mps(SpeedType t, float mps, Vessel v)
        {
            switch (t)
            {
            case SpeedType.MetersPerSecond:
                return(mps);

            case SpeedType.Mach:
                return((float)(mps / v.speedOfSound));

            case SpeedType.Knots:
                return(mps * mps2kts);

            case SpeedType.IAS:
                return(Mathf.Sqrt(mps * mps * (float)v.atmDensity));

            case SpeedType.KIAS:
                return(Mathf.Sqrt(mps * mps * mps2kts * mps2kts * (float)v.atmDensity));

            default:
                return(0.0f);
            }
        }
예제 #23
0
        public string ToString(SpeedType speedType)
        {
            double value = 0;

            switch (speedType)
            {
            case SpeedType.BytePerSeconds:
                value = InBytesPerSeconds;
                break;

            case SpeedType.KiloBytesPerSeconds:
                value = InKiloBytesPerSeconds;
                break;

            case SpeedType.MegaBytesPerSeconds:
                value = InMegaBytesPerSeconds;
                break;
            }

            var result = String.Format(" {0:F} {1}", value, speedType.ToDescription());

            return(result);
        }
예제 #24
0
        public static string Speed(this ActivityDto activity, SpeedType speedType)
        {
            if (activity.Distance > 0)
            {

                if (speedType == SpeedType.KmPerHour)
                {
                    return
                        Decimal.Divide(activity.Distance, Convert.ToDecimal(activity.Duration.TotalHours))
                               .ToString("F2");
                }
                else
                {
                    return
                        Decimal.Divide(Convert.ToDecimal(activity.Duration.TotalMinutes), activity.Distance)
                               .ToString("F2");
                }
            }
            else
            {
                return "";
            }
        }
예제 #25
0
        private UInt16 GetFrameDelayCommon(SpeedType speedType, Single percentage, UInt16 enemyFrameDelay, UInt16 enemyFrameRange, UInt16 enemyFrameMinim)
        {
            // 360 degrees in sine wave.
            UInt16 index = (Byte)MyGame.Manager.RandomManager.Next(DEGREES_PER_CIRCLE);
            Single value = DelayWaves[index];

            if (SpeedType.Fast == speedType)
            {
                value  = Math.Abs(value);
                value += percentage;
            }

            Int16 multi = (Int16)(value * enemyFrameRange);
            Int16 delay = (Int16)(enemyFrameDelay - multi);

            // Prevent from too fast...!
            if (delay < enemyFrameMinim)
            {
                delay = (Int16)enemyFrameMinim;
            }

            return((UInt16)delay);
        }
예제 #26
0
    public static (string, float) SpeedTypeConverter(SpeedType SpeedType)
    {
        float  SpeedCoefficient = 1.0f;
        string SpeedString      = "m/s";

        switch (SpeedType)
        {
        case SpeedType.MPH:
            SpeedString      = " MPH";
            SpeedCoefficient = 2.23693629f;
            break;

        case SpeedType.KPH:
            SpeedString      = " km/h";
            SpeedCoefficient = 3.6f;
            break;

        case SpeedType.MPS:
            SpeedString      = " m/s";
            SpeedCoefficient = 1.0f;
            break;
        }
        return(SpeedString, SpeedCoefficient);
    }
        /// <summary>
        /// Standard speed control GUI block to integrate in other controllers
        /// </summary>
        /// <returns>true if speed control is enabled</returns>
        public bool SpeedCtrlGUIBlock()
        {
            spd_control_enabled = GUILayout.Toggle(spd_control_enabled, "Speed control", GUIStyles.toggleButtonStyle);
            GUILayout.BeginHorizontal();
            for (int i = 1; i < 6; i++)
            {
                if (GUILayout.Toggle(chosen_spd_mode == i, spd_str_arr[i], GUIStyles.toggleButtonStyle))
                {
                    chosen_spd_mode = i;
                }
            }
            GUILayout.EndHorizontal();

            SpeedType newtype = type;

            if (chosen_spd_mode != 0)
            {
                newtype = (SpeedType)(chosen_spd_mode - 1);
            }

            setpoint_field.DisplayLayout(GUIStyles.textBoxStyle);

            if (newtype != type)
            {
                // need to convert old setpoint to new format
                setpoint_field.Value = setpoint.convert(newtype);
                setpoint             = new SpeedSetpoint(newtype, setpoint_field, vessel);
                type = newtype;
            }
            else
            {
                setpoint = new SpeedSetpoint(type, setpoint_field, vessel);
            }

            return(spd_control_enabled);
        }
예제 #28
0
        private void radioButton1_CheckedChanged(object sender, EventArgs e)
        {
            SpeedType speedtype = SpeedType.RealSpeed;

            if (radioButton1.Checked)
            {
                speedtype = SpeedType.RealSpeed;
            }
            else if (radioButton2.Checked)
            {
                speedtype = SpeedType.SingleTripSpeed;
            }
            else if (radioButton3.Checked)
            {
                speedtype = SpeedType.AvgSpeedperPacket;
            }
            else if (radioButton4.Checked)
            {
                speedtype = SpeedType.RealCountSpeed;
            }
            else if (radioButton5.Checked)
            {
                speedtype = SpeedType.SingleTripCountSpeed;
            }
            else if (radioButton6.Checked)
            {
                speedtype = SpeedType.AvgCountSpeedperPacket;
            }
            lock (sendreports)
            {
                foreach (var v in sendreports)
                {
                    v.Value.speedtype = speedtype;
                }
            }
        }
예제 #29
0
 public void SetLightSpeed(SpeedType speed)
 {
     if (speed == SpeedType.Fast)
     {
         lightSpeed = FAST_SPEED;
     }
     else
     {
         lightSpeed = NORMAL_SPEED;
     }
 }
예제 #30
0
		public override void LoadRules(FileFormats.IniFile.IniSection rules) {
			base.LoadRules(rules);

			LandTargeting = rules.ReadInt("LandTargeting");
			NavalTargeting = rules.ReadInt("NavalTargeting");
			SpeedType = rules.ReadEnum<SpeedType>("SpeedType", SpeedType.Clear);
			TypeImmune = rules.ReadBool("TypeImmune");
			WalkRate = rules.ReadFloat("WalkRate", 1);
			MoveRate = rules.ReadFloat("MoveRate");
			MoveToShroud = rules.ReadBool("MoveToShroud", true);
			IsTrain = rules.ReadBool("IsTrain");
			DoubleOwned = rules.ReadBool("DoubleOwned");
			GuardRange = (int)rules.ReadFloat("GuardRange");
			Explodes = rules.ReadBool("Explodes");
			DeathWeapon = TypesRepository.GetWeaponType(rules.ReadString("DeathWeapon"));
			DeathWeaponDamageModifier = rules.ReadFloat("DeathWeaponDamageModifier", 1);
			FlightLevel = rules.ReadInt("FlightLevel", -1);
			IsDropship = rules.ReadBool("IsDropship");
			PitchAngle = rules.ReadFloat("PitchAngle", 0.349066f);
			RollAngle = rules.ReadFloat("RollAngle", 0.523599f);
			PitchSpeed = rules.ReadFloat("PitchSpeed", 0.25f);
			Locomotor = Guid.Parse(rules.ReadString("Locomotor", "{4A582747-9839-11d1-B709-00A024DDAFD1}"));
			CloakingSpeed = rules.ReadInt("CloakingSpeed", 7);
			ThreatAvoidanceCoefficient = rules.ReadFloat("ThreatAvoidanceCoefficient");
			SlowdownDistance = rules.ReadInt("SlowdownDistance", 500);
			DeaccelerationFactor = rules.ReadFloat("DeaccelerationFactor", 0.002f);
			AccelerationFactor = rules.ReadFloat("AccelerationFactor", 0.03f);
			Weight = rules.ReadFloat("Weight", 1);
			PhysicalSize = rules.ReadFloat("PhysicalSize", 2);
			Size = rules.ReadFloat("Size", 1);
			SizeLimit = rules.ReadFloat("SizeLimit");
			HoverAttack = rules.ReadBool("HoverAttack");
			VHPScan = rules.ReadEnum<VHPScan>("VHPScan", VHPScan.None);
			MaxDebris = rules.ReadInt("MaxDebris");
			MinDebris = rules.ReadInt("MinDebris");
			DebrisTypes = GetList<VoxelAnimation>(rules.ReadList("DebrisTypes"));
			DebrisMaximums = rules.ReadList("DebrisMaximums").Select(int.Parse).ToList();
			DebrisAnims = GetList<VoxelAnimation>(rules.ReadList("DebrisAnims"));
			HasTurretTooltips = rules.ReadBool("HasTurretTooltips");
			TurretCount = rules.ReadInt("TurretCount");
			WeaponCount = rules.ReadInt("WeaponCount");
			IsChargeTurret = rules.ReadBool("IsChargeTurret");
			ClearAllWeapons = rules.ReadBool("ClearAllWeapons");
			Primary = TypesRepository.GetWeaponType(rules.ReadString("Primary"));
			Secondary = TypesRepository.GetWeaponType(rules.ReadString("Secondary"));
			ElitePrimary = TypesRepository.GetWeaponType(rules.ReadString("ElitePrimary"));
			EliteSecondary = TypesRepository.GetWeaponType(rules.ReadString("EliteSecondary"));
			WeaponX = TypesRepository.GetWeaponType(rules.ReadString("WeaponX"));
			EliteWeaponX = TypesRepository.GetWeaponType(rules.ReadString("EliteWeaponX"));
			VoiceMove = GetList<Sound>(rules.ReadList("VoiceMove"));
			VoiceSelect =GetList<Sound>( rules.ReadList("VoiceSelect"));
			VoiceSelectEnslaved = GetList<Sound>( rules.ReadList("VoiceSelectEnslaved"));
			VoiceSelectDeactivated = GetList<Sound>( rules.ReadList("VoiceSelectDeactivated"));
			VoiceAttack = GetList<Sound>( rules.ReadList("VoiceAttack"));
			VoiceSpecialAttack = GetList<Sound>( rules.ReadList("VoiceSpecialAttack"));
			VoiceDie = GetList<Sound>( rules.ReadList("VoiceDie"));
			VoiceFeedback = GetList<Sound>( rules.ReadList("VoiceFeedback"));
			AuxSound1 = TypesRepository.GetSound(rules.ReadString("AuxSound1"));
			AuxSound2	 = TypesRepository.GetSound(rules.ReadString("AuxSound2"));
			CreateSound	 = TypesRepository.GetSound(rules.ReadString("CreateSound"));
			DamageSound	 = TypesRepository.GetSound(rules.ReadString("DamageSound"));
			ImpactWaterSound	 = TypesRepository.GetSound(rules.ReadString("ImpactWaterSound"));
			ImpactLandSound = TypesRepository.GetSound(rules.ReadString("ImpactLandSound"));
			CrashingSound	 = TypesRepository.GetSound(rules.ReadString("CrashingSound"));
			SinkingSound	 = TypesRepository.GetSound(rules.ReadString("SinkingSound"));
			VoiceFalling	 = TypesRepository.GetSound(rules.ReadString("VoiceFalling"));
			VoiceCrashing	 = TypesRepository.GetSound(rules.ReadString("VoiceCrashing"));
			VoiceSinking	 = TypesRepository.GetSound(rules.ReadString("VoiceSinking"));
			VoiceEnter	 = TypesRepository.GetSound(rules.ReadString("VoiceEnter"));
			VoiceCapture = TypesRepository.GetSound(rules.ReadString("VoiceCapture"));
			CloakStop = rules.ReadBool("CloakStop");
			Storage = rules.ReadInt("Storage");
			BuildLimit = rules.ReadInt("BuildLimit", 2147483647);
			Category = rules.ReadEnum<Category>("Category", Category.None);
			Dock = GetList<BuildingType>(rules.ReadList("Dock"));
			DeploysInto = Get<BuildingType>("DeploysInto");
			UndeploysInto = Get<VehicleType>("UndeploysInto");
			PowersUnit = Get<VehicleType>(rules.ReadString("PowersUnit"));
			PoweredUnit = rules.ReadBool("PoweredUnit");
			LightningRod = rules.ReadBool("LightningRod");
			ManualReload = rules.ReadBool("ManualReload");
			TurretSpins = rules.ReadBool("TurretSpins");
			TiltCrashJumpjet = rules.ReadBool("TiltCrashJumpjet");
			Turret = rules.ReadBool("Turret");
			TurretRotateSound	 = TypesRepository.GetSound(rules.ReadString("TurretRotateSound"));	
			EnterTransportSound	 = TypesRepository.GetSound(rules.ReadString("EnterTransportSound"));	
			LeaveTransportSound		 = TypesRepository.GetSound(rules.ReadString("LeaveTransportSound"));	
			MoveSound = GetList<Sound>(rules.ReadList("MoveSound"));
			DieSound = GetList<Sound>(rules.ReadList("DieSound"));
			DeploySound	 = TypesRepository.GetSound(rules.ReadString("DeploySound"));		
			UndeploySound	= TypesRepository.GetSound(rules.ReadString("UndeploySound"));			
			ChronoInSound	= TypesRepository.GetSound(rules.ReadString("ChronoInSound"));			
			ChronoOutSound	= TypesRepository.GetSound(rules.ReadString("ChronoOutSound"));			
			VoiceHarvest	= TypesRepository.GetSound(rules.ReadString("VoiceHarvest"));			
			VoicePrimaryWeaponAttack	= TypesRepository.GetSound(rules.ReadString("VoicePrimaryWeaponAttack"));			
			VoicePrimaryEliteWeaponAttack	= TypesRepository.GetSound(rules.ReadString("VoicePrimaryEliteWeaponAttack"));			
			VoiceSecondaryWeaponAttack	= TypesRepository.GetSound(rules.ReadString("VoiceSecondaryWeaponAttack"));			
			VoiceSecondaryEliteWeaponAttack	= TypesRepository.GetSound(rules.ReadString("VoiceSecondaryEliteWeaponAttack"));			
			VoiceDeploy	= TypesRepository.GetSound(rules.ReadString("VoiceDeploy"));			
			VoiceUndeploy	= TypesRepository.GetSound(rules.ReadString("VoiceUndeploy"));			
			EnterGrinderSound	= TypesRepository.GetSound(rules.ReadString("EnterGrinderSound"));			
			LeaveGrinderSound	= TypesRepository.GetSound(rules.ReadString("LeaveGrinderSound"));			
			EnterBioReactorSound	= TypesRepository.GetSound(rules.ReadString("EnterBioReactorSound"));			
			LeaveBioReactorSound	= TypesRepository.GetSound(rules.ReadString("LeaveBioReactorSound"));			
			ActivateSound	= TypesRepository.GetSound(rules.ReadString("ActivateSound"));			
			DeactivateSound	= TypesRepository.GetSound(rules.ReadString("DeactivateSound"));			
			MindClearedSound	= TypesRepository.GetSound(rules.ReadString("MindClearedSound"));			

			Explosion = GetList<Animation>(rules.ReadList("Explosion"));
			DestroyAnim = GetList<Animation>(rules.ReadList("DestroyAnim"));
			NaturalParticleSystem = Get<ParticleSystem>(rules.ReadString("NaturalParticleSystem"));
			RefinerySmokeParticleSystem = Get<ParticleSystem>(rules.ReadString("RefinerySmokeParticleSystem"));
			NaturalParticleLocation = rules.ReadXYZ("NaturalPrules.cleLocation");
			DamageParticleSystems = GetList<ParticleSystem>(rules.ReadList("DamageParticleSystems"));
			DestroyParticleSystems = GetList<ParticleSystem>(rules.ReadList("DestroyParticleSystems"));
			DamageSmokeOffset = rules.ReadXYZ("DamageSmokeOffset");
			DamSmkOffScrnRel = rules.ReadBool("DamSmkOffScrnRel");
			DestroySmokeOffset = rules.ReadXYZ("DestroySmokeOffset");
			RefinerySmokeOffsetOne = rules.ReadXYZ("RefinerySmokeOffsetOne");
			RefinerySmokeOffsetTwo = rules.ReadXYZ("RefinerySmokeOffsetTwo");
			RefinerySmokeOffsetThree = rules.ReadXYZ("RefinerySmokeOffsetThree");
			RefinerySmokeOffsetFour = rules.ReadXYZ("RefinerySmokeOffsetFour");
			Nominal = rules.ReadBool("Nominal");
			DontScore = rules.ReadBool("DontScore");
			DamageSelf = rules.ReadBool("DamageSelf");
			Cloakable = rules.ReadBool("Cloakable");
			GapGenerator = rules.ReadBool("GapGenerator");
			GapRadiusInCells = rules.ReadInt("GapRadiusInCells");
			SuperGapRadiusInCells = rules.ReadInt("SuperGapRadiusInCells");
			Teleporter = rules.ReadBool("Teleporter");
			Sensors = rules.ReadBool("Sensors");
			IsGattling = rules.ReadBool("IsGattling");
			WeaponStages = rules.ReadInt("WeaponStages");
			RateUp = rules.ReadInt("RateUp");
			RateDown = rules.ReadInt("RateDown");
			StageX = rules.ReadInt("StageX");
			EliteStageX = rules.ReadInt("EliteStageX");
			PipScale = rules.ReadEnum("PipScale", PipScale.none);
			PipsDrawForAll = rules.ReadBool("PipsDrawForAll");
			LeptonMindControlOffset = rules.ReadInt("LeptonMindControlOffset", 70);
			PixelSelectionBracketDelta = rules.ReadBool("PixelSelectionBracketDelta");
			PipWrap = rules.ReadInt("PipWrap");
			Prerequisite = GetList<Prerequisite>(rules.ReadList("Prerequisite"));
			PrerequisiteOverride = GetList<Prerequisite>(rules.ReadList("PrerequisiteOverride"));
			Sight = rules.ReadInt("Sight");
			ReselectIfLimboed = rules.ReadBool("ReselectIfLimboed");
			RejoinTeamIfLimboed = rules.ReadBool("RejoinTeamIfLimboed");
			SensorsSight = rules.ReadInt("SensorsSight");
			DetectDisguiseRange = rules.ReadInt("DetectDisguiseRange");
			BombSight = rules.ReadInt("BombSight");
			LeadershipRating = rules.ReadInt("LeadershipRating", 5);
			MindControlRingOffset = rules.ReadInt("MindControlRingOffset", 140);
			BuildTimeMultiplier = rules.ReadFloat("BuildTimeMultiplier", 1);
			RevealToAll = rules.ReadBool("RevealToAll");
			Drainable = rules.ReadBool("Drainable");
			OpenTopped = rules.ReadBool("OpenTopped");
			ResourceGatherer = rules.ReadBool("ResourceGatherer");
			ResourceDestination = rules.ReadBool("ResourceDestination");
			CanDisguise = rules.ReadBool("CanDisguise");
			PermaDisguise = rules.ReadBool("PermaDisguise");
			DetectDisguise = rules.ReadBool("DetectDisguise");
			DisguiseWhenStill = rules.ReadBool("DisguiseWhenStill");
			CanPassiveAquire = rules.ReadBool("CanPassiveAquire", true);
			CanRetaliate = rules.ReadBool("CanRetaliate", true);
			CanApproachTarget = rules.ReadBool("CanApproachTarget", true);
			CanRecalcApproachTarget = rules.ReadBool("CanRecalcApproachTarget", true);
			RequiresStolenThirdTech = rules.ReadBool("RequiresStolenThirdTech");
			RequiresStolenSovietTech = rules.ReadBool("RequiresStolenSovietTech");
			RequiresStolenAlliedTech = rules.ReadBool("RequiresStolenAlliedTech");
			RequiredHouses = GetList<House>(rules.ReadList("RequiredHouses"));
			SecretHouses = GetList<House>(rules.ReadList("SecretHouses"));
			ForbiddenHouses = GetList<House>(rules.ReadList("ForbiddenHouses"));
			TechLevel = rules.ReadInt("TechLevel", 255);
			AirstrikeTeam = rules.ReadInt("AirstrikeTeam");
			EliteAirstrikeTeam = rules.ReadInt("EliteAirstrikeTeam");
			AirstrikeTeamType =  Get<AircraftType>(rules.ReadString("AirstrikeTeamType"));
			EliteAirstrikeTeamType = Get<AircraftType>(rules.ReadString("EliteAirstrikeTeamType"));
			AirstrikeRechargeTime = rules.ReadInt("AirstrikeRechargeTime");
			EliteAirstrikeRechargeTime = rules.ReadInt("EliteAirstrikeRechargeTime");
			Speed = rules.ReadInt("Speed");
			Cost = rules.ReadInt("Cost");
			Soylent = rules.ReadInt("Soylent");
			UnloadingClass = Get<VehicleType>(rules.ReadString("UnloadingClass"));
			DeployingAnim = Get<Animation>(rules.ReadString("DeployingAnim"));
			InitialAmmo = rules.ReadInt("InitialAmmo", -1);
			Ammo = rules.ReadInt("Ammo", -1);
			IFVMode = rules.ReadInt("IFVMode");
			AirRangeBonus = rules.ReadFloat("AirRangeBonus");
			RadialFireSegments = rules.ReadInt("RadialFireSegments");
			DeployFireWeapon = rules.ReadInt("DeployFireWeapon", 1);
			DeployFire = rules.ReadBool("DeployFire");
			DeployToLand = rules.ReadBool("DeployToLand");
			MobileFire = rules.ReadBool("MobileFire", true);
			OpportunityFire = rules.ReadBool("OpportunityFire");
			DistributedFire = rules.ReadBool("DistributedFire");
			Reload = rules.ReadInt("Reload");
			EmptyReload = rules.ReadInt("EmptyReload", -1);
			ReloadIncrement = rules.ReadInt("ReloadIncrement");
			DamageReducesReadiness = rules.ReadBool("DamageReducesReadiness");
			ReadinessReductionMultiplier = rules.ReadFloat("ReadinessReductionMultiplier");
			BerserkFriendly = rules.ReadBool("BerserkFriendly");
			SprayAttack = rules.ReadBool("SprayAttack");
			Pushy = rules.ReadBool("Pushy");
			Natural = rules.ReadBool("Natural");
			Unnatural = rules.ReadBool("Unnatural");
			CloseRange = rules.ReadBool("CloseRange");
			PreventAttackMove = rules.ReadBool("PreventAttackMove");
			Points = rules.ReadInt("Points");
			ThreatPosed = rules.ReadInt("ThreatPosed");
			Owner = GetList<House>(rules.ReadList("Owner"));
			AIBasePlanningSide = rules.ReadInt("AIBasePlanningSide", -1);
			Trainable = rules.ReadBool("Trainable", true);
			Crewed = rules.ReadBool("Crewed");
			Gunner = rules.ReadBool("Gunner");
			Naval = rules.ReadBool("Naval");
			Repairable = rules.ReadBool("Repairable", true);
			Invisible = rules.ReadBool("Invisible");
			RadarVisible = rules.ReadBool("RadarVisible");
			SelfHealing = rules.ReadBool("SelfHealing");
			NoAutoFire = rules.ReadBool("NoAutoFire");
			ROT = rules.ReadInt("ROT");
			Passengers = rules.ReadInt("Passengers");
			FireAngle = rules.ReadInt("FireAngle", 8);
			DeployTime = rules.ReadFloat("DeployTime");
			UndeployDelay = rules.ReadInt("UndeployDelay", -1);
			Disableable = rules.ReadBool("Disableable", true);
			ToProtect = rules.ReadBool("ToProtect");
			TiberiumHeal = rules.ReadBool("TiberiumHeal");
			ImmuneToVeins = rules.ReadBool("ImmuneToVeins");
			AllowedToStartInMultiplayer = rules.ReadBool("AllowedToStrules.nMultiplayer", true);
			StupidHunt = rules.ReadBool("StupidHunt");
			TargetLaser = rules.ReadBool("TargetLaser");
			HunterSeeker = rules.ReadBool("HunterSeeker");
			Crusher = rules.ReadBool("Crusher");
			OmniCrusher = rules.ReadBool("OmniCrusher");
			OmniCrushResistant = rules.ReadBool("OmniCrushResistant");
			AutoCrush = rules.ReadBool("AutoCrush");
			ImmuneToRadiation = rules.ReadBool("ImmuneToRadiation");
			Underwater = rules.ReadBool("Underwater");
			BalloonHover = rules.ReadBool("BalloonHover");
			Slaved = rules.ReadBool("Slaved");
			Enslaves = TypesRepository.GetInfantryType(rules.ReadString("Enslaves"));
			SlaveRegenRate = rules.ReadInt("SlaveRegenRate");
			SlavesNumber = rules.ReadInt("SlavesNumber");
			SlaveReloadRate = rules.ReadInt("SlaveReloadRate");
			OpenTransportWeapon = rules.ReadInt("OpenTransportWeapon", -1);
			Spawned = rules.ReadInt("Spawned");
			Spawns = TypesRepository.GetAircraftType(rules.ReadString("Spawns"));
			SpawnRegenRate = rules.ReadInt("SpawnRegenRate");
			SpawnsNumber = rules.ReadInt("SpawnsNumber");
			SpawnReloadRate = rules.ReadInt("SpawnReloadRate");
			MissileSpawn = rules.ReadBool("MissileSpawn");
			DefaultToGuardArea = rules.ReadBool("DefaultToGuardArea");
			Warpable = rules.ReadBool("Warpable", true);
			Parasiteable = rules.ReadBool("Parasiteable");
			ImmuneToPsionics = rules.ReadBool("ImmuneToPsionics");
			ImmuneToPsionicWeapons = rules.ReadBool("ImmuneToPsionicWeapons");
			ConsideredAircraft = rules.ReadBool("ConsideredAircraft");
			Bunkerable = rules.ReadBool("Bunkerable");
			Organic = rules.ReadBool("Organic");
			ImmuneToPoison = rules.ReadBool("ImmuneToPoison");
			SuppressionThreshold = rules.ReadFloat("SuppressionThreshold");
			NoShadow = rules.ReadBool("NoShadow");
			JumpjetTurnRate = rules.ReadInt("JumpjetTurnRate", 4);
			JumpjetSpeed = rules.ReadFloat("JumpjetSpeed", 14);
			JumpjetClimb = rules.ReadFloat("JumpjetClimb", 5);
			JumpjetCrash = rules.ReadFloat("JumpjetCrash", 5);
			JumpjetHeight = rules.ReadInt("JumpjetHeight", 500);
			JumpjetAccel = rules.ReadFloat("JumpjetAccel", 2);
			JumpjetWobbles = rules.ReadFloat("JumpjetWobbles", 0.15f);
			JumpjetNoWobbles = rules.ReadBool("JumpjetNoWobbles");
			JumpjetDeviation = rules.ReadInt("JumpjetDeviation", 40);
			JumpJet = rules.ReadBool("JumpJet");
			Crashable = rules.ReadBool("Crashable");
			AttackFriendlies = rules.ReadBool("AttackFriendlies");
			AttackCursorOnFriendlies = rules.ReadBool("AttackCursorOnFriendlies");
			TurretRecoil = rules.ReadBool("TurretRecoil");
			TurretTravel = rules.ReadInt("TurretTravel", 2);
			TurretCompressFrames = rules.ReadInt("TurretCompressFrames", 1);
			TurretHoldFrames = rules.ReadInt("TurretHoldFrames", 1);
			TurretRecoverFrames = rules.ReadInt("TurretRecoverFrames", 1);
			BarrelTravel = rules.ReadInt("BarrelTravel", 2);
			BarrelCompressFrames = rules.ReadInt("BarrelCompressFrames", 1);
			BarrelHoldFrames = rules.ReadInt("BarrelHoldFrames", 1);
			BarrelRecoverFrames = rules.ReadInt("BarrelRecoverFrames", 1);
			TiltsWhenCrushes = rules.ReadBool("TiltsWhenCrushes", true);
			Accelerates = rules.ReadBool("Accelerates", true);
			ZFudgeCliff = rules.ReadInt("ZFudgeCliff", 10);
			ZFudgeColumn = rules.ReadInt("ZFudgeColumn", 5);
			ZFudgeTunnel = rules.ReadInt("ZFudgeTunnel", 10);
			ZFudgeBridge = rules.ReadInt("ZFudgeBridge");
			VeteranAbilities = ReadFlags<Abilities>(rules.ReadList("VeteranAbilities"));
			EliteAbilities = ReadFlags<Abilities>(rules.ReadList("EliteAbilities"));
			MyEffectivenessCoefficient = rules.ReadFloat("MyEffectivenessCoefficient");
			TargetEffectivenessCoefficient = rules.ReadFloat("TargetEffectivenessCoefficient");
			TargetSpecialThreatCoefficient = rules.ReadFloat("TargetSpecialThreatCoefficient");
			TargetStrengthCoefficient = rules.ReadFloat("TargetStrengthCoefficient");
			TargetDistanceCoefficient = rules.ReadFloat("TargetDistanceCoefficient");
			SpecialThreatValue = rules.ReadFloat("SpecialThreatValue");
			IsSelectableCombatant = rules.ReadBool("IsSelectableCombatant");
			MovementZone = rules.ReadEnum<MovementZone>("MovementZone", MovementZone.Normal);

		}
예제 #31
0
 public CodeSpeed(SpeedType type)
 {
     this.Type = type;
     this.speedTable = new Dictionary<SpeedType, float>();
     speedTable[SpeedType.Speed01] = 0.4f;
     speedTable[SpeedType.Speed05] = 3.0f;
     speedTable[SpeedType.Speed10] = 10.0f;
 }
예제 #32
0
 public MoveTool(Vector3 target, SpeedType speed)
 {
     this.target = target;
     this.speed = speed;
 }
예제 #33
0
 /// <summary>
 /// Initialize the creature.
 /// </summary>
 private void Initialize()
 {
     //Initialize the class.
     _Gender = Gender.Male;
     _Types = new List<PokemonType>();
     _Moves = new List<Move>();
     _Sprite = new SpriteManager();
     _MaxEnergy = 100;
     _CurrentEnergy = _MaxEnergy;
     _Position = Vector2.Zero;
     _Velocity = Vector2.Zero;
     _TimeBetweenMoving = .01f;
     _ElapsedMovementTime = 0;
     _ElapsedEnergyTime = 0;
     _EnergyRecoverySpeed = .1f;
     _BattleState = BattleState.Idle;
     _FacingDirection = Direction.Down;
     _MovementSpeed = InsipidusEngine.SpeedType.Still;
 }
예제 #34
0
        protected override void Setup()
        {
            CreateInputKeywordAsObservable("snax")
            .Subscribe(_ => IsActive = !IsActive);

            IsActiveAsObservable
            .Where(x => x)
            .Subscribe(x =>
            {
                DrawText($"SpeedMax:{IsActive}[Type:{(currentSpeedType)}][Exclude:{excludeMissionVehicle}]");
                vehicleHashSet.Clear();
            });

            IsActiveAsObservable
            .Skip(1)
            .Where(x => !x)
            .Subscribe(x =>
            {
                DrawText($"SpeedMax:{IsActive}");
                vehicleHashSet.Clear();
            });

            //ミッション開始直後に一瞬動作を止めるフラグ
            var suspednFlag = false;

            OnThinnedTickAsObservable
            .Where(_ => IsActive && !suspednFlag)
            .Subscribe(_ =>
            {
                foreach (var v in CachedVehicles
                         .Where(x =>
                                x.IsSafeExist() &&
                                x.IsInRangeOf(PlayerPed.Position, 100.0f) &&
                                !vehicleHashSet.Contains(x.Handle) &&
                                !(excludeMissionVehicle && x.IsPersistent)
                                ))
                {
                    vehicleHashSet.Add(v.Handle);
                    if (currentSpeedType == SpeedType.Original)
                    {
                        StartCoroutine(OriginalSpeedMaxCoroutine(v));
                    }
                    else
                    {
                        StartCoroutine(VehicleSpeedMaxCorutine(v));
                    }
                }
            });
            var nextType = currentSpeedType;

            OnKeyDownAsObservable
            .Where(x => IsActive && x.KeyCode == Keys.F6)
            .Do(_ =>
            {
                nextType = GetNextSpeedType(nextType);
                DrawText($"SpeedMax:[Type:{nextType}]", 1.0f);
            })
            .Throttle(TimeSpan.FromSeconds(1))
            .Subscribe(_ =>
            {
                currentSpeedType = nextType;
                DrawText($"SpeedMax:[Type:{(currentSpeedType)}][OK]", 2.0f);
                StopAllCoroutine();
                vehicleHashSet.Clear();
            });

            OnKeyDownAsObservable
            .Where(x => IsActive && x.KeyCode == Keys.F5)
            .Subscribe(_ =>
            {
                excludeMissionVehicle = !excludeMissionVehicle;
                vehicleHashSet.Clear();
                StopAllCoroutine();
                DrawText($"SpeedMax:ExcludeMissionVehicles[{excludeMissionVehicle}]");
            });

            OnThinnedTickAsObservable
            .Where(_ => IsActive)
            .Select(_ => PlayerPed.IsAlive)
            .DistinctUntilChanged()
            .Where(x => x)
            .Subscribe(_ => vehicleHashSet.Clear());

            //ミッションが始まった時にしばらく動作を止める
            OnThinnedTickAsObservable
            .Where(_ => IsActive)
            .Select(_ => Game.MissionFlag)
            .DistinctUntilChanged()
            .Where(x => x)
            .Do(_ => suspednFlag = true)
            .Delay(TimeSpan.FromSeconds(3))
            .Subscribe(_ => suspednFlag = false);
        }
예제 #35
0
 private SpeedType GetNextSpeedType(SpeedType current)
 {
     return((SpeedType)(((int)current + 1) % Enum.GetNames(typeof(SpeedType)).Length));
 }
예제 #36
0
    public int GetCostToEnter(DataEntry targetData, int dirX, int dirY, float distance, SpeedType speedType)
    {
        //TODO tänne voisi laittaa monta vaihtehtoista speedtypeä ja niistä sitten valitaan se mikä on halvin liikkujalle, ja käytetään sitä.
        char code;
        int  index = ConvertToNumber(dirX, dirY);

        Debug.Log(dirX + "," + dirY + "=>" + index);

        if (targetData != null && targetData.code != null && index < targetData.code.Length)
        {
            code = targetData.code[index];
        }
        else
        {
            code = '_';//this means clear
        }

        Debug.Log("distance=" + distance + " and movecode=" + code);

        //now if we got code S then it means solid wall, no pass. This might be made better too. S is also used in drawing the maps
        if (code == 'X')
        {
            //negative number means we cannot pass.
            return(-1);
        }
        //easy way, but maybe we could change it a little if it gives strange numbers.
        float cost = 5F * distance;

        return((int)cost);
    }
예제 #37
0
        /// <summary>
        /// Update the creature's movement.
        /// </summary>
        private void UpdateMovement()
        {
            //Whether it is time to move.
            if (_ElapsedMovementTime >= _TimeBetweenMoving)
            {
                //Try to keep our distance.
                //KeepDistance();

                //Update the velocity and clamp it if needed. Also update the position.
                UpdateVelocity();
                _Position += _Velocity;

                //Begin the cycle anew.
                _ElapsedMovementTime -= _TimeBetweenMoving;
            }

            //Determine which direction to face based upon velocity.
            float dir = Calculator.VectorToRadians(_Velocity / _Velocity.Length()) / Calculator.RadiansToDegreesRatio;

            //If the direction is not valid, ie. NaN, keep the previous facing direction.
            if (!float.IsNaN(dir))
            {
                //Determine the facing direction.
                if (dir >= -30 && dir <= 30) { _FacingDirection = Direction.Up; }
                else if ((dir >= 150 && dir <= 180) || (dir >= -180 && dir <= -120)) { _FacingDirection = Direction.Down; }
                else if (dir >= 60 && dir <= 120) { _FacingDirection = Direction.Right; }
                else if (dir >= -120 && dir <= -30) { _FacingDirection = Direction.Left; }
            }

            //The current speed.
            float speed = _Velocity.LengthSquared();

            //Determine the movement speed.
            if (speed > 4) { _MovementSpeed = SpeedType.Fast; }
            else if (speed > 1.5f) { _MovementSpeed = SpeedType.Normal; }
            else if (speed > .5f) { _MovementSpeed = SpeedType.Slow; }
            else { _MovementSpeed = SpeedType.Still; }
        }