/// <summary> /// Initials new account. /// </summary> /// <param name="bonusSystem">The bonus system.</param> public Account(int id, BonusSystem bonusSystem, bool isClosed = false) { this.Id = id; this.BonusSystem = bonusSystem ?? throw new ArgumentNullException(nameof(bonusSystem)); this.IsClosed = isClosed; }
private void Awake() { transformer = gameObject.GetComponent <Transform>(); rigidBody = gameObject.GetComponent <Rigidbody2D>(); animator = gameObject.GetComponent <Animator>(); spriteRender = gameObject.GetComponent <SpriteRenderer>(); collider = gameObject.GetComponent <Collider2D>(); movement = gameObject.GetComponent <IPlayerMovement>(); //--Init MovementController--- movementController = gameObject.GetComponent <MovementController>(); movementController.Init(movement, physicStats); //--Init MetterCounter--- if (!meterCounter) { meterCounter = gameObject.AddComponent <MeterCounter>(); } meterCounter.Init(gameStats, transformer); //--Init BonusSystem--- bonusSystem = gameObject.GetComponent <BonusSystem>(); //--Init Speed booster speedBooster = gameObject.GetComponent <PlayerSpeedIncreaser>(); speedBooster.Init(); //--Init Effects--- tailEffects = transform.FindChild("TailEffects").gameObject; deathEffects = transform.FindChild("DeathEffects").gameObject; barrierEffects = transform.FindChild("BarrierEffects").gameObject; //--Init Events--- gameStats.onIsAliveChange += LeadersSystem.ReportLeader; gameStats.onIsAliveChange += UserStats.Instance.SaveCurrency; }
/// <summary> /// Converts DTO account to account. /// </summary> /// <param name="dto">DTO account to convert.</param> /// <returns>Account.</returns> public static Account ToAccount(this AccountDTO dto) { if (dto == null) { throw new ArgumentNullException(nameof(dto)); } BonusSystem bonusSystem = null; if (dto.BonusSystemType == typeof(BaseBonusSystem).ToString()) { bonusSystem = new BaseBonusSystem(); } else if (dto.BonusSystemType == typeof(GoldBonusSystem).ToString()) { bonusSystem = new GoldBonusSystem(); } else if (dto.BonusSystemType == typeof(GoldBonusSystem).ToString()) { bonusSystem = new PlatinumBonusSystem(); } else { throw new InvalidCastException("Can't cast AccountDTO to Account."); } Account account = null; if (dto.AccountType == typeof(DefaultAccount).ToString()) { account = new DefaultAccount(dto.Id, bonusSystem, dto.IsClosed); } else if (dto.AccountType == typeof(CashbackAccount).ToString()) { account = new CashbackAccount(dto.Id, bonusSystem, dto.Cashback, dto.IsClosed); ((CashbackAccount)account).CashbackPercent = dto.CashbackPercent; } else { throw new InvalidCastException("Can't cast AccountDTO to Account."); } account.FirstName = dto.FirstName; account.LastName = dto.LastName; account.Balance = dto.Balance; return(account); }
public D20System() { Conditions = new ConditionRegistry(); Conditions.Register(GlobalCondition.Conditions); foreach (var conditionSpec in GlobalCondition.Conditions) { Conditions.AttachGlobally(conditionSpec); } Conditions.Register(ContentDiscovery.Conditions); foreach (var(featId, condition) in ContentDiscovery.FeatConditions) { FeatConditionMapping.Mapping[featId] = new FeatConditionMapping.FeatCondition(condition); } Logger.Info("Registered {0} conditions.", Conditions.Count); Conditions.WarnAboutPendingExtensions(); BonusSystem = new BonusSystem(); Status = new D20StatusSystem(); // TODO ObjectRegistry = new D20ObjectRegistry(); Actions = new D20ActionSystem(); Initiative = new D20Initiative(); RadialMenu = new RadialMenuSystem(); Hotkeys = new HotkeySystem(); BuffDebuff = new D20BuffDebuffSystem(); Damage = new D20DamageSystem(); Combat = new D20CombatSystem(); Experience = new D20ExperienceSystem(); }
/// <summary> /// Initials new instance of bank account with cashback. /// </summary> /// <param name="bonusSystem">Bonus system.</param> /// <param name="cashbackPercent">Cashback percent.</param> public CashbackAccount(int id, BonusSystem bonusSystem, decimal cashback, bool isClosed = false) : base(id, bonusSystem, isClosed) { this.Cashback = cashback; }
protected override void Init() { #if DEBUG if (Current != null) throw Exception.Create("Cannot have more than one ShooterLevel running at the same time!", null); #endif pendingTimers = new List<int>(); if (jQuery.Browser.Mozilla) _music = LoadAudio("Audio/boss.ogg"); else _music = LoadAudio("Audio/boss.mp3"); Current = this; Status = ShooterStatus.Starting; BaseSpeed = 0.05f; _backgroundImage = LoadImage("Images/shooter/bg.png", false); AddSystem(new CloudSystem()); AddSystem(Meteor = new MeteorSystem()); AddSystem(Buildings = new BuildingSystem(700, _length, 3)); AddSystem(Dinos = new DinosSystem(_length)); AddSystem(_weapons = new WeaponsSystem()); AddSystem(Plasma = new PlasmaSystem()); AddSystem(Bonus = new BonusSystem()); ShowMessage(_startMessage); Window.SetTimeout(delegate() { HideMessage(); Status = ShooterStatus.Running; _music.Play(); _music.AddEventListener("ended", delegate(ElementEvent e) { _music.Play(); }, false); }, 3000); }
/// <summary> /// Initials new instance of account. /// </summary> /// <param name="bonusSystem">Bonus system.</param> public DefaultAccount(int id, BonusSystem bonusSystem, bool isClosed = false) : base(id, bonusSystem, isClosed) { }