Esempio n. 1
0
    IEnumerator PickUp(Collider2D player) //find first link of chain and change it's break limit also changes to new spawnpoint and new prefab to unchained player
    {
        _ColorCode.SetSpawnPoint(spawnPointFree);
        _ColorCode.SetPlayerPrefab(freePlayer);
        chainFirst     = GameObject.FindGameObjectsWithTag("ChainFirst");
        chainTemp      = (GameObject)chainFirst.GetValue(0);
        _WeightChange  = chainTemp.GetComponent <WeightChange>();
        _WeightChange2 = chainTemp.GetComponent <WeightChange>();

        oldWeight = _WeightChange.GetWeight();
        _WeightChange.SetWeight(newWeight);
        _WeightChange.SetBreak(breakValue);
        _WeightChange2.SetGravity(gravityValue);

        GetComponent <Collider2D>().enabled     = false;
        GetComponent <SpriteRenderer>().enabled = false;

        yield return(new WaitForSeconds(duration));

        _WeightChange.SetWeight(oldWeight);
        Destroy(gameObject);
    }