コード例 #1
0
        protected virtual void Calc2()
        {
            this.setfrompos();
            this.addvector = this.topos - this.frompos;
            float num   = this.addvector.Length();
            float right = this.SpriteObj.Length / (num * 2f);

            this.from2.Position   = this.frompos + this.addvector * right;
            this.to2.Position     = this.topos - this.addvector * right;
            this.from2.TickCount  = 0;
            this.to2.TickCount    = (int)(this.speed * 1000f);
            this.SpriteObj.angleZ = CAct.GetAngleZ(this.addvector);
            this.SpriteObj.angleX = CAct.GetAngleX(this.addvector);
            this.addvector        = this.to2.Position - this.from2.Position;
        }
コード例 #2
0
        protected virtual void Calc2()
        {
            this.setfrompos();
            float z = this.myThucHanh.myTerrain.getZ(this.from2.Position.X, this.from2.Position.Y);

            if (this.from2.Position.Z == 0f)
            {
                this.from2.Position.Z = z;
            }
            if (this.from2.Position.Z >= z)
            {
                CTarget expr_7D_cp_0 = this.from2;
                expr_7D_cp_0.Position.Z = expr_7D_cp_0.Position.Z - 0.4f;
            }
            this.from2.TickCount = this.to2.TickCount;
            Vector3 addvector = this.to2.Position - this.from2.Position;

            this.to2.TickCount   += this.tickcount;
            this.SpriteObj.angleZ = CAct.GetAngleZ(addvector);
            this.SpriteObj.angleX = CAct.GetAngleX(addvector);
        }
コード例 #3
0
 private void SetTickCount()
 {
     if (this.targetsCount > 1)
     {
         for (int i = 1; i < this.targetsCount; i++)
         {
             Vector3 addvector = this.targets[i].Position - this.targets[i - 1].Position;
             this.targets[i].len = addvector.Length();
             this.ftotallen     += this.targets[i].len;
             if (this.targets[i].len > 0f)
             {
                 this.targets[i].angleZ = CAct.GetAngleZ(addvector);
                 this.targets[i].angleX = CAct.GetAngleX(addvector);
             }
             else
             {
                 this.targets[i].angleZ = this.targets[i - 1].angleZ;
                 this.targets[i].angleX = this.targets[i - 1].angleX;
             }
         }
         this.targets[0].TickCount = 0;
         float num = 0f;
         for (int j = 1; j < this.targetsCount; j++)
         {
             num += this.targets[j].len;
             if (this.ftotallen > 0f)
             {
                 this.targets[j].TickCount = (int)Math.Floor((double)(num * (float)this.duration) / (double)this.ftotallen);
             }
             else
             {
                 this.targets[j].TickCount = this.duration;
             }
         }
     }
 }
コード例 #4
0
        private void GetOrbit(Vector3 pFrom, Vector3 pTo)
        {
            Vector3 right  = new Vector3(this.frompos.X, this.frompos.Y, this.topos.Z);
            Vector3 vector = this.topos - right;
            float   num    = vector.Length();
            float   angleZ = CAct.GetAngleZ(vector);

            vector.Z = (float)Math.Tan((double)this.rAngle) * num;
            int num2 = (int)(this.topos - this.frompos).Length();

            this.targets = new List <CTarget>();
            double num3   = (double)(vector.Z - (pTo.Z - pFrom.Z));
            float  valueZ = 0f;

            if (num2 > 0)
            {
                valueZ = -(float)(num3 * 2.0 / (double)(num2 * (num2 + 1)));
            }
            Vector3 vector2 = vector * (1f / (float)num2);
            Vector3 right2  = new Vector3(0f, 0f, valueZ);
            Vector3 vector3 = pFrom;
            CTarget cTarget = new CTarget();

            cTarget.Position  = vector3;
            cTarget.TickCount = 0;
            cTarget.angleZ    = angleZ;
            cTarget.angleX    = CAct.GetAngleX(vector2);
            this.targets.Add(cTarget);
            if (num2 > 1)
            {
                float num4 = 0f;
                for (int i = 1; i < num2; i++)
                {
                    vector2         += right2;
                    vector3         += vector2;
                    cTarget          = new CTarget();
                    cTarget.Position = vector3;
                    cTarget.angleZ   = angleZ;
                    cTarget.angleX   = CAct.GetAngleX(vector2);
                    this.targets.Add(cTarget);
                    this.targets[i].len = (this.targets[i].Position - this.targets[i - 1].Position).Length();
                    num4 += this.targets[i].len;
                }
                this.targetsCount = num2;
                float num5 = 0f;
                for (int j = 1; j < this.targetsCount; j++)
                {
                    num5 += this.targets[j].len;
                    if (num4 > 0f)
                    {
                        this.targets[j].TickCount = (int)(num5 * (float)this.interval / num4);
                    }
                    else
                    {
                        this.targets[j].TickCount = this.interval;
                    }
                }
                return;
            }
            cTarget           = new CTarget();
            cTarget.Position  = this.topos;
            cTarget.TickCount = 0;
            cTarget.angleZ    = angleZ;
            cTarget.angleX    = CAct.GetAngleX(vector2);
            this.targets.Add(cTarget);
        }