コード例 #1
0
    Quaternion ThinkOfRotation()
    {
        RotationMap map   = GetComponent <RotationMap>();
        List <int>  array = map.GetArrayFromMap();

        int index = array[Random.Range(0, array.Count)];

        map.SetPositionToNext(index);

        Vector3 result = Vector3.zero;

        result.y += index * RotateAngle;
        return(Quaternion.Euler(result));
    }
コード例 #2
0
    void ControlRotationMap()
    {
        switch (enemyState)
        {
        case EnemyState.Run:
            RotationMap map = GetComponent <RotationMap>();
            if (!resetMap)
            {
                map.ResetMap();
                resetMap = true;
            }
            break;

        default:
            resetMap = false;
            break;
        }
    }
コード例 #3
0
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        RotationMap map = (RotationMap)target;

        if (map.backUpSize != map.mapSize)
        {
            map.pointArray = new Boolean2D(map.mapSize);
            map.backUpSize = map.mapSize;
        }

        if (map.pointArray == null)
        {
            return;
        }

        GUILayout.BeginVertical();

        for (int i = 0; i < map.mapSize; i++)
        {
            GUILayout.BeginHorizontal();

            for (int j = 0; j < map.mapSize; j++)
            {
                bool value;
                if (map.pointArray.GetElement(i, j, out value))
                {
                    map.pointArray.SetElement(i, j, EditorGUILayout.Toggle(value, GUILayout.MaxWidth(15)));
                }
            }

            GUILayout.EndHorizontal();
        }

        GUILayout.EndVertical();
    }