コード例 #1
0
ファイル: Barrier.cs プロジェクト: mts508/Artemis
    private void InitBarrier(
        int guid,
        string name,
        Vector3 center,
        Vector3 facingDir,
        float width,
        bool bidirectional,
        BlockingRules blocksVision,
        BlockingRules blocksAbilities,
        BlockingRules blocksMovement,
        BlockingRules blocksMovementOnCrossover,
        BlockingRules blocksPositionTargeting,
        bool considerAsCover,
        int maxDuration,
        ActorData owner,
        List <GameObject> barrierSequencePrefabs,
        bool playSequences,
        GameplayResponseForActor onEnemyMovedThrough,
        GameplayResponseForActor onAllyMovedThrough,
        int maxHits,
        bool endOnCasterDeath,
        SequenceSource parentSequenceSource,
        Team barrierTeam)
    {
        m_guid          = guid;
        m_name          = name;
        m_center        = center;
        m_facingDir     = facingDir;
        m_bidirectional = bidirectional;
        Vector3 a = Vector3.Cross(facingDir, Vector3.up);

        a.Normalize();
        float d = width * Board.Get().squareSize;

        m_endpoint1               = center + a * d / 2f;
        m_endpoint2               = center - a * d / 2f;
        BlocksVision              = blocksVision;
        BlocksAbilities           = blocksAbilities;
        BlocksMovement            = blocksMovement;
        BlocksMovementOnCrossover = blocksMovementOnCrossover;
        BlocksPositionTargeting   = blocksPositionTargeting;
        m_considerAsCover         = considerAsCover;
        m_owner                  = owner;
        m_team                   = m_owner?.GetTeam() ?? barrierTeam;
        m_time                   = new EffectDuration();
        m_time.duration          = maxDuration;
        m_barrierSequencePrefabs = barrierSequencePrefabs;
        m_playSequences          = playSequences && m_barrierSequencePrefabs != null;
        m_barrierSequences       = new List <Sequence>();
        if (m_playSequences)
        {
            BarrierSequenceSource = new SequenceSource(null, null, false, parentSequenceSource);
        }
        m_maxHits = maxHits;

        // added
        m_onEnemyMovedThrough = onEnemyMovedThrough;
        m_onAllyMovedThrough  = onAllyMovedThrough;
        m_endOnCasterDeath    = endOnCasterDeath;
    }
コード例 #2
0
 public void DeserializeAsset(AssetFile assetFile, StreamReader stream)
 {
     m_width                               = stream.ReadSingle();                                            // float32
     m_bidirectional                       = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_blocksVision                        = (BlockingRules)stream.ReadInt32();                              // valuetype BlockingRules
     m_blocksAbilities                     = (BlockingRules)stream.ReadInt32();                              // valuetype BlockingRules
     m_blocksMovement                      = (BlockingRules)stream.ReadInt32();                              // valuetype BlockingRules
     m_blocksMovementOnCrossover           = (BlockingRules)stream.ReadInt32();                              // valuetype BlockingRules
     m_blocksPositionTargeting             = (BlockingRules)stream.ReadInt32();                              // valuetype BlockingRules
     m_considerAsCover                     = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_maxDuration                         = stream.ReadInt32();                                             // int32
     m_barrierSequencePrefabs              = new SerializedVector <SerializedGameObject>(assetFile, stream); // class [mscorlib]System.Collections.Generic.List`1<class [UnityEngine]UnityEngine.GameObject>
     m_onEnemyMovedThrough                 = new GameplayResponseForActor(assetFile, stream);                // class GameplayResponseForActor
     m_onAllyMovedThrough                  = new GameplayResponseForActor(assetFile, stream);                // class GameplayResponseForActor
     m_removeAtTurnEndIfEnemyMovedThrough  = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_removeAtTurnEndIfAllyMovedThrough   = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_removeAtPhaseEndIfEnemyMovedThrough = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_removeAtPhaseEndIfAllyMovedThrough  = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_maxHits                             = stream.ReadInt32();                                             // int32
     m_endOnCasterDeath                    = stream.ReadBoolean(); stream.AlignTo();                         // bool
     m_responseOnShotBlock                 = new BarrierResponseOnShot(assetFile, stream);                   // class BarrierResponseOnShot
 }