public interface IHogeValue
{
int Value { get; set; }
int GetValue()
{
return Value;
}
}
public class HogeParent : IHogeValue
{
public int Value { get; set; }
public HogeParent()
{
Value = 1;
}
}
public class HogeChild : HogeParent, IHogeValue
{
new public int Value { get; set; }
public HogeChild()
{
Value = 2;
}
}
public class Logger : MonoBehaviour
{
void Start()
{
IHogeValue child = new HogeChild();
Debug.Log(child.GetValue());
Debug.Log(((IHogeValue)child).GetValue());
Debug.Log(child.Value);
Debug.Log(((IHogeValue)child).Value);
Debug.Log(((HogeParent)child).Value);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Cinemachine;
public class LESSON : MonoBehaviour
{
CinemachineVirtualCamera camera;
// Start is called before the first frame update
void Start()
{
camera = this.gameObject.GetComponent<CinemachineVirtualCamera>();
}
public float GetVerticalAngle()
{
return camera.GetCinemachineComponent(CinemachineCore.Stage.Aim).GetComponent<CinemachinePOV>().m_VerticalAxis.Value;
}
}
補足
GetCinemachineComponent とは
定義は
public CinemachineComponentBase GetCinemachineComponent(CinemachineCore.Stage stage)
ColorUtility.TryParseHtmlString(string colorCode, Color outcolor)は、「colorCodeがUnityEngineColorに変換できるか」の判定をbool(真偽)を返し、trueの場合、outcolorに変換後の色を代入する関数。
SetPixel(int x, int y, Color color)は、Texture2Dの座標(x, y)のピクセルの色をcolorに変更する関数。Unityの座標はx座標が→方向、y座標が↑方向になっている一方、コード内のpicture_strはx座標が→方向、y座標が↓方向になっているので、y座標をpicture_str.GetLength(0)-1-yで置換しています。