コード例 #1
0
ファイル: Humanoide.cs プロジェクト: Janisse/CrowdSimulator
    //Travaux à reprendre plustard
    //    private List<GameObject> Magasins;
    //    private int RandomMagasin;
    //    public GameObject PlanTouchePrefab;
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    //Initialisation
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////
    // Use this for initialization
    void Start()
    {
        //Defini l'ID de l'humanoide
        if(ID == 0) ID = 1;  else ID++;

        //Creation d'une variable d'etat synchronisé
        state = gameObject.AddComponent<SharedData>();
        state.createData ("Humanoide" + ID.ToString ());

        //Recupere l'Animator
        animControl = GetComponentInChildren<Animator>();

        //Initialise le tableau des pathNodes
        pathNodeTab = new List<Transform>();
        getPathNodeTab ();

        //Initialise le niveau d'interaction avec l'environement à nothing (aucune interaction à l'instanciation)
        interactionState = interaction.nothing;

        //Recupere le navMeshAgent
        navMesh = GetComponent<NavMeshAgent> ();

        //Generation aléatoire du point de destination lors du spawn et le fait aller à ce point
        destPathNode = Random.Range (0, pathNodeTab.Count);
        walk ();

        //Initialise son état (marche / course)
        setState (Random.Range(1,3));

        //???
        //Magasins = new List<GameObject>();

        //Initialise le tableau des magasins qu'ils peuvent regarder
        //getMagasins();
    }