Beispiel #1
0
        /// <summary>
        /// ログを取る。
        /// </summary>
        /// <param name="targetCallback">ログを取る対象の処理。</param>
        public static void Logging(TargetCallback targetCallback)
        {
            /*
             * 参考。
             * https://dobon.net/vb/dotnet/programing/myapplicationlog.html
             * https://docs.microsoft.com/ja-jp/dotnet/api/microsoft.visualbasic.logging.filelogtracelistener?redirectedfrom=MSDN&view=netframework-4.7.2
             * https://dobon.net/vb/dotnet/file/filecopy.html
             * https://dobon.net/vb/dotnet/programing/tracelisteners.html
             */
            using (var fileLogTraceListener = new VBLogging.FileLogTraceListener("LogFile"))
            {
                // ディレクトリが無くても、自動で作成する。
                var logDirectory = "./logs";

                // 最初から設定されているリスナーを削除する。
                Trace.Listeners.Remove("Default");

                // ストリームを閉じるのを待たずに、書き込みを進める。
                fileLogTraceListener.AutoFlush               = true;
                fileLogTraceListener.Location                = VBLogging.LogFileLocation.Custom;
                fileLogTraceListener.CustomLocation          = logDirectory;
                fileLogTraceListener.BaseFileName            = "rotate";
                fileLogTraceListener.LogFileCreationSchedule = VBLogging.LogFileCreationScheduleOption.Daily;
                Trace.Listeners.Add(fileLogTraceListener);

                // コンソールにも出力するなら。
                Trace.Listeners.Add(new ConsoleTraceListener());

                targetCallback();

                // 古いログを削除する。
                OldLogRemover.RemoveOldLog(logDirectory);
            }
        }
 public InternalTarget( bool checkSkill, TargetCallback ok  )
     : base(8, false, TargetFlags.None)
 {
     AllowNonlocal = true;
     m_CheckSkill = checkSkill;
     m_OK = ok;
 }
Beispiel #3
0
    void SpawnLaser(TargetCallback target_callback)
    {
        HomingProjectile new_laser = Instantiate(laser, transform.position, Quaternion.identity);

        new_laser.SetSource(owner);
        new_laser.transform.position = transform.position;

        SoundManager.instance?.LocalPlaySfx(laser_sfx);

        Transform target = target_callback.target.stats.center_mass;

        new_laser.SetTarget(target_callback.target);
        new_laser.SetOnHit((character, b) => target_callback.success_callback(character));

        float   angle     = 0;
        Vector3 to_target = target.position - transform.position;

        if (to_target.x < 0)
        {
            angle = Vector2.SignedAngle(Vector2.left, to_target) + 180;
        }
        else
        {
            angle = Vector2.SignedAngle(Vector2.right, to_target);
        }

        new_laser.transform.rotation = Quaternion.Euler(0, 0, angle);
    }
            public InternalTarget(bool checkSkill, TargetCallback callback)
                : base(8, false, TargetFlags.None)
            {
                m_CheckSkill = checkSkill;
                m_Callback = callback;

                AllowNonlocal = true;
            }
            public InternalTarget(bool checkSkill, TargetCallback callback)
                : base(8, false, TargetFlags.None)
            {
                m_CheckSkill = checkSkill;
                m_Callback   = callback;

                AllowNonlocal = true;
            }
Beispiel #6
0
    public void ForEachTarget(TargetCallback callback)
    {
        int count = curTarget.Length;

        for (int i = 0; i < count; i++)
        {
            callback(curTarget[i]);
        }
    }
Beispiel #7
0
    /// <summary>
    /// Should only be called via Animation
    ///
    /// Searches Queue in order for a valid target to Shoot.
    /// Invokes callback for all failed targets.
    /// </summary>
    public void ShootQueuedLaser()
    {
        TargetCallback next_target = null;

        while (next_target == null && queue.Count != 0)
        {
            next_target = queue[0];
            queue.RemoveAt(0);
            if (next_target.target == null)
            {
                if (next_target.fail_callback != null)
                {
                    next_target.fail_callback.Invoke();
                }
                next_target = null;
            }
        }
        if (next_target != null)
        {
            SpawnLaser(next_target);
        }
        animator.SetBool("LasersQueued", queue.Count > 0);
    }
Beispiel #8
0
        public Target BeginTarget( int range, bool allowGround, TargetFlags flags, TargetCallback callback )
        {
            Target t = new SimpleTarget( range, flags, allowGround, callback );

            this.Target = t;

            return t;
        }
Beispiel #9
0
 public SimpleTarget( int range, TargetFlags flags, bool allowGround, TargetCallback callback )
     : base(range, allowGround, flags)
 {
     m_Callback = callback;
 }
 public InternalTarget(bool checkSkill, TargetCallback ok) :  base(8, false, TargetFlags.None)
 {
     AllowNonlocal = true;
     m_CheckSkill  = checkSkill;
     m_OK          = ok;
 }
Beispiel #11
0
 public SimpleTarget(int range, TargetFlags flags, bool allowGround, TargetCallback callback)
     : base(range, allowGround, flags) =>
Beispiel #12
0
        public static Target BeginTarget(this Mobile m, int range, bool allowGround, TargetFlags flags, TargetCallback callback)
        {
            Target t = new SimpleTarget(range, flags, allowGround, callback);

            m.Target = t;

            return(t);
        }
Beispiel #13
0
 public void SetTargetHandler(TargetCallback callback)
 {
     targetCallback = callback;
 }
Beispiel #14
0
 public AuctionTarget(TargetCallback callback)
     : base(1, false, TargetFlags.None)
 {
     m_callback = callback;
 }