コード例 #1
0
        /// <summary>
        /// Saves all pending changes to the database
        /// </summary>
        public void Save()
        {
            using (var db = GameDatabase.Open())
            {
                if (NeedsToSave)
                {
                    db.Update(new PlayerDto
                    {
                        Id                   = (int)Account.Id,
                        TutorialState        = TutorialState,
                        Level                = Level,
                        TotalExperience      = (int)TotalExperience,
                        PEN                  = (int)PEN,
                        AP                   = (int)AP,
                        Coins1               = (int)Coins1,
                        Coins2               = (int)Coins2,
                        CurrentCharacterSlot = CharacterManager.CurrentSlot
                    });
                    NeedsToSave = false;
                }

                Settings.Save(db);
                Inventory.Save(db);
                CharacterManager.Save(db);
                LicenseManager.Save(db);
                DenyManager.Save(db);
                Mailbox.Save(db);

                DeathMatch.Save(db);
                TouchDown.Save(db);
                Chasser.Save(db);
                BattleRoyal.Save(db);
                CaptainMode.Save(db);
                Mission.Save(db);
            }
        }
コード例 #2
0
    void Start()
    {
        this.MaxHealth             = 100f;
        this.CharacteristicsCanvas = characteristics;


        // Initializing the possible states for the creature
        this.seBalader    = this.gameObject.AddComponent <SeBalader>();
        this.chasser      = this.gameObject.AddComponent <Chasser>();
        this.seReproduire = this.gameObject.AddComponent <SeReproduire>();
        this.dead         = this.gameObject.AddComponent <Dead>();

        // Defining the initial state of the creature
        this.CurrentState = seBalader;

        // Initializing different parameters of the creature
        this.Hunger           = Random.Range(Game.minHunger, 100);
        this.ReproductiveNeed = Random.Range(Game.minReproductionNeed, 100);
        this.Speed            = Random.Range(1, 10);
        this.CurrentHealth    = Random.Range(MaxHealth / 2, MaxHealth);
        this.mCreatureType    = CreatureType.CARNIVORE;

        // Initializing the initial rotation of the creature
        this.gameObject.transform.Rotate(this.gameObject.transform.up * Random.Range(0, 360));

        // Sex
        int rand = Random.Range(1, 2);

        this.GetComponent <CarnivoreBrain>().mSex = rand == 1 ? Creature.Sex.FEMALE : Creature.Sex.MALE;

        // Body type
        Random.seed = System.DateTime.Now.Millisecond;
        rand        = Random.Range(1, System.Enum.GetNames(typeof(Body.BodyType)).Length);
        this.GetComponent <CarnivoreBrain>().mBody.mBodyType = (Body.BodyType)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Head active
        rand = Random.Range(1, System.Enum.GetNames(typeof(Head.Active)).Length);
        this.GetComponent <CarnivoreBrain>().mHead.mActive = (Head.Active)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Head passive
        rand = Random.Range(1, System.Enum.GetNames(typeof(Head.Passive)).Length);
        this.GetComponent <CarnivoreBrain>().mHead.mPassive = (Head.Passive)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Front limb active
        rand = Random.Range(1, System.Enum.GetNames(typeof(Limb.Active)).Length);
        this.GetComponent <CarnivoreBrain>().FrontLimb.mActive = (Limb.Active)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Front limb passive
        rand = Random.Range(1, System.Enum.GetNames(typeof(Limb.Passive)).Length);
        this.GetComponent <CarnivoreBrain>().FrontLimb.mPassive = (Limb.Passive)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Back limb active
        rand = Random.Range(1, System.Enum.GetNames(typeof(Limb.Active)).Length);
        this.GetComponent <CarnivoreBrain>().BackLimb.mActive = (Limb.Active)rand;

        Random.seed = System.DateTime.Now.Millisecond;
        // Back limb passive
        rand = Random.Range(1, System.Enum.GetNames(typeof(Limb.Passive)).Length);
        this.BackLimb.mPassive = (Limb.Passive)rand;
    }