CmdPlayerShot() private method

private CmdPlayerShot ( string _playerID, int _damage, string _sourceID ) : void
_playerID string
_damage int
_sourceID string
return void
Exemplo n.º 1
0
    void FixedUpdate()
    {
        RaycastHit hit;

        if (Physics.Raycast(transform.position, transform.forward, out hit, castDistance, mask))
        {
            if (hit.collider.CompareTag("Crow"))
            {
                return;
            }
            Vector3 reflectionAngle = Vector3.Reflect(transform.forward, hit.normal);
            if (hit.collider.tag == "Player")
            {
                if (hit.collider.name != player.name)
                {
                    playerShoot.CmdPlayerShot(hit.collider.name, damage);
                    Instantiate(ResourceManager.instance.missilePlayerImpactPrefab, hit.point, Quaternion.FromToRotation(Vector3.forward, reflectionAngle));
                }
            }
            else
            {
                Instantiate(ResourceManager.instance.missileImpactPrefab, hit.point, Quaternion.FromToRotation(Vector3.forward, reflectionAngle));
            }
            Destroy(this.gameObject);
        }
    }
Exemplo n.º 2
0
    void PerformAutoMovement()
    {
        float step = 4 * Time.deltaTime;


        if (Vector3.Distance(rb.position, dest) < 0.1f)
        {
            if (Vector3.Distance(dest, dest2) != 0)
            {
                dest = dest2;
                shoot.spawnBallsAuto = false;
            }
            else
            {
                dest = new Vector3(0f, 0.5f, -30f);
                if (autoSpawn)
                {
                    shoot.spawnBallsAuto = true;
                }
                if (GetComponent <NetworkIdentity>().netId.ToString() != "2")
                {
                    shoot.CmdPlayerShot("Player 2", 10);
                }
            }
        }

        rb.position = Vector3.MoveTowards(rb.position, dest, step);
        cam.transform.LookAt(dest);
    }
Exemplo n.º 3
0
    void DamagePlayers()
    {
        if (playersToDot == null)
        {
            return;
        }
        float         damageToDeal = dps * Time.deltaTime;
        List <Player> newList      = new List <Player>();

        foreach (Player p in playersToDot)
        {
            playerShoot.CmdPlayerShot(p.name, damageToDeal);
            if (!p.isDead)
            {
                newList.Add(p);
            }
        }
        playersToDot = newList;
    }