public void UpdateDirection(CThucHanh pThucHanh, float pAngleZ)
        {
            float num = pAngleZ + 1.57079637f;

            num += pThucHanh.getAngleZ();
            CAct.NormAngle(ref num);
            this.UpdateDirection(num);
        }
        private void UpdateDirection(CThucHanh pThucHanh)
        {
            float num = this.angleZ + 1.57079637f;

            num += pThucHanh.getAngleZ();
            CAct.NormAngle(ref num);
            this.UpdateDirection(num);
        }
Exemple #3
0
        public static float GetAngleZ(Vector3 addvector)
        {
            float num = (float)Math.Atan2((double)addvector.Y, (double)addvector.X);

            num -= 1.57079637f;
            CAct.NormAngle(ref num);
            return(num);
        }
Exemple #4
0
 private void Calc2()
 {
     CAct.NormAngle(ref this.Obj.angleZ);
     this.rAngleZ = CAct.GetAngleZ(this.topos - this.Obj.Position) - this.Obj.angleZ;
     CAct.NormAngle(ref this.rAngleZ);
     if (this.rAngleZ > 3.14159274f)
     {
         this.rAngleZ -= 6.28318548f;
     }
 }
Exemple #5
0
 private void ResetAllScript()
 {
     for (int i = this.myMenu.scripts.Count - 1; i >= 0; i--)
     {
         CScript cScript = this.myMenu.scripts[i];
         for (int j = cScript.acts.Count - 1; j >= 0; j--)
         {
             CAct cAct = cScript.acts[j];
             cAct.Reset();
         }
     }
 }
        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;
        }
Exemple #7
0
 private void Calc2()
 {
     CAct.NormAngle(ref this.myThucHanh.angleZ);
     this.rAngleZ = this.angleZ - this.myThucHanh.angleZ;
     CAct.NormAngle(ref this.rAngleZ);
     if (this.rAngleZ > 3.14159274f)
     {
         this.rAngleZ -= 6.28318548f;
     }
     CAct.NormAngle(ref this.myThucHanh.angleX);
     this.rAngleX = this.angleX - this.myThucHanh.angleX;
     CAct.NormAngle(ref this.rAngleX);
     if (this.rAngleX > 3.14159274f)
     {
         this.rAngleX -= 6.28318548f;
     }
     this.rCenterX    = this.CenterX - this.myThucHanh.CenterX;
     this.rCenterY    = this.CenterY - this.myThucHanh.CenterY;
     this.rcameraPosY = this.cameraPos.Y - this.myThucHanh.cameraPos.Y;
 }
        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);
        }
Exemple #9
0
        private CScript GetScript(string pScrptfile)
        {
            CScript cScript = null;

            foreach (CScript current in this.scripts)
            {
                if (current.ScrptFile == pScrptfile)
                {
                    cScript = new CScript(current.myThucHanh, current.ScrptFile, current.StartTickCount, current.StopTickCount);
                    using (List <CAct> .Enumerator enumerator2 = current.acts.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            CAct current2 = enumerator2.Current;
                            CAct item     = (CAct)current2.Clone();
                            cScript.acts.Add(item);
                        }
                        break;
                    }
                }
            }
            return(cScript);
        }
Exemple #10
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;
             }
         }
     }
 }
        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);
        }
Exemple #12
0
 public override void Stop()
 {
     this.Obj.angleZ  = CAct.GetAngleZ(this.topos - this.Obj.Position);
     this.Obj.visible = true;
     base.endaction();
 }