You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
41 lines
1.2 KiB
C#
41 lines
1.2 KiB
C#
6 months ago
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
|
||
|
namespace Autohand.Demo {
|
||
|
public class HandSwapper : MonoBehaviour{
|
||
|
public AutoHandPlayer player;
|
||
|
public Hand fromHand;
|
||
|
public Hand toHand;
|
||
|
public GameObject fromModel;
|
||
|
public GameObject toModel;
|
||
|
|
||
|
bool swapped;
|
||
|
public void Swap() {
|
||
|
if(!swapped){
|
||
|
if (toHand.left)
|
||
|
player.handLeft = toHand;
|
||
|
else
|
||
|
player.handRight = toHand;
|
||
|
|
||
|
fromHand.gameObject.SetActive(false);
|
||
|
fromModel.gameObject.SetActive(true);
|
||
|
toHand.gameObject.SetActive(true);
|
||
|
toModel.gameObject.SetActive(false);
|
||
|
}
|
||
|
else {
|
||
|
if (fromHand.left)
|
||
|
player.handLeft = fromHand;
|
||
|
else
|
||
|
player.handRight = fromHand;
|
||
|
|
||
|
fromHand.gameObject.SetActive(true);
|
||
|
fromModel.gameObject.SetActive(false);
|
||
|
toHand.gameObject.SetActive(false);
|
||
|
toModel.gameObject.SetActive(true);
|
||
|
|
||
|
}
|
||
|
swapped = !swapped;
|
||
|
}
|
||
|
}
|
||
|
}
|