Esempio n. 1
0
 void TryEnterVessel(NetworkViewID playerViewID)
 {
     if (!rider && !playerViewID.GetGameObject().GetComponent<VesselController>())
     {
         networkView.RPC("CommitEnterVessel", RPCMode.All, playerViewID);
     }
 }
Esempio n. 2
0
    void TryPickupItem(NetworkViewID playerViewID)
    {
        GameObject interactor = playerViewID.GetGameObject();
        if (interactor.GetInventory().IsFull) return;
        if (item == null)
        {
            Debug.Log("This item doesn't have a viewID yet. Assigning one.");
            item = ItemFactory.CreateItemForPlayer(this.itemName);

        }

        interactor.networkView.RPC("CommitAddToInventory", RPCMode.All, item.viewID, itemName);
        Network.Destroy(this.gameObject);
    }
Esempio n. 3
0
    void CommitEnterVessel(NetworkViewID enteringPlayer)
    {
        Debug.Log("Commit vessel entry");
        GameObject entered = enteringPlayer.GetGameObject();
        entered.transform.position = this.transform.position;
        this.transform.SetParentAndCenter(entered.transform);
        this.transform.position += Vector3.up * 1.5f;
        this.rider = entered;

        if (entered.IsMyLocalPlayer() || Network.isServer)
        {
            entered.GetComponent<ThirdPersonController>().enabled = false;
            entered.AddComponent<VesselController>().vessel = this;
        }
    }
    protected virtual void NotifyDeath(Vector3 deathPosition, NetworkViewID killer, int experience, int gold)
    {
        var e = new UnitDiedEventArgs() { reward = new KillReward(experience, gold), killer = killer.GetGameObject(), deathPosition = deathPosition };
        if (Died != null)
        {
            Died(gameObject, e);
        }

        killer.GetGameObject().GetCharacterStats().OnKilledUnit(new UnitKilledEventArgs() { deadUnit = this.gameObject, deathPosition = deathPosition });
    }
Esempio n. 5
0
    void CommitPickupRelic(NetworkViewID viewID)
    {
        isPickedUp = true;
        this.collider.enabled = false;
        var player = viewID.GetGameObject();
        SetControllingTeam(player.GetTeamNumber());
        AddHolderBuffs(player);

        this.transform.SetParentAndCenter(player.transform);
        this.transform.localPosition += Vector3.up * 3.5f;
        rigidbody.isKinematic = true;

        if (Network.isServer)
        {
            player.GetCharacterStats().Died += RelicHolder_Died;
        }
    }
Esempio n. 6
0
 void TryPickupRelic(NetworkViewID viewID)
 {
     if (!isPickedUp)
         networkView.RPC("CommitPickupRelic", RPCMode.All, viewID);
     else
         Debug.LogWarning(viewID.GetGameObject() + " tried to pick up a relic that was already picked up!");
 }
Esempio n. 7
0
    void TryExitVessel(NetworkViewID viewID)
    {
        var player = viewID.GetGameObject();

        vessel.networkView.RPC("CommitExitVessel", RPCMode.All, viewID);
        if (gameObject.IsMyLocalPlayer())
        {
            ExitVessel();
        }
        else
        {
            if (Network.isServer)
                ExitVessel();
            networkView.RPC("ExitVessel", PlayerManager.Main.FindRecord(player).networkPlayer);
        }
    }