Пример #1
0
    // Use this for initialization
    void Start()
    {
        string[] spellArray = { "Teleport", "MP_Fireball", "Network_Ball", "MP_Shield" };

        // Only the local player gets the GVRViewer camera
        if (isLocalPlayer)
        {
            SetupCamera();

            SetupPlayerModel();
        }
        else
        {
            //this.tag = "nonLocalPlayer";
        }
        this.tag = "Player";


        // hook up the GvrController to this player when it is created
        // Note: this must be called before the wand and player can be instantiated
        SetupController();
        SetupWand();
        SetupShield();

        //begin player setup
        playerWand = new MP_Wand(pointer, reticle, 1, 1, spellArray);
        player     = new MP_Player(gameObject, playerWand, teleportDistance);

        InvokeRepeating("CmdManaRegen", 0, MANA_REGEN_TIME);
    }
Пример #2
0
 public void SetGazedAt(bool gazedAt)
 {
     if (GameObject.FindWithTag("Player") != null)
     {
         GameObject localPlayer = GameObject.FindGameObjectWithTag("Player");
         if (localPlayer.GetComponent <MP_PlayerController>() != null)
         {
             MP_PlayerController controller = localPlayer.GetComponent <MP_PlayerController>();
             if (controller.player != null)
             {
                 MP_Player mainPlayer = controller.player;
                 if (mainPlayer.getSpellIndex() == 0 ||
                     (gazedAt == false &&
                      localPlayer.GetComponent <MP_PlayerController>().player.getSpellIndex() != 0))
                 {
                     if (inactiveMaterial != null && gazedAtMaterial != null)
                     {
                         GetComponent <Renderer>().material = gazedAt ? gazedAtMaterial : inactiveMaterial;
                         return;
                     }
                     GetComponent <Renderer>().material.color = gazedAt ? Color.green : Color.red;
                 }
             }
         }
     }
 }
Пример #3
0
 void CmdPlayerSetHealth(MP_Player player)
 {
     player.setHealth(false, power);
 }