private void CreateArm(FireType type) { switch (type) { case FireType.Straight: curArms = new Straight(FirePoint, account); break; case FireType.HighSpeed: curArms = new HighSpeed(FirePoint, account); break; case FireType.Shotgun: curArms = new Shotgun(FirePoint, account); break; case FireType.Flare: curArms = new Flare(FirePoint, account); break; default: break; } fireInterval = curArms.FireInterval; defaultFireInterval = curArms.FireInterval; }
public static void main(string[] args) { // Create our combatants: ElementalType cerberus = new FireType(); ElementalType hydra = new WaterType(); ElementalType heracles = new NormalType(); // persephone attacks poseidon: float multiplier = cerberus.Attack(hydra); Console.WriteLine("Persephone attacks Poseidon and deals " + multiplier + " x damage!"); // poseidon attacks back: multiplier = hydra.Attack(cerberus); Console.WriteLine("Poseidon attacks back and deals " + multiplier + " x damage!"); // Heracles attacks Poseidon: multiplier = heracles.Attack(hydra); Console.WriteLine("Heracles attacks Poseidon and deals " + multiplier + " x damage!"); // Persephone attacks Heracles: multiplier = cerberus.Attack(heracles); Console.WriteLine("Persephone attacks Heracles and deals " + multiplier + " x damage!"); Console.WriteLine("The battle has ended!"); }
public void AddFirePart(Vector2 pos, FireType type) { var part = new FirePart(firePart, type); part.Initialize(pos.X, pos.Y, Utils.Random); parts.Add(part); }
public void SetWeaponTooltip(string name, int cost, int maxAmmo, FireType type) { nameText.text = name; costText.text = $"${cost.ToString()}"; descriptionText.text = $"{type.ToString()} | Max Ammo:{maxAmmo}"; messageText.text = string.Empty; }
public GameObject( string name, ObjectType type, FireType fireType, float fireLimit, IShape fireArea, Texture2D tex, int width, int height, int zHeight, int minHp, int maxHp, ExtinguishingAgent agentSupply, IEnumerable <IShape> collisionMasks, int cost, bool solid ) { Name = name; Texture = tex; Width = width; Height = height; MinHP = minHp; MaxHP = maxHp; AgentSupply = agentSupply; Cost = cost; Type = type; ZHeight = zHeight; FireLimit = fireLimit; FireArea = fireArea; FireType = fireType; Solid = solid; CollisionMasks = Array.AsReadOnly(collisionMasks.ToArray()); TextureOrigin = new Vector2(Width / 2f, Height / 2f); }
private void b_PD_Fire_Click(object sender, EventArgs e) { stop = false; CustomScriptCommands.stopScript = false; FireType type = FireType.IP; //implement changing this later Fire(type); }
internal static void PlayFire(GameObject source, Single chargeLevel, FireType fireType) { UInt32 id = AkSoundEngine.PostEvent(fireType.GetSound(), source); _ = AkSoundEngine.SetRTPCValueByPlayingID(Sounds.Sniper_Charge_Amount.ID(), chargeLevel * 100f, id); _ = AkSoundEngine.SetRTPCValueByPlayingID(Sounds.Sniper_Volume_ALL.ID(), ConfigModule.sfxVolume, id); _ = AkSoundEngine.SetRTPCValueByPlayingID(Sounds.Sniper_Volume_SHOTS.ID(), ConfigModule.shotsVolume, id); }
public FireMode GetFireModeByType(FireType fireType) { switch (fireType) { default: return(new StandardFireMode()); } }
public GunStats(string gunFileName) { // Read in gun data from the provided file StreamReader fileReader = new StreamReader(Gun.gunDirectory + gunFileName); string buffer; char[] separator = { ' ' }; while (!fileReader.EndOfStream) { buffer = fileReader.ReadLine(); // Tokenize line string[] line = buffer.Split(separator); if (line[0].Equals("Max_Ammo")) { maxAmmo = int.Parse(line[1]); } else if (line[0].Equals("Accuracy")) { accuracy = float.Parse(line[1], CultureInfo.InvariantCulture); } else if (line[0].Equals("Fire_Type")) { if (line[1].Equals("SEMI_AUTO")) { fireType = FireType.SemiAuto; } else if (line[1].Equals("FULL_AUTO")) { fireType = FireType.FullAuto; } else { // Error in file. Semi-Auto default fireType = FireType.SemiAuto; } } else if (line[0].Equals("Bullet_Type")) { if (line[1].Equals("PENETRATIVE")) { bulletType = BulletType.Penetrative; } else if (line[1].Equals("NON_PENETRATIVE")) { bulletType = BulletType.NonPenetrative; } else { // Error in file. Non-penetrative default bulletType = BulletType.NonPenetrative; } } } }
void Start() { curArms = new Straight(FirePoint, account); fireType = FireType.Straight; if (IsLocalPlayer) { StartCoroutine(Attack()); } }
public Stats(WeaponList type, float damage, FireType fireType, float fireRate, float reloadTime, int ammo, int scrapCost) { this.type = type; this.damage = damage; this.fireType = fireType; this.fireRate = fireRate; this.reloadTime = reloadTime; this.ammo = ammo; this.scrapCost = scrapCost; }
public GunConfig(string name, FireType fireType, ushort magazineSize, float fireRate, float damage) { m_name = name; m_fireType = fireType; m_maxMagazineSize = magazineSize; m_ammonCount = m_maxMagazineSize; m_fireRate = 1f / fireRate; m_damage = damage; m_muzzlePosition = Vector3.zero; }
private void Start() { actualExtinguisherType = FireType.A; ParticleParent = FindObjectOfType <DynamicObjects>().transform; character = GetComponentInChildren <Character>(); if (UnlockedExtinguishers == 0) { ExtinguisherIcon.GetComponent <SpriteRenderer>().enabled = false; } }
/// <summary> /// Returns the appropriate animation for the specified part of an explosion fire /// </summary> public static Animation GetFireAnimation(FireType direction, double animationDuration) { // Get pre-generated sprites IReadOnlyList <SharpDX.Direct2D1.Bitmap> spriteSequence; if (!sprites.TryGetValue(direction, out spriteSequence)) { throw new Exception("Unknown Fire Type: " + direction); } return(new Animation(spriteSequence, animationDuration, false)); }
public Fire(float x, float y, FireType fireType) : base(x, y) { Fire_Img fim = new Fire_Img(fireType); imgs = fim.get_fire_imgs(); Drawed_img = imgs[0]; base.Height = Drawed_img.Height; base.Width = Drawed_img.Width; Fire_Radius = Drawed_img.Width / 2; img_indx = 0; this.fireType = fireType; }
public void ToggleFireMode() { int curType = (int)mFireType; curType++; if (curType >= (int)FireType.Count) { curType = (int)FireType.First; } mFireType = (FireType)curType; mFireButtonDown = false; }
private void PickUpArms(Arm arm) { if (arm.fireType == fireType) { return; } fireType = arm.fireType; CreateArm(arm.fireType); ArmsDto armsDto = new ArmsDto(account, (int)arm.fireType); SocketMessage socketMessage = new SocketMessage(OpCode.GAME, GameCode.GAME_SYNC_ATTACKTYPE_CERQ, armsDto); Dispatch(AreaCode.NET, 0, socketMessage); }
// Update is called once per frame private void Update() { if (_health.IsDead) { return; } if (_waiting) { return; } if (Input.GetButton("Fire1") && !_waiting && !_health.IsHurt) { Fire(); } var wheel = Input.mouseScrollDelta.y; if (!(Mathf.Abs(wheel) > 0) || _changing) { return; } _changing = true; if (wheel > 0) { if (ActiveFire > 0) { ActiveFire--; } else { ActiveFire = FireType.RandomFire; } } else { if (ActiveFire < FireType.RandomFire) { ActiveFire++; } else { ActiveFire = FireType.SingleFire; } } StartCoroutine(WeaponDelay()); changedWeapon?.Invoke(this, EventArgs.Empty); }
public static string FireTypeToName(FireType type) { switch (type) { default: return("Follow"); case FireType.kLink: return("Link"); case FireType.kStraight: return("Straight"); } }
// Start is called before the first frame update private void Start() { ActiveFire = FireType.SingleFire; _source = GetComponent <AudioSource>(); _health = GetComponent <PlayerHealth>(); _activeBullet = 0; for (var i = 0; i < bullets.Length; i++) { bullets[i] = Instantiate(bulletPrefab, new Vector2(0, 0), Quaternion.identity); bullets[i].transform.parent = null; bullets[i].GetComponent <PlayerBullet>().Initialize(); bullets[i].SetActive(false); } }
public static char fireTypeToChar(FireType type) { if (type == FireType.miss) { return(GameConstants.MISSCHAR); } else if (type == FireType.hit) { return(GameConstants.HITCHAR); } else { return(GameConstants.SUNKCHAR); } }
public WeaponInfo(WeaponData data) { this.power = data.power; this.ammoType = data.ammoType; this.ammo = data.maxAmmo; this.maxAmmo = data.maxAmmo; this.fireType = data.fireType; this.fireRate = data.fireRate; this.fireTimer = 0f; this.isCharging = false; this.maxChargeTime = data.maxChargeTime; this.chargeTimer = 0f; this.weaponType = data.weaponType; this.weaponPrefab = data.weaponPrefab; }
public Fire_Img(FireType fireType) { if (fireType == FireType.Cutter) { for (int i = 0; i < 4; i++) { int n = i + 1; imgs.Add(Image.FromFile(@"resourcesnew/weapons/cutter/cutter" + n + ".png")); } } else if (fireType == FireType.Single_Shot) { for (int i = 0; i < 3; i++) { int n = i + 1; imgs.Add(Image.FromFile(@"resourcesnew/weapons/single_shot/single_shot_" + n + ".png")); } } }
public void ChekDataMetod() { if (data != null) { GetComponent <SpriteRenderer> ().sprite = data.ImageOFGun; TypeWeapon = data.TypeWeapon; Damage = data.Damage; NormalDistance = data.NormalDistance; MaxLoad = data.MaxLoad; MaxDistance = data.MaxDistance; WeaponSound = data.WeaponSound; fireTypeThis = (FireType)data.fireTypeThis; BulletColor = data.BulletColor; GetComponent <AudioSource> ().clip = data.WeaponSound; Cost = WhatACost(); BulletPerShoot = data.BulletPerShoot; SecondPerShoot = data.secondPerShoot; } }
public BaseWeapon(string name, int id) { Lua lua = new Lua(); this.name = name; lua.DoFile("Scripts/Weapons/WeaponDictionary.lua"); maxAmmo = (int)(double)lua[name + ".maxAmmo"]; force = (float)(double)lua[name + ".force"]; hands = (string)lua[name + ".Hands"]; ammo = maxAmmo; maxClip = (int)(double)lua[name + ".clipSize"]; clip = maxClip; fireRate = (int)(double)lua[name + ".speed"]; textureId = (int)(double)lua[name + ".textureId"]; bulletId = (int)(double)lua[name + ".bulletId"]; bulletDampening = (float)(double)lua[name + ".dampening"]; fireType = FireType.Single; this.id = id; }
void Start() { bullet = weaponItemRef.bullet; refFireType = weaponItemRef.fireType; damage = weaponItemRef.damage; ammoMax = weaponItemRef.maxAmmo; ammoCurr = ammoMax; secBetweenFire = weaponItemRef.secBetweenFire; reloadTime = weaponItemRef.reloadTime; volleyCount = weaponItemRef.volleyCount; volleyDelay = weaponItemRef.volleyDelay; bulletSpread = weaponItemRef.bulletSpread; bloomInc = weaponItemRef.bloomIncrement; bloomDec = weaponItemRef.bloomDecrement; needsAnimationEvent = weaponItemRef.needsAnimationEvent; if (needsAnimationEvent) { animTriggers = GetComponentInChildren <AnimationTriggers>(); animTriggers.FireTrigger += AnimFireTrigger; animTriggers.FireReset += AnimFireReset; } if (sectionParent == null) { sectionParent = GetComponentInParent <Section>(); } if (mechManager == null) { mechManager = transform.root.GetComponent <MechManager>(); } bloomCurr = 0; //weaponGroup = (int)weaponItemRef.AmmoType; }
/// <summary> /// Toggle the firing selector of this gun /// </summary> /// <returns> /// The index of the selected fire selector /// </returns> public int ToggleFireSelector() { if (isHolstered || AddFiringTypes.Count == 1) { return(0); } selectorCount++; if (selectorCount > AddFiringTypes.Count - 1) { selectorCount = 0; } var selection = AddFiringTypes[selectorCount]; firingSelector = selection.firingSelector; rateOfFire = selection.rateOfFire; burstRate = selection.burstRate; return(selectorCount); }
public GameObject SpawnFire(FireType fireType, Transform fireParent, Vector3 position, Vector3 rotation, float scale, bool justForLooks) { GameObject firePrefab = null; for (int i = 0; i < FirePrefabs.Count; i++) { if (FirePrefabs [i].name.Equals(fireType.ToString(), StringComparison.OrdinalIgnoreCase)) { firePrefab = FirePrefabs [i]; break; } } GameObject instantiatedFire = GameObject.Instantiate(firePrefab) as GameObject; instantiatedFire.transform.parent = fireParent; instantiatedFire.transform.localPosition = position; instantiatedFire.transform.localRotation = Quaternion.Euler(rotation); return(instantiatedFire); }
public void UsePrimaryInventorySlot(FireType fireType) { if (m_CurrentTime >= m_TimeBetweenPrimaryShoots && !m_IsDead) { ItemType item = m_Inventory.GetPrimarySlot(); switch (item) { case ItemType.BasicFire: m_AudioSource.PlayOneShot(m_BasicShootAudio); if (fireType == FireType.DEFAULT) { Vector3 bulletPosition = new Vector3(transform.position.x + m_BulletOffsetX, transform.position.y, transform.position.z); m_BulletBehaviour.m_SinusoidalMovement = false; m_BulletBehaviour.m_Direction = m_OriginalBulletDirection; Fire(bulletPosition, m_BasicBullet, m_BasicBulletRotation); } else if (fireType == FireType.SINUSOIDAL) { Vector3 bulletPosition = new Vector3(transform.position.x + m_BulletOffsetX, transform.position.y, transform.position.z); m_BulletBehaviour.m_Direction = m_OriginalBulletDirection; m_BulletBehaviour.m_SinusoidalMovement = true; Fire(bulletPosition, m_BasicBullet, m_BasicBulletRotation); } else if (fireType == FireType.CIRCLE) { m_BulletBehaviour.m_SinusoidalMovement = false; FireInCircle(m_BasicBullet); } break; case ItemType.DoubleFire: m_AudioSource.PlayOneShot(m_DoubleShootAudio); Vector3 bulletPosition1 = new Vector3(transform.position.x + m_BulletOffsetX, transform.position.y + m_DoubleBulletOffsetY, transform.position.z); Vector3 bulletPosition2 = new Vector3(transform.position.x + m_BulletOffsetX, transform.position.y - m_DoubleBulletOffsetY, transform.position.z); Fire(bulletPosition1, m_DoubleBullet, Vector3.zero); Fire(bulletPosition2, m_DoubleBullet, Vector3.zero); break; } m_CurrentTime = 0.0f; } }
public FireResult fireAtPlayer(int target) { ShipPlacement potentialShip = new ShipPlacement(ShipType.battle, 0, new List <int[]>(), false); //Just random Values assign char postTargetSign = ownBoard.fireAtBoard(target, ref potentialShip); FireType result = FireType.miss; ShipType shipHit = ShipType.battle; if (postTargetSign == GameConstants.HITCHAR || postTargetSign == GameConstants.SUNKCHAR) // We got a hit { hitsLeft--; result = postTargetSign == GameConstants.HITCHAR ? FireType.hit : FireType.sunk; } // Main.GameMaster.singleton.debugPrint (playerInfo.username + " lives: " + hitsLeft); if (hitsLeft == 0) { death(); } return(new FireResult(result, ownBoard.generateEnigmaBoard(), potentialShip, target)); }
public bool Shoot() { if (!m_gun.Shoot()) { return(false); } FireType fireType = m_gun.Config.FireType; if (fireType == FireType.RayTrace) { RaycastHit hit; Debug.DrawRay(transform.TransformPoint(m_gun.Config.MuzzlePosition), transform.forward * 10.0f, Color.red, 5.0f); if (!Physics.Raycast(transform.TransformPoint(m_gun.Config.MuzzlePosition), transform.forward, out hit)) { return(true); } Debug.DrawLine(transform.TransformPoint(m_gun.Config.MuzzlePosition), hit.point, Color.yellow, 5.0f); Debug.LogWarning("Hit object " + hit.collider.gameObject); IDamage damageable = hit.transform.GetComponent <IDamage>(); if (damageable == null) { damageable = hit.transform.GetComponentInParent <IDamage>(); if (damageable == null) { return(true); } } damageable.Take(m_gun.Config.Damage); } else if (fireType == FireType.Projectile) { } return(true); }
public void TakeGun(GunData data) { gunData = data; firetype = gunData.firetype; ammo = gunData.maxammo; ammospend = gunData.ammospend; }