Exemple #1
0
        public void DoShoot(Vec3f start, Vec3f end, ProjInst proj)
        {
            proj.Destination = end;
            proj.Shooter     = this;

            Angles rotation = Angles.FromAtVector(end - start);
            var    p        = rotation.Pitch; // rotate arrow correctly

            rotation.Pitch = rotation.Roll;
            rotation.Yaw  -= Angles.PI / 2;
            rotation.Roll  = p;

            proj.Spawn(this.World, start, rotation);

            var          drawnWeapon = GetDrawnWeapon();
            ScriptAniJob job         = (drawnWeapon != null && drawnWeapon.ItemType == ItemTypes.WepXBow) ? AniCatalog.FightXBow.Reload : AniCatalog.FightBow.Reload;

            if (job != null && ModelInst.TryGetAniFromJob(job, out ScriptAni ani))
            {
                this.ModelInst.StartAniJob(job);
            }
        }
Exemple #2
0
        static void CheckCombineAim(NPCInst hero, Vec3f direction)
        {
            var gModel = hero.BaseInst.gModel;
            int aniID;

            if (gModel.IsAnimationActive("S_BOWAIM"))
            {
                aniID = gModel.GetAniIDFromAniName("S_BOWAIM");
            }
            else if (gModel.IsAnimationActive("S_CBOWAIM"))
            {
                aniID = gModel.GetAniIDFromAniName("S_CBOWAIM");
            }
            else
            {
                if (freeAim)
                {
                    crosshair.Hide();
                }
                return;
            }

            if (freeAim)
            {
                crosshair.Show();
            }

            Angles heroAngles = hero.GetAngles();
            Angles angles     = Angles.FromAtVector(direction);
            float  pitch      = Angles.Difference(angles.Pitch, heroAngles.Pitch);
            float  yaw        = Angles.Difference(angles.Yaw, heroAngles.Yaw);

            float x = 0.6f;// Alg.Clamp(0, 0.5f - yaw / Angles.PI, 1);
            float y = Alg.Clamp(0, 0.47f - (pitch < 0 ? 1.2f : 1.0f) * pitch / Angles.PI, 1);

            hero.BaseInst.gAI.InterpolateCombineAni(x, y, aniID);
        }
Exemple #3
0
 /// <summary> Sets the angles of this Vob via a directional vector. </summary>
 public void SetAtVector(Vec3f at)
 {
     SetAngles(Angles.FromAtVector(at));
 }