Inheritance: MonoBehaviour
Example #1
0
        public Weapon(Dude own)
        {
            owner = own;

            triggerHeld = false;
            coolDown = 0;
        }
Example #2
0
 public Pistol(Dude owner)
     : base(owner)
 {
     clipAmmo = 30;
     isAuto = false;
     coolDownTarget = 200;
     sortOrder = 1;
 }
Example #3
0
 public Rifle(Dude owner)
     : base(owner)
 {
     clipAmmo = 50;
     isAuto = true;
     coolDownTarget = 75;
     sortOrder = 4;
 }
Example #4
0
 public Knife(Dude owner)
     : base(owner)
 {
     clipAmmo = 1;
     isAuto = true;
     coolDownTarget = 500;
     sortOrder = 0;
 }
Example #5
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);
        }
Example #6
0
 public Shotgun(Dude owner)
     : base(owner)
 {
     clipAmmo = 8;
     isAuto = false;
     coolDownTarget = 1000;
     sortOrder = 2;
 }
Example #7
0
    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);
    }
Example #8
0
    void Awake()
    {
        while (_dudeType == BlockType.Random)
        {
            _dudeType = ((BlockType[])System.Enum.GetValues(typeof(BlockType))).Random();
        }

        _dudePrefab = Resources.Load <Dude>("Dudes/" + _dudeType.ToString());
    }
Example #9
0
        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);
        }
Example #10
0
    private void LoadAndDeserialize()
    {
        var    streamReader = new StreamReader(path + fileName + ".txt");
        string data         = streamReader.ReadToEnd();

        streamReader.Close();

        randomDude = JsonReader.Deserialize <Dude>(data);
    }
Example #11
0
        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);
        }
Example #12
0
    private void OnTriggerExit(Collider other)
    {
        Dude dude = other.GetComponentInParent <Dude>();

        if (dude != null)
        {
            dude.OnHouseCollisionStop();
        }
    }
Example #13
0
 public void SpawnDudes(IEnumerable <ITile> tiles)
 {
     foreach (var tile in tiles)
     {
         Dude dude = Instantiate(dudePrefab, tile.transform);
         dude.faction = tile.faction;
         tile.dude    = dude;
     }
 }
Example #14
0
    void Awake()
    {
        dude        = gameObject.GetComponent <Dude>();
        attackChain = GetComponent <DudeAttack>();
        mount       = weaponHand;  //weaponHand.Find("weaponMount");
        hotspot     = transform.Find("weapon_hotspot");

        swingNumber    = 0;
        followUpQueued = false;
    }
Example #15
0
    public void ChangeDude(Dude dude)
    {
        if (activeDude)
        {
            activeDude.line.enabled = false;
        }

        activeDude = dude;
        activeDude.line.enabled = true;
    }
Example #16
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player")
     {
         Dude player = other.gameObject.GetComponent <Dude>();
         player.weapon = gun;
         player.EquipWeapon();
     }
     Destroy(gameObject, 1f);
 }
Example #17
0
        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
        }
Example #18
0
        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);
        }
Example #19
0
    public void Destroy()
    {
        // This will force to call SuiController.Leaving();
        SetController(null);

        IsKinematic = false;
        Dude.SetBobyPartsKinematic(false);
        DudeAnimator.ClearClip();

        m_root.gameObject.SetActive(false);
    }
Example #20
0
    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>();
    }
Example #21
0
    void Start()
    {
        owner       = GetComponent <Dude>();
        ownerSwordz = GetComponent <SwordzDude>();
        damageable  = GetComponent <Damageable>();

        if (hotspot == null)
        {
            hotspot = transform;
        }
    }
Example #22
0
        public SMG(Dude owner)
            : base(owner)
        {
            clipAmmo = 50;
            isAuto = true;
            coolDownTarget = 30;

            sortOrder = 3;

            sound = AudioController.effects["smg"].CreateInstance();
        }
Example #23
0
        public RocketLeg(Dude body, LimbType limbType)
            : base(body, limbType)
        {
            velocity = new Vector2(0, 400);

            maxThrowTime = 10f;
            throwTime    = 0f;
            chargePower  = 0f;
            chargeSpeed  = .4f;
            chargeMax    = 1;
        }
Example #24
0
        public Pistol(Dude owner)
            : base(owner)
        {
            Range = 400f;
            StartingAmmo = 10;
            CurrentAmmo = 10;
            WeaponOffset = new Vector2(5, -20);

            _targetAttackTime = 500;
            _currentAttackTime = 500;
        }
Example #25
0
        public Shotgun(Dude owner)
            : base(owner)
        {
            Range = 150f;
            StartingAmmo = 8;
            CurrentAmmo = 8;
            WeaponOffset = new Vector2(5, -20);

            _targetAttackTime = 2000;
            _currentAttackTime = 2000;
        }
Example #26
0
    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);
        }
Example #29
0
 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;
 }
Example #30
0
        public Sword(Dude owner)
            : base(owner)
        {
            Range = 25f;
            StartingAmmo = -1;
            CurrentAmmo = -1;
            WeaponOffset = new Vector2(5, -20);

            _targetAttackTime = 1000;
            _currentAttackTime = 1000;
            _needsLOS = false;
        }
Example #31
0
 public void copyFieldsTesting_Null()
 {
     try
     {
         Dude d   = null;
         Dude res = new Dude();
         Copier.CopyUsingSerializer(d, res);
         Assert.Fail();
     }
     catch
     { Assert.IsTrue(true); }
 }
Example #32
0
        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());
        }
Example #33
0
    public void PlugIn(Dude sourceDude)
    {
        Plug   plug   = GetRandomPlug();
        Socket socket = sourceDude.GetRandomSocket();

        if (plug == null || socket == null)
        {
            return;
        }

        plug.PlugIn(socket);
    }
Example #34
0
 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);
     }
 }
Example #35
0
        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;
        }
Example #36
0
        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;
        }
Example #37
0
 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); }
 }
Example #38
0
    // 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);
        }
    }
Example #39
0
 // 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);
 }
Example #40
0
        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;
        }
Example #41
0
    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();
        }
    }
Example #42
0
        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);
        }
Example #43
0
        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);
        }
Example #44
0
        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;
        }
Example #45
0
    public bool Grab(Dude dude)
    {
        if (Grabbed)
        {
            return(false);
        }

        Grabbed = dude;
        foreach (var col in Grabbed.GetComponentsInChildren <Collider>())
        {
            col.enabled = false;
        }
        return(true);
    }
Example #46
0
    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);
    }
Example #47
0
        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;
        }
Example #48
0
        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);
        }
Example #49
0
        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);
        }
Example #50
0
 public static void OnInfluence(Dude dude)
 {
 }
Example #51
0
    void Awake()
    {
        dude = gameObject.GetComponent<Dude>();
        attackChain = GetComponent<DudeAttack>();
        mount = weaponHand;//weaponHand.Find("weaponMount");
        hotspot = transform.Find("weapon_hotspot");

        swingNumber = 0;
        followUpQueued = false;
    }
Example #52
0
 // 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);
 }
Example #54
0
 static void OnDefense(Dude dude)
 {
 }
 public static void OnDeath(Dude dude)
 {
 }
Example #56
0
 void Awake()
 {
     health = maxHealth;
     dude = GetComponent<Dude>();
     swordz = GetComponent<SwordzDude>();
 }
Example #57
0
    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;
        }
    }
Example #58
0
    // 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);
 }
Example #60
0
 public static void OnInfluence(Dude dude)
 {
     GlobalManager.modifyOpinion(FactionType.ROBIN, 0.2f);
 }