Esempio n. 1
0
    void Update()
    {
        Player player = ReInput.players.GetPlayer(0);

        if (isDying)
        {
            transform.eulerAngles = Vector3.forward * (GameManager.time - diedAt) * -20;
            transform.position    = evaluable.eval(GameManager.time) + new Vector3(1, -1, 0) * (GameManager.time - diedAt) * 3;
            return;
        }
        if (GameManager.instance.state != GameState.CARD_SELECT || player.GetAxis("Rewind") != 0 || player.GetAxis("Fastforward") != 0)
        {
            transform.position = GetCurrentPos();
            return;
        }
        Vector3 dir = new Vector3(player.GetAxis("MoveHori"), player.GetAxis("MoveVert"), 0);

        if (dir.magnitude > Mathf.Epsilon && !GameManager.instance.isAtEndOfTurn)
        {
            UICenter.DeselectAll();
            GameManager.time += dir.magnitude * Time.deltaTime * moveTimeScalar;
            CullBranch();
            transform.position += dir * moveSpeed;
            TryBounds();
        }
        TryRecordPos();
        return;

        TryShoot();
        if (player.GetButtonDown("Confirm"))
        {
            for (int x = 0; x < 3; x++)
            {
                PlayerShot ps = Instantiate(Resources.Load <PlayerShot>("PlayerShot"));

                ps.spawnTime          = GameManager.time - ((float)x) / 10;
                ps.dir                = Vector3.right * 20;
                ps.scheduledDeathTime = 5;
                ps.Init(evaluable);
            }
        }
    }