Example #1
0
    void Start()
    {
        anim             = GetComponent <Animator>();
        myBody           = GetComponent <Rigidbody2D>();
        InteractionModel = GetComponent <CharacterInteractionModel>();
        HideWeapon();
        audio             = gameObject.AddComponent <AudioSource>();
        audio.playOnAwake = false;
        audio.volume      = 0.8f;
        attackSounds      = Resources.LoadAll("Sounds/AttacksBis");
        pointsSound       = Resources.LoadAll("Sounds/Coins");
        hurtSound         = Resources.Load("Sounds/Hurt");
        shootSounds       = Resources.LoadAll("Sounds/Shoot");
        heartSound        = Resources.Load("Sounds/heart");
        wrongSound        = Resources.Load("Sounds/wrong");
        setFrozen(false, true);

        GlobalBehavior global = GameObject.FindGameObjectWithTag("Global").GetComponent <GlobalBehavior> ();

        if (SceneManager.GetActiveScene().name == "Level1")
        {
            global.initValue();
        }

        maxHp     = global.maxHpPlayer;
        damage    = global.damagePlayer;
        moveSpeed = global.moveSpeedPlayer;
        InitPoint(global.scorePlayer);
        Debug.Log(maxHp);
        Debug.Log(damage);
        Debug.Log(moveSpeed);

        currentHp = maxHp;
        UpdateDisplayHearts();
    }