Exemple #1
0
    private void Hurt(Enemy enemy)
    {
        DevMonsterInfo monsterInfo = Content.Instance.GetMonsterByName(enemy.Info.Name);

        if (!Invincible && monsterInfo.DMG != 0)
        {
            // EndAttack();

            SocketClient.Instance.SendTookDMG(enemy.Info);

            Instance.Hurt();

            Instance.PlayEyesEmote("angry");
            Instance.PlayMouthEmote("sad");

            StartCoroutine(DisableSpeedUntilGrounded());

            DevPerkMap knockbackPerk = monsterInfo.GetPerk("knockbackModifier");
            float      Modifier      = (knockbackPerk != null) ? knockbackPerk.Value : 1f;

            if (enemy.transform.position.x < transform.position.x)
            {
                Rigid.AddForce(2.5f * Modifier * transform.right, ForceMode2D.Impulse);
            }
            else
            {
                Rigid.AddForce(2.5f * Modifier * -transform.right, ForceMode2D.Impulse);
            }
        }
    }
Exemple #2
0
    public List <DevPerkMap> Get(JSONNode item)
    {
        List <DevPerkMap> perkMapList = new List <DevPerkMap>();

        IEnumerator enumerator = item["perks"].AsObject.GetEnumerator();

        while (enumerator.MoveNext())
        {
            DevPerkMap perkMap = new DevPerkMap();
            perkMap.Key   = ((KeyValuePair <string, JSONNode>)enumerator.Current).Key;
            perkMap.Value = item["perks"][perkMap.Key].AsFloat;
            perkMapList.Add(perkMap);
        }
        perkMapList.Sort(SortByPerkKey);

        return(perkMapList);
    }
Exemple #3
0
 public int SortByPerkKey(DevPerkMap perkMap1, DevPerkMap perkMap2)
 {
     return(perkMap1.Key.CompareTo(perkMap2.Key));
 }