示例#1
0
 internal TotemPole(ref CCTotem.Configuration TotemConfiguration)
 {
     this.Configuration     = TotemConfiguration;
     this.TotemicFigures    = new CCTotem.TotemicFigure[8];
     this.TotemicFigureEnds = CCTotem.TotemicFigure.CreateAllTotemicFigures(this);
     this.Contraction       = CCTotem.Contraction.Define(this.Configuration.poleContractedHeight, this.Configuration.poleExpandedHeight);
 }
示例#2
0
 public bool UpdateConfiguration()
 {
     this.LastException = null;
     CCTotem.Initialization members = this.Members;
     try
     {
         this.LastGoodConfiguration    = new CCTotem.Configuration(ref members);
         this.HasLastGoodConfiguration = true;
         return(true);
     }
     catch (ArgumentException exception)
     {
         this.LastException = exception;
         return(false);
     }
 }
示例#3
0
    public bool UpdateConfiguration()
    {
        bool flag;

        this.LastException = null;
        CCTotem.Initialization members = this.Members;
        try
        {
            this.LastGoodConfiguration    = new CCTotem.Configuration(ref members);
            this.HasLastGoodConfiguration = true;
            flag = true;
        }
        catch (ArgumentException argumentException)
        {
            this.LastException = argumentException;
            flag = false;
        }
        return(flag);
    }
示例#4
0
    public bool SmudgeTo(Vector3 worldSkinnedBottom)
    {
        Vector3 vector3  = new Vector3();
        Vector3 vector31 = new Vector3();

        if (!this.Exists)
        {
            return(false);
        }
        Vector3 vector32 = base.transform.position;

        if (vector32 == worldSkinnedBottom)
        {
            return(true);
        }
        Vector3 vector33 = worldSkinnedBottom - vector32;
        CCDesc  cCDesc   = this.totemicObject.CCDesc;

        if (!cCDesc)
        {
            return(false);
        }
        float single  = 0f;
        float single1 = single;

        vector3.z = single;
        vector3.x = single1;
        vector3.y = cCDesc.effectiveHeight * 0.5f - cCDesc.radius;
        Vector3 vector34 = cCDesc.center;
        Vector3 world    = cCDesc.OffsetToWorld(vector34 - vector3);
        Vector3 world1   = cCDesc.OffsetToWorld(vector34 + vector3);
        Vector3 world2   = cCDesc.OffsetToWorld(vector34 + new Vector3(cCDesc.skinnedRadius, 0f, 0f)) - cCDesc.worldCenter;
        float   single2  = world2.magnitude;
        float   single3  = vector33.magnitude;
        float   single4  = 1f / single3;

        vector31.x = vector33.x * single4;
        vector31.y = vector33.y * single4;
        vector31.z = vector33.z * single4;
        int num  = 0;
        int num1 = base.gameObject.layer;

        for (int i = 0; i < 32; i++)
        {
            if (!Physics.GetIgnoreLayerCollision(num1, i))
            {
                num = num | 1 << (i & 31 & 31);
            }
        }
        if (Physics.CapsuleCast(world, world1, single2, vector31, single3, num))
        {
            return(false);
        }
        Transform transforms = this.totemicObject.CCDesc.transform;

        transforms.position = transforms.position + vector33;
        for (int j = 0; j < this.totemicObject.Configuration.numRequiredTotemicFigures; j++)
        {
            Transform cCDesc1 = this.totemicObject.TotemicFigures[j].CCDesc.transform;
            cCDesc1.position = cCDesc1.position + vector33;
        }
        Vector3 cCDesc2 = this.totemicObject.CCDesc.worldSkinnedBottom;
        Vector3 cCDesc3 = this.totemicObject.CCDesc.worldSkinnedTop;
        Vector3 cCDesc4 = this.totemicObject.CCDesc.transform.position;

        CCTotem.Configuration configuration = this.totemicObject.Configuration;
        this.BindPositions(new CCTotem.PositionPlacement(cCDesc2, cCDesc3, cCDesc4, configuration.poleExpandedHeight));
        return(true);
    }
示例#5
0
        public CCTotem.MoveInfo Move(Vector3 motion, float height)
        {
            CCTotem.Expansion expansion = this.Contraction.ExpansionForValue(height);
            height = expansion.Value;
            CollisionFlags collisionFlagsMask = this.TotemicFigureEnds.Bottom.MoveSweep(motion) & this.TotemicFigureEnds.Bottom.CollisionFlagsMask;

            this.grounded = this.TotemicFigureEnds.Bottom.CCDesc.isGrounded;
            int num = 0;

            for (int i = this.Configuration.numRequiredTotemicFigures - 1; i >= 1; i--)
            {
                Vector3 sweepMovement = this.TotemicFigures[num].SweepMovement;
                collisionFlagsMask = collisionFlagsMask | this.TotemicFigures[i].MoveSweep(sweepMovement) & this.TotemicFigures[i].CollisionFlagsMask;
                num = i;
            }
            if (this.TotemicFigures[num].SweepMovement != this.TotemicFigures[0].SweepMovement)
            {
                Vector3 vector3 = this.TotemicFigures[num].SweepMovement;
                for (int j = 0; j < this.Configuration.numRequiredTotemicFigures; j++)
                {
                    Vector3 sweepMovement1 = vector3 - this.TotemicFigures[j].SweepMovement;
                    collisionFlagsMask = collisionFlagsMask | this.TotemicFigures[j].MoveSweep(sweepMovement1) & this.TotemicFigures[j].CollisionFlagsMask;
                }
            }
            this.Point.Bottom = this.TotemicFigures[0].BottomOrigin;
            CCTotem.Ends <CCTotem.TotemicFigure> totemicFigureEnds = this.TotemicFigureEnds;
            this.Point.Top = totemicFigureEnds.Top.TopOrigin;
            CCTotem.Contraction contraction = this.Contraction;
            this.Expansion = contraction.ExpansionForValue(this.Point.Top.y - this.Point.Bottom.y);
            if (this.Expansion.Value != expansion.Value)
            {
                Vector3        bottom                    = this.Point.Bottom + new Vector3(0f, expansion.Value, 0f);
                CollisionFlags collisionFlag             = this.TotemicFigureEnds.Top.MoveWorldTopTo(bottom);
                CCTotem.Ends <CCTotem.TotemicFigure> end = this.TotemicFigureEnds;
                collisionFlagsMask = collisionFlagsMask | collisionFlag & end.Top.CollisionFlagsMask;
                Vector3             topOrigin    = this.TotemicFigureEnds.Top.TopOrigin;
                CCTotem.Contraction contraction1 = this.Contraction;
                expansion = contraction1.ExpansionForValue(topOrigin.y - this.Point.Bottom.y);
                for (int k = this.Configuration.numRequiredTotemicFigures - 2; k > 0; k--)
                {
                    CCTotem.TotemicFigure totemicFigures = this.TotemicFigures[k];
                    Vector3           value      = this.Point.Bottom;
                    float             single     = value.y;
                    CCTotem.Expansion expansion1 = totemicFigures.TotemContractionBottom.ExpansionForFraction(expansion.FractionExpanded);
                    value.y            = single + expansion1.Value;
                    collisionFlagsMask = collisionFlagsMask | totemicFigures.MoveWorldBottomTo(value) & totemicFigures.CollisionFlagsMask;
                }
                CCTotem.Ends <CCTotem.TotemicFigure> totemicFigureEnds1 = this.TotemicFigureEnds;
                this.Point.Top = totemicFigureEnds1.Top.TopOrigin;
                this.Expansion = expansion;
            }
            float   cCDesc       = this.CCDesc.effectiveSkinnedHeight;
            Vector3 cCDesc1      = this.CCDesc.worldSkinnedBottom;
            Vector3 vector31     = this.CCDesc.worldSkinnedTop;
            Vector3 bottomOrigin = this.TotemicFigures[0].BottomOrigin - cCDesc1;

            this.CCDesc.ModifyHeight(this.Expansion.Value, false);
            CollisionFlags collisionFlag1 = this.CCDesc.Move(bottomOrigin);
            Vector3        cCDesc2        = this.CCDesc.worldSkinnedBottom;
            Vector3        vector32       = cCDesc2 - cCDesc1;

            if (bottomOrigin != vector32)
            {
                Vector3 vector33 = vector32 - bottomOrigin;
                for (int l = 0; l < this.Configuration.numRequiredTotemicFigures; l++)
                {
                    collisionFlagsMask = collisionFlagsMask | this.TotemicFigures[l].MoveSweep(vector33) & this.TotemicFigures[l].CollisionFlagsMask;
                }
                this.Point.Bottom = this.TotemicFigures[0].BottomOrigin;
                CCTotem.Ends <CCTotem.TotemicFigure> end1 = this.TotemicFigureEnds;
                this.Point.Top = end1.Top.TopOrigin;
                CCTotem.Contraction contraction2 = this.Contraction;
                this.Expansion = contraction2.ExpansionForValue(this.Point.Top.y - this.Point.Bottom.y);
                this.CCDesc.ModifyHeight(this.Expansion.Value, false);
                cCDesc2  = this.CCDesc.worldSkinnedBottom;
                vector32 = cCDesc2 - cCDesc1;
            }
            Vector3 cCDesc3  = this.CCDesc.worldSkinnedTop;
            Vector3 vector34 = cCDesc3 - vector31;
            Vector3 cCDesc4  = this.CCDesc.transform.position;

            CCTotem.Configuration     configuration     = this.Configuration;
            CCTotem.PositionPlacement positionPlacement = new CCTotem.PositionPlacement(cCDesc2, cCDesc3, cCDesc4, configuration.poleExpandedHeight);
            return(new CCTotem.MoveInfo(collisionFlag1, collisionFlagsMask, height, vector32, vector34, positionPlacement));
        }