Пример #1
0
    void OnTriggerExit(Collider other)
    {
        Vector3 pos = other.transform.position;

        pos.y = transform.position.y;
        float distance = Vector3.Distance(pos, transform.position);

        FPSPlayer player = other.GetComponent <FPSPlayer> ();

        if (distance >= blastRange)
        {
            if (player != null)
            {
                playerInRange = null;
                inRangeHumanoids.Remove(player);
                return;
            }
            HitBox hitbox = other.GetComponent <HitBox> ();
            if (hitbox != null)
            {
                Zombie zombie = hitbox.Enemy;
                inRangeHumanoids.Remove(zombie);
            }
        }
        else if (player != null)
        {
            playerInRange = null;
        }
    }
Пример #2
0
    void OnTriggerEnter(Collider col)
    {
        FPSPlayer player = col.GetComponent <FPSPlayer>();

        if (player)
        {
            player.ApplyDamage(player.maximumHitPoints + 1);
        }
        else if (col.rigidbody)
        {
            Destroy(col.rigidbody.gameObject);
        }
        else
        {
            Destroy(col.gameObject);
        }
    }
Пример #3
0
    void AddPlayer(bool isLocal, NetworkViewID anID, Color cA, Color cB, Color cC, int head, string name, NetworkPlayer np, int targetTeam, int lives)
    {
        FPSPlayer newPlayer = new FPSPlayer();

        newPlayer.colA = cA;
        newPlayer.colB = cB;
        newPlayer.colC = cC;

        newPlayer.headType = head;

        newPlayer.viewID = anID;

        newPlayer.local = isLocal;

        newPlayer.name = name;

        newPlayer.netPlayer = np;

        newPlayer.ping = new Ping(newPlayer.netPlayer.ipAddress);

        newPlayer.team = targetTeam;

        newPlayer.kills = 0;
        newPlayer.deaths = 0;
        newPlayer.currentScore = 0;

        newPlayer.lives = lives;

        players.Add(newPlayer);
    }