예제 #1
0
    // Use this for initialization
    public void Init()
    {
        gm = Camera.main.GetComponent<GameManager>();
        curBPdelay = BPdelay;
        maxHealth = health;

        inv = transform.GetComponent<Inventory>();
        inv.Init((int)inventorySize.x, (int)inventorySize.y);

        invD = gm.GetComponent<InvDisp>();
        invD.Init((int)inventorySize.x, (int)inventorySize.y);

        healthBar = gm.PlayerHealthBar;
        damageImage = gm.PlayerDamageImage;
        InfoText = gm.InfoText;

        healthBar.maxValue = maxHealth;
        healthBar.value = health;
    }
예제 #2
0
    public void load(string s)
    {
        Debug.Log("PlayerControls::load -- " + s);
        string[] values = s.Split(':');
        gameObject.name = values[0];
        transform.position = new Vector2(float.Parse(values[1]), float.Parse(values[2]));
        health = int.Parse(values[3]);
        maxHealth = int.Parse(values[4]);

        gm = Camera.main.GetComponent<GameManager>();
        curBPdelay = BPdelay;

        inv = transform.GetComponent<Inventory>();
        inv.Init((int)inventorySize.x, (int)inventorySize.y);
        string loadinv = values[5];
        inv.load(loadinv);

        invD = gm.GetComponent<InvDisp>();
        invD.Init((int)inventorySize.x, (int)inventorySize.y);

        healthBar = gm.PlayerHealthBar;
        damageImage = gm.PlayerDamageImage;

        healthBar.maxValue = maxHealth;
        healthBar.value = health;
    }