Пример #1
0
    public void SpawnDamageNumber(Entity ent, int amount)
    {
        ///convert hex position to canvas position
        Vector3       worldpoint  = grid.GetWorldPosition(ent.Position);
        RectTransform canvas      = uiCanvas.GetComponent <RectTransform>();
        Vector2       viewportpos = Camera.main.WorldToViewportPoint(worldpoint); //TODO: cache this
        Vector2       position    = viewportpos.IntoRect(canvas);

        DamageNumber num = Instantiate(damageNumberPrefab, canvas);

        num.Show(position, amount, Color.red);
    }
Пример #2
0
    private void EnemyTakeDamage(EnemyTakeDamageArgs args)
    {
        string str = "";

        str = args.amount.ToString();
        if (args.ResultedInDeath)
        {
            str += "\nKilling Blow!";
        }

        Debug.Log(str + " : " + args.ResultedInDeath);
        DamageNum.Show(str, args.ResultedInDeath);
    }
Пример #3
0
    private void PlayerTakeDamage(PlayerTakeDamageArgs args)
    {
        string str = args.amount.ToString();

        PlayerDamageNum.Show(str, false);
    }