void CmdOnHitPlayer(Vector2 _pos, string _id)
    {
        Player player = GameManger.GetPlayer(_id);

        player.GetComponent <Rigidbody2D>().AddForceAtPosition(weapon.targetImpact * target / 10, transform.position);
        RpcDoHitEffect(_pos);
    }
Esempio n. 2
0
    void CmdPlayerShot(string player_ID, int Damage)
    {
        Debug.Log(player_ID + " has been shot.");
        PlayerManager _player = GameManger.GetPlayer(player_ID);


        _player.RpcTakeDamage(Damage);
        //GameObject.Destroy (GameObject.Find(player_ID));
    }
Esempio n. 3
0
    private void Die(string dealer_id)
    {
        //Calculate scores
        deaths++;
        Player dealer = GameManger.GetPlayer(dealer_id);

        if (dealer != null)
        {
            dealer.kills++;
            dealer.score += GameManger.instance.matchSettings.killScore;
            GameManger.instance.onPlayerKilledCallback.Invoke(playerName, dealer.playerName);
        }

        isDead = true;

        for (int i = 0; i < disableOnDeath.Length; i++)
        {
            disableOnDeath[i].enabled = false;
        }

        Collider2D _col = GetComponent <Collider2D>();

        if (_col != null)
        {
            _col.enabled = false;
        }

        SpriteRenderer _sprite = GetComponent <SpriteRenderer>();

        if (_sprite != null)
        {
            _sprite.enabled = false;
        }

        SpriteRenderer _sprite2 = turret.gameObject.GetComponent <SpriteRenderer>();

        if (_sprite2 != null)
        {
            _sprite2.enabled = false;
        }

        canvas.GetComponent <Canvas>().enabled = false;

        GameObject _graphicsInstance = (GameObject)Instantiate(deahtEffect, transform.position, Quaternion.identity);

        Destroy(_graphicsInstance, 3f);

        Debug.Log(transform.name + " is DEAD!");

        StartCoroutine(Respawn());
        GetComponent <Shooting>().CmdStopShooting();
    }
Esempio n. 4
0
    void CmdOnHitPlayer(Vector2 _pos, string _id)
    {
        Player player = GameManger.GetPlayer(_id);

        RpcDoHitEffect(_pos);
    }