Exemplo n.º 1
0
    public int OnBulletHit(BulletHitInfo info)
    {
        //Debug.Log(string.Format("{0} Damage", gameObject.name));;

        var damageInt = Mathf.FloorToInt(info.Damage);

        health -= damageInt;

        if (health < maxHealth)
        {
            health = Mathf.Clamp(health, 0, maxHealth);
        }
        innerHealth = health;

        worldGUI.SendMessage(
            "DrawText",
            new WorldGUITextInfo()
        {
            text     = damageInt.ToString(),
            position = info.HitPosition,
        });

        gameObject.SendMessage(
            "OnDamage",
            SendMessageOptions.DontRequireReceiver);

        return(damageInt);
    }
Exemplo n.º 2
0
    private void OnTargetHit(BulletHitInfo hitInfo)
    {
        var hitHole = (Spatial)HitHoleScene.Instance();

        AddChild(hitHole);
        hitHole.Translation = hitInfo.WorldCoords;

        BulletHitsTarget?.Invoke(hitInfo);
    }
Exemplo n.º 3
0
    private void OnBulletHitTarget(BulletHitInfo hitInfo)
    {
        var buildingHit = hitInfo.Building?.BuildingType;

        System.Diagnostics.Debug.WriteLine($"Hitting {hitInfo.Building?.BuildingType.ToString() ?? "Nothing"} at {hitInfo.WorldCoords}");
    }
Exemplo n.º 4
0
    public int OnBulletHit(BulletHitInfo info)
    {
        //Debug.Log(string.Format("{0} Damage", gameObject.name));;

        var damageInt = Mathf.FloorToInt(info.Damage);

        health -= damageInt;

        if(health < maxHealth)
        {
            health = Mathf.Clamp(health, 0, maxHealth);
        }
        innerHealth = health;

        worldGUI.SendMessage(
            "DrawText",
            new WorldGUITextInfo()
            {
                text = damageInt.ToString(),
                position = info.HitPosition,
            });

        gameObject.SendMessage(
            "OnDamage",
            SendMessageOptions.DontRequireReceiver);

        return damageInt;
    }