Beispiel #1
0
    void Start()
    {
        refreshcount();
        prefabs.sp.maxValue = maxsp;
        player1             = new playerstat();
        player2             = new playerstat();
        player1.hp          = starthealth;
        player2.hp          = starthealth;
        time = timer;
        prefabs.p1hp.HpBar.maxValue       = starthealth;
        prefabs.p1hp.HpBarLinger.maxValue = starthealth;
        prefabs.p1hp.SetHpBar(starthealth);
        prefabs.p2hp.HpBar.maxValue       = starthealth;
        prefabs.p2hp.HpBarLinger.maxValue = starthealth;
        prefabs.p2hp.SetHpBar(starthealth);

        player1.sp = 0;
        player2.sp = 0;
        inisialisasitabeldamage();
        prefabs.sp.maxValue = maxsp;
        anip1     = prefabs.player1.GetComponent <Animator>();
        anip2     = prefabs.player2.GetComponent <Animator>();
        anicanvas = prefabs.Canvas.GetComponent <Animator>();
        reset();

        StartCoroutine(StartBattle());

        AudioManager.Instance.PlayAudio("Battle");
    }
Beispiel #2
0
    IEnumerator Pickup(Collider Player)
    {
        // Spawn a cool effect
        Instantiate(pickupEffect, transform.position, transform.rotation);
        //Apply effect to the player
        Player.transform.localScale *= multiplier;

        playerstat stats = Player.GetComponent <playerstat>();

        stats.health *= multiplier;

        //wait x amount of seconds
        GetComponent <MeshRenderer>().enabled = false;
        GetComponent <Collider>().enabled     = false;

        yield return(new WaitForSeconds(duration));

        // reverse the effect on our player
        stats.health /= multiplier;

        //remove game obeject
        Destroy(gameObject);
    }