Example #1
0
 void Awake()
 {
     anim = GetComponent<Animator>();
     hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
     inventory = player.GetComponent<PlayerInventory>();
 }
Example #2
0
 void Awake()
 {
     anim            = GetComponent <Animator>();
     hash            = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();
     player          = GameObject.FindGameObjectWithTag(Tags.player);
     playerInventory = player.GetComponent <PlayerInventory>();
 }
Example #3
0
        void it_does_not_decode_with_a_different_salt()
        {
            var peppers = new HashIds("this is my pepper");

            _hashIds.Decode("NkK9").Should().Equal(new [] { 12345 });
            peppers.Decode("NkK9").Should().Equal(new int [0]);
        }
 void Awake()
 {
     hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
     anim = GetComponent<Animator>();
     isDown = false;
     inRange = false;
 }
Example #5
0
        void issue_18_it_should_return_empty_string_if_negative_numbers()
        {
            var hashids = new HashIds("this is my salt");

            hashids.Encode(1, 4, 5, -3).Should().Be(string.Empty);
            hashids.EncodeLong(4, 5, 2, -4).Should().Be(string.Empty);
        }
Example #6
0
    public Locomotion(Animator animator)
    {
        animControl = animator;
        animControl.applyRootMotion = false;

        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
    }
Example #7
0
        void it_can_decode_from_a_hash_with_a_minimum_length()
        {
            var h = new HashIds(salt, 8);

            h.Decode("gB0NV05e").Should().Equal(new [] { 1 });
            h.Decode("mxi8XH87").Should().Equal(new[] { 25, 100, 950 });
            h.Decode("KQcmkIW8hX").Should().Equal(new[] { 5, 200, 195, 1 });
        }
    void Awake()
    {
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
        targetDirection = new Vector3();

        anim.SetLayerWeight(1, 0.8f);
    }
Example #9
0
 void Awake()
 {
     anim = GetComponent<Animator>();
     playerMovement = GetComponent<PlayerMovement>();
     hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
     fade = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent<ScreenFadeInOut>();
     lastSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<LastPlayerSighting>();
 }
Example #10
0
 void Awake()
 {
     anim               = GetComponent <Animator>();
     playerMovement     = GetComponent <PlayerMovement>();
     hash               = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();
     sceneFadeInOut     = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent <SceneFadeInOut>();
     lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <LastPlayerSighting>();
 }
Example #11
0
        void it_can_encodes_to_a_minimum_length()
        {
            var h = new HashIds(salt, 18);

            h.Encode(1).Should().Be("aJEDngB0NV05ev1WwP");

            h.Encode(4140, 21147, 115975, 678570, 4213597, 27644437).
            Should().Be("pLMlCWnJSXr1BSpKgqUwbJ7oimr7l6");
        }
Example #12
0
    void Awake()
    {
        mainCamera = Camera.main;

        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();

        float charDirection = Vector3.Angle(GetComponent<NavMeshAgent>().velocity, agent.transform.forward);
    }
Example #13
0
 void Awake()
 {
     player = GameObject.FindGameObjectWithTag(Tags.player);
     playerAnim = player.GetComponent<Animator>();
     hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
     camMovement = Camera.main.gameObject.GetComponent<CameraMovement>();
     fade = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent<ScreenFadeInOut>();
     liftDoorsTracking = GetComponent<LiftDoorsTracking>();
 }
Example #14
0
 void Awake()
 {
     player            = GameObject.FindGameObjectWithTag(Tags.player);
     playerAnim        = player.GetComponent <Animator>();
     hash              = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();
     camMovement       = Camera.main.GetComponent <CameraMovement>();
     sceneFadeInOut    = GameObject.FindGameObjectWithTag(Tags.fader).GetComponent <SceneFadeInOut>();
     liftDoorsTracking = GetComponent <LiftDoorsTracking>();
 }
    private PlayerInventory playerInventory; // Reference to the PlayerInventory script.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setting up the references.
        isDoorOpen = false;
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
        player = GameObject.FindGameObjectWithTag(Tags.player);
        playerInventory = player.GetComponent<PlayerInventory>();
        doorOpenClip = audio.clip;
    }
Example #16
0
        void Encode_single()
        {
            var hashids   = new HashIds();
            var stopWatch = Stopwatch.StartNew();

            for (var i = 1; i < 10001; i++)
            {
                hashids.Encode(i);
            }
            stopWatch.Stop();
            Trace.WriteLine($"10 000 encodes: {stopWatch.ElapsedMilliseconds}");
        }
Example #17
0
    void Awake()
    {
        navAgent = GetComponent<NavMeshAgent> ();
        anim = GetComponent<Animator> ();
        hash = GameObject.FindGameObjectWithTag (DoneTags.gameController).GetComponent<HashIds> ();
        //navAgent.updateRotation = false;

        collider	=	GetComponent<SphereCollider>();
        player		=	GameObject.FindGameObjectWithTag("Player");

        deadZone *= Mathf.Deg2Rad;
    }
Example #18
0
    void Awake()
    {
        nav = GetComponent<NavMeshAgent>();
        col = GetComponent<SphereCollider>();
        anim = GetComponent<Animator>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<LastPlayerSighting>();
        player = GameObject.FindGameObjectWithTag(Tags.player);
        playerAnim = player.GetComponent<Animator>();
        playerHealth = player.GetComponent<PlayerHealth>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();

        personalLastSighting = pastSighting = lastPlayerSighting.resetPosition;
    }
Example #19
0
    void Awake()
    {
        nav  = GetComponent <NavMeshAgent>();
        col  = GetComponent <SphereCollider>();
        anim = GetComponent <Animator>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <LastPlayerSighting>();
        player             = GameObject.FindGameObjectWithTag(Tags.player);
        playerAnim         = player.GetComponent <Animator>();
        playerHealth       = player.GetComponent <PlayerHealth>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();

        personalLastSighting = lastPlayerSighting.resetPosition;
        previousSighting     = lastPlayerSighting.resetPosition;
    }
Example #20
0
    void Awake()
    {
        anim           = GetComponent <Animator>();
        laserShotLine  = GetComponentInChildren <LineRenderer>();
        laserShotLight = laserShotLine.gameObject.GetComponent <Light>();
        col            = GetComponent <SphereCollider>();
        player         = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth   = player.gameObject.GetComponent <PlayerHealth>();
        hash           = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();

        laserShotLine.enabled    = false;
        laserShotLight.intensity = 0;

        scaledDamage = maximumDamage - minimumDamage;
    }
    void Awake()
    {
        playerTransform = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent<EnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
        animSetup = new AnimatorSetup(anim, hash);

        nav.updateRotation = false;

        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;
    }
Example #22
0
    void Awake()
    {
        anim = GetComponent<Animator>();
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();
        laserShotLine = GetComponentInChildren<LineRenderer>();
        laserShotLight = laserShotLine.GetComponent<Light>();
        col = GetComponent<SphereCollider>();
        playerPosition = GameObject.FindGameObjectWithTag(Tags.player).transform;
        playerHealth = playerPosition.gameObject.GetComponent<PlayerHealth>();

        laserShotLine.enabled = false;
        laserShotLight.intensity = 0f;

        shooting = false;
        scaledDamage = maxDamage - minDamage;
    }
Example #23
0
        void issue_14_it_should_decode_encode_hex_correctly()
        {
            var hashids = new HashIds("this is my salt");
            var encoded = hashids.EncodeHex("DEADBEEF");

            encoded.Should().Be("kRNrpKlJ");

            var decoded = hashids.DecodeHex(encoded);

            decoded.Should().Be("DEADBEEF");

            var encoded2 = hashids.EncodeHex("1234567890ABCDEF");
            var decoded2 = hashids.DecodeHex(encoded2);

            decoded2.Should().Be("1234567890ABCDEF");
        }
Example #24
0
    void Awake()
    {
        player     = GameObject.FindGameObjectWithTag(Tags.player).transform;
        enemySight = GetComponent <EnemySight>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();

        nav.updateRotation = false;
        animSetup          = new AnimatorSetup(anim, hash);

        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        deadZone *= Mathf.Deg2Rad;
    }
Example #25
0
        void issue_15_it_should_return_emtpy_array_when_decoding_characters_missing_in_alphabet()
        {
            var hashids = new HashIds(salt: "Salty stuff", alphabet: "qwerty1234!¤%&/()=", separators: "1234");
            var numbers = hashids.Decode("abcd");

            numbers.Length.Should().Be(0);

            var hashids2 = new HashIds();

            hashids.Decode("13-37").Length.Should().Be(0);
            hashids.DecodeLong("32323kldffd!").Length.Should().Be(0);

            var hashids3 = new HashIds(alphabet: "1234567890;:_!#¤%&/()=", separators: "!#¤%&/()=");

            hashids.Decode("asdfb").Length.Should().Be(0);
            hashids.DecodeLong("asdfgfdgdfgkj").Length.Should().Be(0);
        }
Example #26
0
        void issue_12_should_not_throw_out_of_range_exception()
        {
            var hash        = new HashIds("zXZVFf2N38uV");
            var longs       = new List <long>();
            var rand        = new Random();
            var valueBuffer = new byte[8];
            var randLong    = 0L;

            for (var i = 0; i < 100000; i++)
            {
                rand.NextBytes(valueBuffer);
                randLong = BitConverter.ToInt64(valueBuffer, 0);
                longs.Add(Math.Abs(randLong));
            }

            var encoded = hash.EncodeLong(longs);
            var decoded = hash.DecodeLong(encoded);

            decoded.Should().Equal(longs.ToArray());
        }
Example #27
0
 public AnimatorSetup(Animator animator, HashIds hash)
 {
     anim      = animator;
     this.hash = hash;
 }
Example #28
0
 void Awake()
 {
     anim = GetComponent <Animator>();                                                   //inistallises the animator
     id   = GameObject.FindGameObjectWithTag("GameController").GetComponent <HashIds>(); //get hasid from gamecontroller id
 }
Example #29
0
 void Awake()
 {
     anim = GetComponent <Animator>();
     hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent <HashIds>();
     anim.SetLayerWeight(1, 100f);
 }
 void Awake()
 {
     anim = GetComponent<Animator> ();
     hash = GameObject.FindGameObjectWithTag (Tags.gameController).GetComponent<HashIds> ();
 }
Example #31
0
 public AnimatorSetup(Animator animator, HashIds hashIDs)
 {
     // instalise
     anim = animator;
     hash = hashIDs;
 }
Example #32
0
 public AnimatorSetup(Animator anim, HashIds hash)
 {
     this.anim = anim;
     this.hash = hash;
 }
Example #33
0
 void issue_8_should_not_throw_out_of_range_exception()
 {
     var hashids = new HashIds("janottaa", 6);
     var numbers = hashids.Decode("NgAzADEANAA=");
 }
Example #34
0
 public HashIds_test()
 {
     _hashIds = new HashIds(salt);
 }
Example #35
0
        void it_can_encode_with_a_custom_alphabet()
        {
            var h = new HashIds(salt, 0, "ABCDEFGhijklmn34567890-:");

            h.Encode(1, 2, 3, 4, 5).Should().Be("6nhmFDikA0");
        }
Example #36
0
    private int count;         //counter for the doors opening and closing

    void Awake()
    {
        anim   = GetComponent <Animator>();                                                   //setting up animator reference
        hash   = GameObject.FindGameObjectWithTag("GameController").GetComponent <HashIds>(); //setting up hash reference
        player = GameObject.FindGameObjectWithTag("Player");                                  //setting up player reference
    }
Example #37
0
    // Use this for initialization
    void Awake()
    {
        agent = GetComponent<NavMeshAgent>();
        agent.updateRotation = false;

        animator = GetComponent<Animator>();
        locomotion = new Locomotion(animator);
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIds>();

        particleClone = null;
    }