Hello, i want to create some simples 2D arrays, to stores some datas. i would like to get something similar to a realy basic excel file. here is an exemple :
to get something working, i have this :
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TestArray : MonoBehaviour
{
enum AnimalEnum : int
{
Dog, Donkey, Human, Cat
}
enum FoodEnum : int
{
Fruit, Meat, Candy,
}
[SerializeField]
public float[,] test = new float[(byte)AnimalEnum.Cat + 1, (byte)FoodEnum.Candy + 1]
{
/* Fruit Meat Candy*/
/*Dog */{ 7.4f, 8, 9 },
/*Donkey */{ 1, 2, 3 },
/*Human */{ 1, 1, 30 },
/*Cat */{ 1, 2, 3 }
};
void GetFoodValue(AnimalEnum animal, FoodEnum food)
{
Debug.Log(test[(int)animal, (int)food]);
}
void Update()
{
if (Input.GetButtonDown("Jump"))
{
GetFoodValue(AnimalEnum.Human, FoodEnum.Candy);
}
}
}
The base functions work (getings datas for the asked type), but it is not ready readable, and hard to modify (i would like to modify it on a public variable on the inspector, so the designer could set and edit the value easily.