Пример #1
0
        private void DoShoot(MouseState ms)
        {
            if (CurrentWorld.GetCurrentTimeInMilliseconds() - _lastShot > _cooldown)
            {
                ImmovableTerrain o = HelperIntersection.IsMouseCursorOnAny <ImmovableTerrain>(ms, out Vector3 intersectionPoint, 0, 16);
                Vector3          target;
                if (o != null)
                {
                    target = intersectionPoint;
                }
                else
                {
                    target = HelperIntersection.GetMouseIntersectionPoint(ms, Plane.Camera, -50, 35, 5);
                }

                ShotTerrain s = new ShotTerrain();
                s.SetModel("KWSphere");
                s.SetScale(0.25f);
                s.SetColor(0, 0, 1);
                s.SetGlow(0, 0, 1, 0.25f);
                s.IsCollisionObject = true;
                s.SetPosition(GetCenterPointForAllHitboxes() + GetLookAtVector() * 0.25f);
                s.TurnTowardsXYZ(target);

                CurrentWorld.AddGameObject(s);
                _lastShot = CurrentWorld.GetCurrentTimeInMilliseconds();
            }
        }