Exemplo n.º 1
0
        private void DeleteAllFiguresAndClearScript()
        {
            CCTotemPole script = this.Script;

            this.Script = null;
            for (int i = this.Configuration.numRequiredTotemicFigures - 1; i >= 0; i--)
            {
                CCTotem.TotemicFigure totemicFigures = this.TotemicFigures[i];
                if (!object.ReferenceEquals(totemicFigures, null))
                {
                    if (totemicFigures.TotemPole != this)
                    {
                        this.TotemicFigures[i] = null;
                    }
                    else
                    {
                        this.TotemicFigures[i].Delete(script);
                    }
                }
            }
            CCTotem.DestroyCCDesc(script, ref this.CCDesc);
            if (script && object.ReferenceEquals(script.totemicObject, this))
            {
                script.totemicObject = null;
            }
        }
Exemplo n.º 2
0
 public Direction(CCTotem.TotemicFigure TotemicFigure)
 {
     if (object.ReferenceEquals(TotemicFigure, null))
     {
         throw new ArgumentNullException("TotemicFigure");
     }
     this.TotemicFigure = TotemicFigure;
     this.Exists        = true;
 }
Exemplo n.º 3
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);
        }
Exemplo n.º 4
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));
        }