Exemplo n.º 1
0
    void CmdHitTarget(string hittedName, int damage, bool isHost)
    {
        CS_Player playerHitted = CS_GameManager.GetPlayer(hittedName);
        CS_Bot    botHitted    = CS_GameManager.GetBot(hittedName);

        if (playerHitted != null)
        {
            playerHitted.GetComponent <CS_Player>().RpcTakeDamage(damage, m_Player.GetUsername(), m_Player.m_Color);

            if (playerHitted.GetComponent <CS_Player>().GetHealthAmount() - damage <= 0)
            {
                m_Setup.m_Canvas.KillEffect();
            }
        }

        if (botHitted != null)
        {
            botHitted.GetComponent <CS_Bot>().RpcTakeDamage(transform.name, damage, isHost);

            if (botHitted.GetComponent <CS_Bot>().GetHealthAmount() - damage <= 0)
            {
                m_Setup.m_Canvas.KillEffect();
            }
        }
    }
Exemplo n.º 2
0
    void CallFireEffects(string hittedName)
    {
        CS_Player playerHitted = CS_GameManager.GetPlayer(hittedName);
        CS_Bot    botHitted    = CS_GameManager.GetBot(hittedName);

        currentWeapon.bulletSpawn.LookAt(hitPos);
        CmdOnFire(hitPos, hitNormal);     //Go to Server
        DdFireEffects(hitPos, hitNormal); // DIBRA DELAY
        m_Setup.m_OrbitCam.m_Animator.SetTrigger("Shake");

        if (!isServer && hittedName != "")
        {
            if (playerHitted.GetComponent <CS_Player>().GetHealthAmount() - currentWeapon.damage <= 0)
            {
                m_Setup.m_Canvas.KillEffect();
            }

            if (botHitted.GetComponent <CS_Bot>().GetHealthAmount() - currentWeapon.damage <= 0)
            {
                m_Setup.m_Canvas.KillEffect();
            }
        }
    }