ºÇ½ª¹¹¿·¡§
orika_ex_miyako 2020ǯ08·î05Æü(¿å) 01:28:20ÍúÎò
CubeController¤È¤¤¤¦Ì¾¾Î¤Ë¤Ï¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢Â¾¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤¹¤ì¤Ð¤½¤Á¤é¤Ç¤âÍøÍѤǤ¤Þ¤¹¡£
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// ¥ª¥Ö¥¸¥§¥¯¥È¤ÎÁàºî¤ò¹Ô¤¦¥¯¥é¥¹
/// ¸½ºß¤ÏCube¤Ë¥¢¥¿¥Ã¥Á¤¹¤ë¤è¤¦¤Ë¤·¤Æ¤¤¤ë
/// </summary>
public class CubeController : MonoBehaviour
{
private Test test; // ¥¯¥é¥¹¼èÆÀÍÑ
[Header("²óž³ÑÅÙ¤ÎÀßÄêÃÍ")]
public float eulerAngle;
private int axis; // ²óž¤µ¤»¤ë¼´¤ÎÀßÄêÃÍ
void Start()
{
// Test¥¯¥é¥¹¤ò¼èÆÀ¤·testÊÑ¿ô¤ËÂåÆþ = ¥¢¥¯¥»¥¹¤Ç¤¤ë¾õÂ֤ˤ¹¤ë
// ¼èÆÀ¤¹¤ëTest¥¯¥é¥¹¤¬Æ±¤¸¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¾ì¹ç
// ¾Êά¤·¤Ê¤¤½ñ¤Êý
test = this.gameObject.GetComponent<RotateTest>();
// ¾Êά¤·¤¿½ñ¤Êý¡Ê´ðËÜ·Á¡Ë
//test = GetComponent<RotateTest>();
}
void Update()
{
// ¥Ü¥¿¥ó¤ò²¡¤¹Å٤˲óž¼´¤ò x => y => z => x ¤ÈÊѹ¹¤¹¤ë
if (Input.GetKeyDown(KeyCode.Z)) {
axis++;
// z¤Ë¤Ê¤Ã¤¿¤éx¤ËÌ᤹
if(axis >= 3) {
axis = 0;
}
Debug.Log(axis);
}
if (Input.GetKeyDown(KeyCode.X)) {
// cube¤ò²óž¤µ¤»¤ë¤¿¤á¡¢Test¥¯¥é¥¹¤ÎRotateCube¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹
// Â裱°ú¿ô¤È¤·¤Æ²óž¤¹¤ë³ÑÅÙ¡¢Â裲°ú¿ô¤È¤·¤Æ²óž¤ò¤µ¤»¤ë¼´¤Î¾ðÊó¤òÅϤ¹
// ¥¢¥¯¥»¥¹¤¹¤ë¾ì¹ç¤Ë¤Ï¡¢[¥¯¥é¥¹¤ÎÂåÆþ¤µ¤ì¤Æ¤¤¤ëÊÑ¿ô̾].[¸Æ¤Ó½Ð¤¹¥á¥½¥Ã¥É̾]¤Ç½ñ¤¯
test.RotateCube(eulerAngle, axis);
}
if (Input.GetKeyDown(KeyCode.C)) {
// cube¤ò²óž¤µ¤»¤ë¤¿¤á¡¢Test¥¯¥é¥¹¤ÎRotateCube¥á¥½¥Ã¥É¤ò¸Æ¤Ó½Ð¤¹
// Â裱°ú¿ô¤È¤·¤Æ²óž¤¹¤ë³ÑÅÙ¡¢Â裲°ú¿ô¤È¤·¤Æ²óž¤ò¤µ¤»¤ë¼´¡¢Â裳°ú¿ô¤È¤·¤ÆµÕ²óž¤Î¾ðÊó¤òÅϤ¹
test.RotateCube(eulerAngle,axis,true);
}
if (Input.GetKeyDown(KeyCode.Space)) {
// cube¤Î¾õÂÖ¤ò¥ê¥»¥Ã¥È¤¹¤ë¤¿¤á¡¢Test¥¯¥é¥¹¤ÎResetRotate¤ò¸Æ¤Ó½Ð¤¹
test.ResetRotate();
}
if (Input.GetKeyDown(KeyCode.V)) {
// ³Æ²óž¼´¤Î²óž¤µ¤»¤¿²ó¿ô¤ò¥ê¥»¥Ã¥È¤¹¤ë¤¿¤á¡¢Test¥¯¥é¥¹¤ÎResetAxisCount¤ò¸Æ¤Ó½Ð¤¹
test.ResetAxisCount(0);
}
}
}
´°À®¤·¤¿¤éCube¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤·¤Þ¤¹¡£¥¡¼ÆþÎϤò¤·¤¿¤È¤¤ËCube¥ª¥Ö¥¸¥§¥¯¥È¤¬²óž¤¹¤ë¤«¡¢³Îǧ¤ò¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¤½¤ì¤¾¤ìÊ̤Υ¯¥é¥¹¤Ë½ñ¤«¤ì¤Æ¤¤¤ë½èÍý¤¬°ìÏ¢¤Îή¤ì¤Ç·Ò¤¬¤Ã¤Æ¤¤¤ì¤Ð²óžưºî¤ò¤¹¤ë¤Ï¤º¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- Áí¹ç




¥³¥á¥ó¥È¤ò¤«¤¯