Beispiel #1
0
        private CCTotemicFigure InstantiateTotemicFigure(Vector3 worldBottom, CCTotem.TotemicFigure target)
        {
            float single = worldBottom.y;

            CCTotem.Expansion expansion = target.TotemContractionBottom.ExpansionForFraction(this.Expansion.FractionExpanded);
            worldBottom.y = single + expansion.Value;
            target.CCDesc = this.InstantiateCCDesc(worldBottom, string.Format("__TotemicFigure{0}", target.BottomUpIndex));
            CCTotemicFigure cCTotemicFigure = target.CCDesc.gameObject.AddComponent <CCTotemicFigure>();

            cCTotemicFigure.AssignTotemicObject(target);
            if (this.Script)
            {
                this.Script.ExecuteBinding(target.CCDesc, true);
            }
            return(cCTotemicFigure);
        }
Beispiel #2
0
 public CCTotem.Expansion ExpansionForValue(float Value)
 {
     CCTotem.Expansion expansion;
     if (Value <= this.Contracted)
     {
         expansion = new CCTotem.Expansion(this.Contracted, 0f, 0f);
     }
     else if (Value < this.Expanded)
     {
         float value = Value - this.Contracted;
         float range = value / this.Range;
         expansion = new CCTotem.Expansion(Value, range, value);
     }
     else
     {
         expansion = new CCTotem.Expansion(this.Expanded, 1f, this.Range);
     }
     return(expansion);
 }
Beispiel #3
0
 public CCTotem.Expansion ExpansionForFraction(float FractionExpanded)
 {
     CCTotem.Expansion expansion;
     if (FractionExpanded <= 0f)
     {
         expansion = new CCTotem.Expansion(this.Contracted, 0f, 0f);
     }
     else if (FractionExpanded < 1f)
     {
         float fractionExpanded = FractionExpanded * this.Range;
         float contracted       = this.Contracted + fractionExpanded;
         expansion = new CCTotem.Expansion(contracted, FractionExpanded, fractionExpanded);
     }
     else
     {
         expansion = new CCTotem.Expansion(this.Expanded, 1f, this.Range);
     }
     return(expansion);
 }
Beispiel #4
0
 public CCTotem.Expansion ExpansionForAmount(float Amount)
 {
     CCTotem.Expansion expansion;
     if (Amount <= 0f)
     {
         expansion = new CCTotem.Expansion(this.Contracted, 0f, 0f);
     }
     else if (Amount < this.Range)
     {
         float amount     = Amount / this.Range;
         float contracted = this.Contracted + Amount;
         expansion = new CCTotem.Expansion(contracted, amount, Amount);
     }
     else
     {
         expansion = new CCTotem.Expansion(this.Expanded, 1f, this.Range);
     }
     return(expansion);
 }
Beispiel #5
0
        public void Create()
        {
            float configuration = this.Configuration.totem.initialHeight;

            this.Expansion = this.Contraction.ExpansionForValue(configuration);
            Vector3 script = this.Script.transform.position + this.Configuration.figureOriginOffsetBottom;

            this.CCDesc = this.InstantiateCCDesc(script, "__TotemPole");
            if (this.Script)
            {
                this.Script.ExecuteBinding(this.CCDesc, true);
            }
            for (int i = 0; i < this.Configuration.numRequiredTotemicFigures; i++)
            {
                this.InstantiateTotemicFigure(script, this.TotemicFigures[i]);
            }
            this.Point.Bottom = this.TotemicFigures[0].BottomOrigin;
            CCTotem.Ends <CCTotem.TotemicFigure> totemicFigureEnds = this.TotemicFigureEnds;
            this.Point.Top = totemicFigureEnds.Top.TopOrigin;
            this.CCDesc.ModifyHeight(this.Point.Top.y - this.Point.Bottom.y, false);
        }
Beispiel #6
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));
        }