public Weapon(Dude own) { owner = own; triggerHeld = false; coolDown = 0; }
public Pistol(Dude owner) : base(owner) { clipAmmo = 30; isAuto = false; coolDownTarget = 200; sortOrder = 1; }
public Rifle(Dude owner) : base(owner) { clipAmmo = 50; isAuto = true; coolDownTarget = 75; sortOrder = 4; }
public Knife(Dude owner) : base(owner) { clipAmmo = 1; isAuto = true; coolDownTarget = 500; sortOrder = 0; }
public void copyFieldsTesting_SimpleClass() { Dude d = new Dude("Valera", 22, Dude.Sex.Male); Dude res = new Dude(); Copier.CopyUsingSerializer(d, res); Assert.AreEqual(d, res); }
public Shotgun(Dude owner) : base(owner) { clipAmmo = 8; isAuto = false; coolDownTarget = 1000; sortOrder = 2; }
bool Spawn() { if (Game.instance.state != Game.GameState.Play) { return(false); } bool anySpawn = false; int spawnCount = GetSpawnCount(); for (int i = 0; i < spawnCount; ++i) { GameObject target = null; Vector3? p = RandomizePosition(out target); if (null == p || null == target) { return(anySpawn); } if (m_Humans.Count >= MAX_ALIVE_HUMANS) { return(anySpawn); } GameObject h = new GameObject(); h.name = "Jean_" + Time.time; Dude dude = h.AddComponent <Dude>(); dude.target = target; dude.speed = Random.Range(0.2f, 0.8f) * m_SpeedMul; if (Random.Range(0, 100) < 10) { dude.lurching = true; } if (Random.Range(0, 100) < 5) { dude.speedVariant = true; } SpriteRenderer sr = h.AddComponent <SpriteRenderer>(); sr.sortingOrder = 15; sr.sprite = m_HumanSpr; h.transform.SetParent(transform); m_Humans.Add(h); h.transform.position = p.Value; dude.direction = Vector3.Normalize(target.transform.position - h.transform.position); GameObject sweat = Instantiate(Game.instance.humanSweat); sweat.transform.SetParent(h.transform, false); dude.sweatFX = sweat; sweat.SetActive(false); anySpawn = true; } return(anySpawn); }
void Awake() { while (_dudeType == BlockType.Random) { _dudeType = ((BlockType[])System.Enum.GetValues(typeof(BlockType))).Random(); } _dudePrefab = Resources.Load <Dude>("Dudes/" + _dudeType.ToString()); }
public override void Attack(Dude targetDude) { GameSession.Instance.ParticleController.AddGSW(targetDude.HitPosition, (new Vector2(5, 0) * Owner.PathDirection), Owner.IsShielded); targetDude.Hit(20); AudioController.PlaySFX("sword", (GameSession.Instance.Map.Zoom * 1.5f), ((float)GameSession.Instance.DudeController.Rand.NextDouble() / 3f) + 0.4f, ((2f / GameSession.Instance.Viewport.Width) * Owner._screenRelativePosition.X) - 1f); base.Attack(targetDude); }
private void LoadAndDeserialize() { var streamReader = new StreamReader(path + fileName + ".txt"); string data = streamReader.ReadToEnd(); streamReader.Close(); randomDude = JsonReader.Deserialize <Dude>(data); }
public void WeightCheck_Returns_Propper_Sentence(string name, int weight, string result) { var dude = new Dude { Name = name, Weight = weight }; var str = dude.WeightCheck(); Assert.Equal(str, name + result); }
private void OnTriggerExit(Collider other) { Dude dude = other.GetComponentInParent <Dude>(); if (dude != null) { dude.OnHouseCollisionStop(); } }
public void SpawnDudes(IEnumerable <ITile> tiles) { foreach (var tile in tiles) { Dude dude = Instantiate(dudePrefab, tile.transform); dude.faction = tile.faction; tile.dude = dude; } }
void Awake() { dude = gameObject.GetComponent <Dude>(); attackChain = GetComponent <DudeAttack>(); mount = weaponHand; //weaponHand.Find("weaponMount"); hotspot = transform.Find("weapon_hotspot"); swingNumber = 0; followUpQueued = false; }
public void ChangeDude(Dude dude) { if (activeDude) { activeDude.line.enabled = false; } activeDude = dude; activeDude.line.enabled = true; }
private void OnTriggerEnter(Collider other) { if (other.gameObject.tag == "Player") { Dude player = other.gameObject.GetComponent <Dude>(); player.weapon = gun; player.EquipWeapon(); } Destroy(gameObject, 1f); }
private static void BoolReferenceExample() { Dude d1 = new Dude("John"); Dude d2 = new Dude("John"); WriteLine(d1 == d2); //False Dude d3 = d1; WriteLine(d1 == d3); //True }
public void copyFieldsTesting_ReverseInheritation() { Parent d = new Parent("Vitaliy", 44, Dude.Sex.Female, 4);//subclass of Dude Dude res = new Dude("Valera", 22, Dude.Sex.Male); Copier.CopyUsingSerializer(d, res); bool match = d.name == res.name && d.age == res.age && d.sex == res.sex; Assert.IsTrue(match); }
public void Destroy() { // This will force to call SuiController.Leaving(); SetController(null); IsKinematic = false; Dude.SetBobyPartsKinematic(false); DudeAnimator.ClearClip(); m_root.gameObject.SetActive(false); }
void Awake() { character = GetComponent<CharacterController>(); dude = gameObject.GetComponent<Dude>(); swordzDude = gameObject.GetComponent<SwordzDude>(); damageable = gameObject.GetComponent<Damageable>(); detector = gameObject.GetComponentInChildren<Detector>(); //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController; attackers = new List<GameObject>(); }
void Start() { owner = GetComponent <Dude>(); ownerSwordz = GetComponent <SwordzDude>(); damageable = GetComponent <Damageable>(); if (hotspot == null) { hotspot = transform; } }
public SMG(Dude owner) : base(owner) { clipAmmo = 50; isAuto = true; coolDownTarget = 30; sortOrder = 3; sound = AudioController.effects["smg"].CreateInstance(); }
public RocketLeg(Dude body, LimbType limbType) : base(body, limbType) { velocity = new Vector2(0, 400); maxThrowTime = 10f; throwTime = 0f; chargePower = 0f; chargeSpeed = .4f; chargeMax = 1; }
public Pistol(Dude owner) : base(owner) { Range = 400f; StartingAmmo = 10; CurrentAmmo = 10; WeaponOffset = new Vector2(5, -20); _targetAttackTime = 500; _currentAttackTime = 500; }
public Shotgun(Dude owner) : base(owner) { Range = 150f; StartingAmmo = 8; CurrentAmmo = 8; WeaponOffset = new Vector2(5, -20); _targetAttackTime = 2000; _currentAttackTime = 2000; }
void Awake() { character = GetComponent <CharacterController>(); dude = gameObject.GetComponent <Dude>(); swordzDude = gameObject.GetComponent <SwordzDude>(); damageable = gameObject.GetComponent <Damageable>(); detector = gameObject.GetComponentInChildren <Detector>(); //controller = gameObject.GetComponent(typeof(DudeController)) as DudeController; attackers = new List <GameObject>(); }
public void ReferenceTypeEquality() { //arrange Dude d1 = new Dude("John"); Dude d2 = d1; //act bool IsEqual = d1 == d2; //assert Assert.IsTrue(IsEqual); }
public void ValueTypeEquality() { //arrange Dude d1 = new Dude("John"); Dude d2 = new Dude("John"); //act bool IsEqual = d1 == d2; //assert Assert.IsFalse(IsEqual); }
public static FactionType getFactionType(Dude dude) { switch(dude.tag) { case "ROMAN": return FactionType.ROMAN; case "VITRING": return FactionType.VIKING; case "ROBIN": return FactionType.ROBIN; } return FactionType.PLAYER; }
public Sword(Dude owner) : base(owner) { Range = 25f; StartingAmmo = -1; CurrentAmmo = -1; WeaponOffset = new Vector2(5, -20); _targetAttackTime = 1000; _currentAttackTime = 1000; _needsLOS = false; }
public void copyFieldsTesting_Null() { try { Dude d = null; Dude res = new Dude(); Copier.CopyUsingSerializer(d, res); Assert.Fail(); } catch { Assert.IsTrue(true); } }
public async Task <IActionResult> Put(int id, [FromBody] Dude dude) { if (id != dude.Id) { return(BadRequest()); } _dbContext.Entry(dude).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); return(NoContent()); }
public void PlugIn(Dude sourceDude) { Plug plug = GetRandomPlug(); Socket socket = sourceDude.GetRandomSocket(); if (plug == null || socket == null) { return; } plug.PlugIn(socket); }
private static Dude FindOrCreateDude(Dictionary <string, Dude> Dudes, string Name) { if (Dudes.ContainsKey(Name)) { return(Dudes[Name]); } else { var NewDude = new Dude(Name); Dudes[Name] = NewDude; return(NewDude); } }
public Sniper(Dude owner) : base(owner) { Range = 2000f; StartingAmmo = 20; CurrentAmmo = 20; WeaponOffset = new Vector2(5, -20); FeetPlanted = true; _targetAttackTime = 5000; _currentAttackTime = 5000; _isPlantingWeapon = true; }
public SMG(Dude owner) : base(owner) { Range = 400f; StartingAmmo = 50; CurrentAmmo = 50; WeaponOffset = new Vector2(5, -20); FeetPlanted = false; _targetAttackTime = 150; _currentAttackTime = 150; _isPlantingWeapon = false; }
public void copyFieldsTesting_BrakeReference() { try { Dude d = new Dude(); Dude res = new Dude(); Copier.CopyUsingSerializer(d, res); d.age = res.age + 1; Assert.AreNotEqual(d.age, res.age); } catch (Exception e) { Assert.Fail(e.Message); } }
// Update is called once per frame void Update() { Dude d = player.GetComponent <Dude>(); if (d != null) { rt.sizeDelta = new Vector2(((float)d.hitpoints / 100.0f) * 90.0f, rt.rect.height); } else { rt.sizeDelta = new Vector2(0, rt.rect.height); } }
// Use this for initialization void Start() { playerController = GetComponent<PlayerController>(); dude = playerController.GetComponent<Dude>(); greedTimerText = playerController.FindGreedTimerText (playerController.gameObject.name); boostTimerText = playerController.FindBoostTimerText (playerController.gameObject.name); wallDemoTimerText = playerController.FindWallDemoTimerText (playerController.gameObject.name); invisibilityCooldownTimerText = playerController.FindInvisibilityTimerText (playerController.gameObject.name); greedTimerText.gameObject.SetActive (false); boostTimerText.gameObject.SetActive (false); wallDemoTimerText.gameObject.SetActive (false); invisibilityCooldownTimerText.gameObject.SetActive (false); }
public Mortar(Dude owner) : base(owner) { Range = 1000f; StartingAmmo = 5; CurrentAmmo = 5; WeaponOffset = new Vector2(5, -30); FeetPlanted = true; _targetAttackTime = 3000; _targetAttackTime = 3000; _isPlantingWeapon = true; _needsLOS = false; }
private void OnTriggerEnter(Collider other) { Dude dude = other.GetComponentInParent <Dude>(); if (dude != null && dude.color == color && !isBuilt) { Destroy(other.transform.parent.gameObject); owner.score += dudeScore; } else if (dude != null) { dude.OnHouseCollision(); } }
public WhenTheGameHasAWinnerInATournamentWithTwoDudes() { _tournament = new Tournament(); _tournament.AddDude(_dudes[0]); _tournament.AddDude(_dudes[1]); _game = new Game(_dudes); _tournament.AddGame(_game); _wonDude = _game.Dudes()[0]; _tournament = new TournamentService().GameWon(_tournament, _game, _wonDude); }
public override void Attack(Dude targetDude) { Vector2 velocity = (targetDude.WeaponPosition - Owner.WeaponPosition); velocity.Normalize(); GameSession.Instance.ProjectileController.Add(Owner.WeaponPosition, velocity * 10f, 0.5f, false, false, 50, Owner.Team); CurrentAmmo--; AudioController.PlaySFX("pistol", 0.3f * (GameSession.Instance.Map.Zoom * 1.5f), ((float)GameSession.Instance.DudeController.Rand.NextDouble() / 2f) + 0.4f, ((2f / GameSession.Instance.Viewport.Width) * Owner._screenRelativePosition.X) - 1f); base.Attack(targetDude); }
public HammerArm(Dude body, LimbType limbType) : base(body, limbType) { velocity = new Vector2(0, 420); maxThrowTime = .75f; throwTime = 0f; sweetMin = .7f; sweetMax = .9f; sweetBonus = 2f; chargePower = 0f; chargeSpeed = 2f; chargeMax = 1; }
public bool Grab(Dude dude) { if (Grabbed) { return(false); } Grabbed = dude; foreach (var col in Grabbed.GetComponentsInChildren <Collider>()) { col.enabled = false; } return(true); }
public void Start() { dude = GetComponent(typeof(Dude)) as Dude; swordz = GetComponent(typeof(SwordzDude)) as SwordzDude; cam = Camera.main; if (aimMethod == "mouse") { Screen.showCursor = true; } // automatically set up move axes to match the camera SetMovementAxes(cam.transform.right * 0.5f, cam.transform.forward * 0.5f); }
public BombHead(Dude body, LimbType limbType) : base(body, limbType) { hasBeenUnpressed = false; velocity = new Vector2(0, 420); maxThrowTime = .75f; throwTime = 0f; sweetMin = .7f; sweetMax = .9f; sweetBonus = 2f; chargePower = 0f; chargeSpeed = 5f; chargeMax = 5f; }
public override void Attack(Dude targetDude) { //Vector2 velocity = (targetDude.WeaponPosition - Owner.WeaponPosition); //velocity.Y += ((float)(ProjectileController.Rand.NextDouble() * 10))-5f; Vector2 velocity = new Vector2(Owner.PathDirection, -3f); velocity.Normalize(); GameSession.Instance.ProjectileController.Add(Owner.WeaponPosition, (velocity * 8f) + new Vector2((float)ProjectileController.Rand.NextDouble()*(float)Owner.PathDirection,(float)ProjectileController.Rand.NextDouble()), 1f, true, true, 300, Owner.Team); CurrentAmmo--; AudioController.PlaySFX("mortar", 1f * (GameSession.Instance.Map.Zoom * 1.5f), 0f, ((2f / GameSession.Instance.Viewport.Width) * Owner._screenRelativePosition.X) - 1f); base.Attack(targetDude); }
public override void Attack(Dude targetDude) { for(int i=0;i<5;i++) { Vector2 velocity = ((targetDude.WeaponPosition - new Vector2(0, 10f)) - Owner.WeaponPosition); velocity += new Vector2(0, ((float)(ProjectileController.Rand.NextDouble() * 40))-20f); velocity.Normalize(); GameSession.Instance.ProjectileController.Add(Owner.WeaponPosition, velocity * 10f, 0.5f, false, false, 25, Owner.Team); } CurrentAmmo--; AudioController.PlaySFX("shotgun", 0.6f * (GameSession.Instance.Map.Zoom * 1.5f), ((float)GameSession.Instance.DudeController.Rand.NextDouble() / 2f) + 0.2f, ((2f / GameSession.Instance.Viewport.Width) * Owner._screenRelativePosition.X) - 1f); base.Attack(targetDude); }
public static void OnInfluence(Dude dude) { }
void Awake() { dude = gameObject.GetComponent<Dude>(); attackChain = GetComponent<DudeAttack>(); mount = weaponHand;//weaponHand.Find("weaponMount"); hotspot = transform.Find("weapon_hotspot"); swingNumber = 0; followUpQueued = false; }
// doesn't like dying public static void OnDeath(Dude dude) { if (!AILibs.factionLikesPlayer(FactionType.ROBIN)) { //GlobalManager.modifyOpinion (FactionType.ROBIN, -0.05f); } }
public static void OnInfluence(Dude dude) { GlobalManager.modifyOpinion(FactionType.VIKING, -0.1f); }
static void OnDefense(Dude dude) { }
public static void OnDeath(Dude dude) { }
void Awake() { health = maxHealth; dude = GetComponent<Dude>(); swordz = GetComponent<SwordzDude>(); }
void Think() { preyObject = GetClosestTarget(); // durr... nothing to kill! if(preyObject == null) { return; } prey = preyObject.GetComponent<Dude>(); preySwordz = preyObject.GetComponent<SwordzDude>(); var damageable = preyObject.GetComponent<Damageable>(); // don't kill dead things // WHAT IS DEAD MAY NEVER DIE if(damageable != null && damageable.GetHealth() <= 0) { return; } // for enemy pack avoidance if(avoider != null && avoider.avoidEnemy != null) { avoidVec = avoider.avoidEnemy.transform.position - transform.position; avoidVec = Vector3.Slerp(distVec.normalized, avoidVec.normalized, 0.5f); } else { avoidVec = Vector3.zero; } // for strafing, if I decide to strafe if(!engagePrey && strafeCooldown <= 0f) { strafeCooldown = strafeRate; strafeDir = 1.0f; if(Random.value > 0.5f) strafeDir = -1.0f; } }
// Use this for initialization void Start() { dude = GetComponentInParent<Dude>(); audioSource = GetComponent<AudioSource>(); lineRenderer = GetComponentInChildren<LineRenderer>(); lineRenderer.gameObject.SetActive(false); bulletRange = defaultBulletRange; }
// Use this for initialization void Start() { audioSource = GetComponent<AudioSource>(); dude = GetComponent<Dude>(); powerupsDisplay = dude.FindPowerupsDisplay(name); skillsDisplay = dude.FindSkillsDisplay(name); }
public static void OnInfluence(Dude dude) { GlobalManager.modifyOpinion(FactionType.ROBIN, 0.2f); }