示例#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;
 }
示例#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;
            }
示例#6
0
    public void ForEachTarget(TargetCallback callback)
    {
        int count = curTarget.Length;

        for (int i = 0; i < count; i++)
        {
            callback(curTarget[i]);
        }
    }
示例#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);
    }
示例#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;
        }
示例#9
0
 public SimpleTarget( int range, TargetFlags flags, bool allowGround, TargetCallback callback )
     : base(range, allowGround, flags)
 {
     m_Callback = callback;
 }
示例#10
0
 public InternalTarget(bool checkSkill, TargetCallback ok) :  base(8, false, TargetFlags.None)
 {
     AllowNonlocal = true;
     m_CheckSkill  = checkSkill;
     m_OK          = ok;
 }
示例#11
0
 public SimpleTarget(int range, TargetFlags flags, bool allowGround, TargetCallback callback)
     : base(range, allowGround, flags) =>
示例#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);
        }
示例#13
0
 public void SetTargetHandler(TargetCallback callback)
 {
     targetCallback = callback;
 }
示例#14
0
 public AuctionTarget(TargetCallback callback)
     : base(1, false, TargetFlags.None)
 {
     m_callback = callback;
 }