Esempio n. 1
0
    private void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Player       player = null;
            GameObject   go     = Click();
            ZappyObjects inv    = null;

            if (go != null)
            {
                if (go.tag == "Player")
                {
                    player = go.GetComponent <Player>();
                    if (player != null)
                    {
                        net.Send("pin " + player.id.ToString() + "\n");
                        inv = player.inventory;
                    }
                }
                else
                {
                    ZappyCell cell = go.GetComponent <ZappyCell>();
                    net.Send("bct " + cell.gridPos.x + " " + cell.gridPos.y + "\n");
                    inv = cell.inventory;
                }
                if (inv != null)
                {
                    invUI.go = go;
                    invUI.activeInventory = inv;
                }
            }
        }
    }
Esempio n. 2
0
File: Player.cs Progetto: 3ldh/Zappy
    private void Awake()
    {
        // Load audio stuff
        audioSource = gameObject.GetComponent <AudioSource>();
        putSound    = (AudioClip)Resources.Load("Sounds/put");
        pickupSound = (AudioClip)Resources.Load("Sounds/pickup");
        deathSound  = (AudioClip)Resources.Load("Sounds/playerDeath");

        inventory         = new ZappyObjects();
        waitForEndOfFrame = new WaitForEndOfFrame();
        coroutineManager  = GetComponent <CoroutineFramework>();
        speed             = 7 / UpdateManager.frequency;
        UpdateAnimSpeed();
    }
Esempio n. 3
0
    public void Awake()
    {
        spawnPoints = new List <Vector3>();
        inventory   = new ZappyObjects();
        foreach (Transform t in transform.GetChild(0))
        {
            spawnPoints.Add(t.position);
        }

        for (int i = 0; i < gems.Length; i++)
        {
            gems[i].transform.position = GetSpawnPoint();
        }
    }
Esempio n. 4
0
    public void UpdateCell(int food, int libenate, int deraumere, int sibur, int mendiane, int phiras, int thystame)
    {
        if (inventory == null)
        {
            inventory = new ZappyObjects();
        }

        inventory.UpdateValues(food, libenate, deraumere, sibur, mendiane, phiras, thystame);

        if (food <= 0)
        {
            gems[0].SetActive(false);
        }
        else
        {
            gems[0].SetActive(true);
        }
        if (libenate <= 0)
        {
            gems[1].SetActive(false);
        }
        else
        {
            gems[1].SetActive(true);
        }
        if (deraumere <= 0)
        {
            gems[2].SetActive(false);
        }
        else
        {
            gems[2].SetActive(true);
        }
        if (sibur <= 0)
        {
            gems[3].SetActive(false);
        }
        else
        {
            gems[3].SetActive(true);
        }
        if (mendiane <= 0)
        {
            gems[4].SetActive(false);
        }
        else
        {
            gems[4].SetActive(true);
        }
        if (phiras <= 0)
        {
            gems[5].SetActive(false);
        }
        else
        {
            gems[5].SetActive(true);
        }
        if (thystame <= 0)
        {
            gems[6].SetActive(false);
        }
        else
        {
            gems[6].SetActive(true);
        }
    }