Esempio n. 1
0
    public void Update()
    {
        //hack da se parent miče sa childom
        //jer je sada animator na parentu pa root motion miče parenta
        Vector3 childPosition = pirate.transform.position;

        transform.position        = new Vector3(childPosition.x, transform.position.y, childPosition.z);
        pirate.transform.position = new Vector3(transform.position.x, childPosition.y, transform.position.z);

        /*transform.position = Vector3.Lerp(transform.position, clientPosition, UnityEngine.Time.deltaTime * 5f);
         * transform.rotation = Quaternion.Lerp(transform.rotation, clientRotation, UnityEngine.Time.deltaTime * 5f);
         * pirate.transform.rotation = Quaternion.Lerp(pirate.transform.rotation, childRotation, UnityEngine.Time.deltaTime * 5f);*/

        /*ServerSend.PlayerCharacterPosition(id, transform.position,
         *      transform.rotation,
         *      pirate.transform.rotation,
         *      true);*/

        buffManager.BuffCheck();

        if (data.dead)
        {
            if (Time.time - respawnUpdateTime < respawnTime)
            {
                return;
            }

            respawnUpdateTime = Time.time;
            Respawn();
        }
        else
        {
            respawnUpdateTime = Time.time;
        }

        if (Time.time - energyUpdateStart > NetworkManager.energyGainPeriod && energy < max_energy)
        {
            if (energy + NetworkManager.energyGainAmount > max_energy)
            {
                energy = max_energy;
            }
            else
            {
                energy += NetworkManager.energyGainAmount;
            }
            ServerSend.Stats(id);
            energyUpdateStart = Time.time;
        }
    }