예제 #1
0
        private void onPieceHealthChanged(PieceHealthChangeModel phcm)
        {
            var piece = CopyPiece(pieces.Piece(phcm.pieceId));
            //should be encapsulated under some other event, but could be from an event or deathrattle
            var currentItem = GetCurrent(phcm.activatingPieceId, HistoryItemType.Event, piece.playerId);

            if (currentItem.triggeringPiece == null && phcm.activatingPieceId.HasValue)
            {
                currentItem.triggeringPiece = CopyPiece(pieces.Piece(phcm.activatingPieceId.Value));
            }

            currentItem.pieceChanges.Add(new HistoryHealthChange()
            {
                type = HistoryPieceChangeType.HealthChange,
                originalPiece = piece,
                healthChange = phcm
            });
        }
예제 #2
0
        public void onHealthChange(PieceHealthChangeModel hpChange)
        {
            var piece = pieces.Piece(hpChange.pieceId);
            if(piece == null) return;

            var view = piece.pieceView;
            view.piece.health = hpChange.newCurrentHealth;

            var numberSplat = loader.Load<GameObject>("NumberSplat");
            animationQueue.Add(
                new PieceView.TakeDamageAnim()
                {
                    parent = piece.pieceView.faceCameraContainer.transform,
                    bonus = hpChange.bonus,
                    bonusMsg = hpChange.bonusMsg,
                    numberSplat = numberSplat,
                    change = hpChange.change
                }
            );

            animationQueue.Add(
                new PieceView.UpdateTextAnim()
                {
                    text = view.healthText,
                    textGO = view.healthGO,
                    current = view.piece.health,
                    original = view.piece.baseHealth,
                    change = hpChange.change,
                    animFinished = pieceTextAnimFinished,
                    piece = view.piece
                }
            );

            if (hpChange.armorChange != 0)
            {
                animationQueue.Add(
                    new PieceView.UpdateArmorAnim()
                    {
                        text = view.armorText,
                        textGO = view.armorGO,
                        textBG = view.armorBG,
                        current = view.piece.armor,
                        change = hpChange.armorChange,
                        piece = view.piece
                    }
                );
            }

            animationQueue.Add(
                new PieceView.UpdateHpBarAnim()
                {
                    piece = view
                }
            );
        }