Пример #1
0
    private void Start()
    {
        isis   = PlayerControl.instance.isis;
        horus  = PlayerControl.instance.horus;
        anubis = PlayerControl.instance.anubis;

        normalSprite = gameObject.GetComponent <SpriteRenderer>().sprite;

        objectDetailPanel.SetActive(false);;

        pickUpItemClip = Resources.Load <AudioClip>(pathToPickUpSound);

        if (item.name == "ankh")
        {
            item.canPickup = true;
        }
        else
        {
            item.canPickup = false;
        }

        // item.pickUpAudioSource = new AudioSource;
        item.pickUpAudioClip = pickUpItemClip;
        gameObject.AddComponent <AudioSource>();
        gameObject.GetComponent <AudioSource>().playOnAwake = false;
        gameObject.GetComponent <AudioSource>().clip        = item.pickUpAudioClip;
    }
Пример #2
0
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        isis   = GetComponentInChildren <Isis>();
        horus  = GetComponentInChildren <Horus>();
        anubis = GetComponentInChildren <Anubis>();

        isisAnimator   = isis.GetComponent <Animator>();
        horusAnimator  = horus.GetComponent <Animator>();
        anubisAnimator = anubis.GetComponent <Animator>();
        animator       = GetComponent <Animator>();

        currentPlayer = isis;

        inventory = Inventory.instance;

        lastCheckpoitPos = new Vector2(-7, 2);
    }
Пример #3
0
 /// <summary>
 /// Creates a <see cref="ISymmetric"/> instance using the Rijndael algorithm with a randomly created salt. The salt must be stored for future use.
 /// </summary>
 /// <returns>An <see cref="ISymmetric"/> instance using the Rijndael algorithm with a random salt.</returns>
 public static ISymmetric CreateRijndaelRandom()
 {
     return(Create(EncryptionAlgorithm.Rijndael, Horus.GenerateId(IdKind.Standard, 16)));
 }
Пример #4
0
        /// <summary>
        /// Builds an <see cref="EnigmaMachine"/> with the provided parameters.
        /// </summary>
        /// <returns></returns>
        public EnigmaMachine Build()
        {
            var shuffle = new Alphabet(_alphabet.ToString());

            //the stator:
            var stator = _stator;

            if (stator == null)
            {
                stator = new EnigmaWheel(_alphabet.ToString(), _alphabet.ToString());
            }

            //the reflector
            var reflector = _reflector;

            if (reflector == null)
            {
                shuffle.Shuffle();
                reflector = new EnigmaWheel(_alphabet.ToString(), shuffle.ToString());
                reflector.Reflect();
            }

            //the rotors
            List <Rotor> rotors;

            if (_rotors == null)
            {
                rotors = new List <Rotor>();
                for (int i = 0; i < _rotorCount; i++)
                {
                    string notches = "";

                    for (int n = 0; n < _notchCount; n++)
                    {
                        char c;
                        do
                        {
                            int rnd = Horus.Random(0, _alphabet.Count);
                            c = _alphabet[rnd];
                        } while (notches.Contains(c));

                        notches += c;
                    }

                    shuffle.Shuffle();

                    var rotor = new Rotor(_alphabet.ToString(), shuffle.ToString(), notches);
                    rotors.Add(rotor);
                }
            }
            else
            {
                rotors = new List <Rotor>(_rotors);
            }

            //the actual construction
            return(new EnigmaMachine(rotors)
            {
                Alphabet = _alphabet,
                AutoReset = _autoReset,
                Stator = stator,
                Reflector = reflector,
            });
        }