예제 #1
0
    void Start()
    {
        print("mi nombre es: " + this.name);
        pistola       = GameObject.Find("/bot/armasBot/pistolaBot");
        escopeta      = GameObject.Find("/bot/armasBot/escopetaBot");
        ametralladora = GameObject.Find("/bot/armasBot/ametralladoraBot");

        //Seteando el animador para el bot.
        animadorBot = new AnimadorBot();
        anim        = GetComponent <Animator>();
        animadorBot.setAnim(anim);
        animadorBot.setearCaer();

        //Seteando el emisor de balas.
        emisorBalas = new emisorBalaBot();

        //Seteando el gestor de armas. Los objetos que se mandan por parametro se nullean, ¿Porque?
        gestorArmas = new gestionArmasBot();
        gestorArmas.setAnimador(animadorBot);
        gestorArmas.setEmisorArmas(emisorBalas);
        gestorArmas.setMostrarArmas(mostrarArmas);
        gestorArmas.setBotPlayer(this);

        //Seteando el mostrar armas, esta clase llama al bot para indicarle que arma mostrar.
        mostrarArmas = new mostrarArmasBot();
        mostrarArmas.setAux(this);

        thisRigibody = gameObject.AddComponent <Rigidbody>();
        moveSpeed    = Constants.moveSpeedBot;
        DataGame.IdPlayers.Add(this.name[this.name.Length - 1]);
        audioSource        = GetComponent <AudioSource>();
        audioFall          = ((AudioClip)Resources.Load("Sounds/PlayerFall"));
        audioWalk          = ((AudioClip)Resources.Load("Sounds/PlayerWalk"));
        audioRun           = ((AudioClip)Resources.Load("Sounds/PlayerRun"));
        audioPistola       = ((AudioClip)Resources.Load("Sounds/WeaponGun"));
        audioAmetralladora = ((AudioClip)Resources.Load("Sounds/WeaponMachineGun"));
        audioEscopeta      = ((AudioClip)Resources.Load("Sounds/WeaponShotgun"));
    }
 public void setAnimador(AnimadorBot a)
 {
     //this.anim = a;
 }