Esempio n. 1
0
    public void Incarnate(AllyController ally)
    {
        Debug.Log("Incarnated");
        UnitSelector.instance.BlockSelection = true;


        Hand hand = player.GetHand(handType);

        if (hand == null)
        {
            hand = player.GetHand(SteamVR_Input_Sources.Any);
        }
        this.hand      = hand;
        objectInstance = Instantiate(ally.configuration.leftObject);
        objectInstance.transform.position = hand.transform.position;

        objectInstance.AttachToHand(hand);

        transform.position = ally.transform.position;
        var camera = GetComponentInChildren <Camera>();
        //camera.transform.forward = ally.transform.forward;
        var     forwardRotation = ally.transform.rotation * Quaternion.Inverse(camera.transform.rotation);
        Vector3 newRotattion    = new Vector3(0f, forwardRotation.eulerAngles.y, 0f);

        transform.rotation = Quaternion.Euler(newRotattion);
        belt.ConfigureBelt(ally.configuration);
        belt.gameObject.SetActive(true);
        ally.gameObject.SetActive(false);

        CharacterStats cs = ally.GetComponent <CharacterStats>();

        incarnatedAlly = cs;
        currentHealth  = cs.CurrentHealth;
        isIncarnated   = true;
    }
Esempio n. 2
0
    private void TryRetrieve(Hand hand)
    {
        if (!socket.GetStoredObject)
        {
            return;
        }
        GrabbableObject ob = socket.GetStoredObject;

        socket.DetAttach();
        ob.AttachToHand(hand);
    }
Esempio n. 3
0
 public void SpawnObject(Hand hand)
 {
     if (item != null)
     {
         GrabbableObject gb = Instantiate(item, hand.transform.position, Quaternion.identity);
         if (attachToHand)
         {
             gb.AttachToHand(hand);
         }
     }
 }
Esempio n. 4
0
    private void SpawnItem(Hand h)
    {
        GrabbableObject ob = Instantiate(item, h.transform.position, h.transform.rotation);

        ob.AttachToHand(h);
    }