Exemplo n.º 1
0
    // Update is called once per frame
    void Update()
    {
        if (dead)
        {
            if ((System.DateTime.Now - died).TotalMilliseconds > GameLogic.ZOMBIE_SHOW_BODY)
            {
                zombieManager.RecycleZombie(this);
            }
            return;
        }
        Vector2 playerPosition = player.position;
        Vector2 myPosition     = transform.position;
        Vector2 direction      = playerPosition - myPosition;

        rb.AddForce(direction.normalized * gameLogic.ZombieVelocity());
    }