12345678910111213141516171819202122232425262728293031323334353637383940 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using Sirenix.OdinInspector;
- namespace KairoEngine.Inventory
- {
- [CreateAssetMenu(fileName = "Holdable Item", menuName = "KairoEngine/Items/Holdable Item", order = 2)]
- public class ItemBaseHoldable : ItemBase
- {
- [TitleGroup("Holdable Item Properties")]
- public GameObject holdablePrefab;
- [TitleGroup("Holdable Item Properties")]
- public int animationMode = 1;
- [TitleGroup("Holdable Item Properties")]
- public Vector3 handPosition;
- [TitleGroup("Holdable Item Properties")]
- public Vector3 handRotation;
- [TitleGroup("Holdable Item Properties")]
- public Vector3 handScale;
- public void Setup(GameObject obj, float scaleMultiplier)
- {
- obj.transform.localPosition = handPosition * scaleMultiplier;
- obj.transform.localRotation = Quaternion.Euler(handRotation.x, handRotation.y, handRotation.z);
- obj.transform.localScale = handScale * scaleMultiplier;
- Rigidbody rigidBody = obj.GetComponent<Rigidbody>();
- if (rigidBody != null)
- GameObject.Destroy(rigidBody);
- BoxCollider boxCollider = obj.GetComponent<BoxCollider>();
- if (boxCollider != null)
- GameObject.Destroy(boxCollider);
- }
- }
- }
|