コード例 #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();
            }
        }
    }
コード例 #2
0
    public static void RegisterBot(string _netID, CS_Bot _bot)
    {
        string _botID = BOT_ID_PREFIX + _netID;

        _bot.transform.name = _botID;

        bots.Add(_botID, _bot);
    }
コード例 #3
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();
            }
        }
    }