private void OnEnable() { targetYoke = target as Yoke; // Instantiate undoManager UndoManager = new HOEditorUndoManager(targetYoke, "Yoke"); }
private void OnEnable() { targetYoke = target as Yoke; // Instantiate undoManager UndoManager = new HOEditorUndoManager( targetYoke, "Yoke" ); }
protected virtual void Start() { Debug.Assert(Config != null); Debug.Assert(_collider != null); Debug.Assert(_rigidBody2D != null); // here, we trigger our properties that have setters with bodies SkinWidth = _skinWidth; _enemyMask = Config.EnemyMask; _activeAttack = Config.DefaultAttack; MaxJumps = Config.MaxJumps; UpdateLayerCollision(); CharacterYoke = new Yoke(); Inventory.Initialise(this, Config.DefaultContents); _characterSprite.color = Config.SpriteTint; //Setup melee attack _meleeAttackEndTime = Time.time; _lastRangedAttackTime = Time.time; Debug.Assert(Config.MeleeAttackPrefab != null); _meleeAttack = Instantiate(Config.MeleeAttackPrefab, transform); Debug.Assert(_meleeAttack != null); _meleeAttack.SetActive(false); DamageSource meleeDamageSource = _meleeAttack.GetComponentInChildren <DamageSource>(); meleeDamageSource.Setup(this, Config.BaseMeleeDamage); meleeDamageSource.OnHit += OnMeleeHit; //Setup ranged attack _rangedAttackPool = new PrefabPool(Config.RangedAttackPrefab, 5, false, transform); //Setup dash attack _dashAttackHighlightSprite = _dashAttack.GetComponent <SpriteRenderer>(); _dashAttackHighlightSprite.color = Config.SpriteTint; _dashAttackCollider = _dashAttack.GetComponent <Collider2D>(); _dashAttackCollider.enabled = false; DamageSource dashDamageSource = _dashAttack.GetComponent <DamageSource>(); dashDamageSource.Setup(this, Config.DashAttackBaseDamage); dashDamageSource.OnHit += OnDashHit; _dashAttack.SetActive(false); }
public void Reset() { VictoryPoints = 0; Money = 0; NumberOfRounds = 0; ResidualMoney = 0; RemainingBonusActions = 0; Round = 1; Hand = new Hand(); VineDeck = new Deck <VineCard>(Hand, _vineCards); OrderDeck = new Deck <OrderCard>(Hand, _orderCards); AutomaDeck = new Deck <AutomaCard>(Hand, _automaCards); SummerVisitorDeck = new Deck <VisitorCard>(Hand, _visitorCards.Where(p => p.Season == Season.Summer)); WinterVisitorDeck = new Deck <VisitorCard>(Hand, _visitorCards.Where(p => p.Season == Season.Winter)); Yoke = new Yoke(_eventAggregator); Trellis = new Trellis(_eventAggregator); Cottage = new Cottage(_eventAggregator); Windmill = new Windmill(_eventAggregator); Irigation = new Irigation(_eventAggregator); LargeCellar = new LargeCellar(_eventAggregator); TastingRoom = new TastingRoom(_eventAggregator); MediumCellar = new MediumCellar(_eventAggregator); Field1 = new Field(_eventAggregator, 5); Field2 = new Field(_eventAggregator, 6); Field3 = new Field(_eventAggregator, 7); Grande = new Grande(_eventAggregator); NeutralWorker = new Worker(_eventAggregator); _workers = new List <Worker>(); for (var i = 0; i < 5; i++) { _workers.Add(new Worker(_eventAggregator)); } InitializeGrapes(out _redGrapes, GrapeColor.Red); InitializeGrapes(out _whiteGrapes, GrapeColor.White); InitializeWines(out _redWines, WineType.Red, 9); InitializeWines(out _whiteWines, WineType.White, 9); InitializeWines(out _blushWines, WineType.Blush, 6); InitializeWines(out _sparklingWines, WineType.Sparkling, 3); }
public void SetFromClone(GameState clone) { VictoryPoints = clone.VictoryPoints; Money = clone.Money; NumberOfRounds = clone.NumberOfRounds; ResidualMoney = clone.ResidualMoney; RemainingBonusActions = clone.RemainingBonusActions; Round = clone.Round; Hand.SetFromClone(clone.Hand, Entities); VineDeck.SetFromClone(clone.VineDeck, Entities); OrderDeck.SetFromClone(clone.OrderDeck, Entities); AutomaDeck.SetFromClone(clone.AutomaDeck, Entities); SummerVisitorDeck.SetFromClone(clone.SummerVisitorDeck, Entities); WinterVisitorDeck.SetFromClone(clone.WinterVisitorDeck, Entities); Yoke.SetFromClone(clone.Yoke, Entities); Trellis.SetFromClone(clone.Trellis, Entities); Cottage.SetFromClone(clone.Cottage, Entities); Windmill.SetFromClone(clone.Windmill, Entities); Irigation.SetFromClone(clone.Irigation, Entities); LargeCellar.SetFromClone(clone.LargeCellar, Entities); TastingRoom.SetFromClone(clone.TastingRoom, Entities); MediumCellar.SetFromClone(clone.MediumCellar, Entities); Field1.SetFromClone(clone.Field1, Entities); Field2.SetFromClone(clone.Field2, Entities); Field3.SetFromClone(clone.Field3, Entities); Grande.SetFromClone(clone.Grande, Entities); NeutralWorker.SetFromClone(clone.NeutralWorker, Entities); for (var i = 0; i < 5; i++) { _workers[i].SetFromClone(clone.Workers.ElementAt(i), Entities); } for (int i = 0; i < 9; i++) { _redGrapes[i].SetFromClone(clone._redGrapes[i], Entities); } for (int i = 0; i < 9; i++) { _whiteGrapes[i].SetFromClone(clone._whiteGrapes[i], Entities); } for (int i = 0; i < 9; i++) { _redWines[i].SetFromClone(clone._redWines[i], Entities); } for (int i = 0; i < 9; i++) { _whiteWines[i].SetFromClone(clone._whiteWines[i], Entities); } for (int i = 0; i < 6; i++) { _blushWines[i].SetFromClone(clone._blushWines[i], Entities); } for (int i = 0; i < 3; i++) { _sparklingWines[i].SetFromClone(clone._sparklingWines[i], Entities); } }
public GameState Clone() { var gameState = new GameState(); gameState.VictoryPoints = VictoryPoints; gameState.Money = Money; gameState.NumberOfRounds = NumberOfRounds; gameState.ResidualMoney = ResidualMoney; gameState.RemainingBonusActions = RemainingBonusActions; gameState.Round = Round; gameState.Hand = Hand.Clone() as Hand; gameState.VineDeck = VineDeck.Clone(); gameState.OrderDeck = OrderDeck.Clone(); gameState.AutomaDeck = AutomaDeck.Clone(); gameState.SummerVisitorDeck = SummerVisitorDeck.Clone(); gameState.WinterVisitorDeck = WinterVisitorDeck.Clone(); gameState.Yoke = Yoke.Clone() as Yoke; gameState.Trellis = Trellis.Clone() as Trellis; gameState.Cottage = Cottage.Clone() as Cottage; gameState.Windmill = Windmill.Clone() as Windmill; gameState.Irigation = Irigation.Clone() as Irigation; gameState.LargeCellar = LargeCellar.Clone() as LargeCellar; gameState.TastingRoom = TastingRoom.Clone() as TastingRoom; gameState.MediumCellar = MediumCellar.Clone() as MediumCellar; gameState.Field1 = Field1.Clone() as Field; gameState.Field2 = Field2.Clone() as Field; gameState.Field3 = Field3.Clone() as Field; gameState.Grande = Grande.Clone() as Grande; gameState.NeutralWorker = NeutralWorker.Clone() as Worker; gameState._workers = new List <Worker>(); for (var i = 0; i < 5; i++) { gameState._workers.Add(_workers[i].Clone() as Worker); } gameState._redGrapes = new List <Grape>(); foreach (var redGrape in _redGrapes) { gameState._redGrapes.Add(redGrape.Clone() as Grape); } gameState._whiteGrapes = new List <Grape>(); foreach (var whiteGrape in _whiteGrapes) { gameState._whiteGrapes.Add(whiteGrape.Clone() as Grape); } gameState._redWines = new List <Wine>(); foreach (var redWine in _redWines) { gameState._redWines.Add(redWine.Clone() as Wine); } gameState._whiteWines = new List <Wine>(); foreach (var whiteWine in _whiteWines) { gameState._whiteWines.Add(whiteWine.Clone() as Wine); } gameState._blushWines = new List <Wine>(); foreach (var blushWine in _blushWines) { gameState._blushWines.Add(blushWine.Clone() as Wine); } gameState._sparklingWines = new List <Wine>(); foreach (var sparklingWine in _sparklingWines) { gameState._sparklingWines.Add(sparklingWine.Clone() as Wine); } return(gameState); }