Ejemplo n.º 1
0
 protected override void Start()
 {
     AtTarget += AtPoint;
     FriendlyList.Add(name);
     DialogManager.Instance.CloseClicked += RunAway;
     base.Start();
 }
Ejemplo n.º 2
0
    protected override void Start()
    {
        AtTarget += AttackTarget;
        FriendlyList.Add(name);

        base.Start();
    }
Ejemplo n.º 3
0
 void FixedUpdate()
 {
     if (Target == null)
     {
         agent.SetDestination(StartPos);
         if (agent.remainingDistance > agent.stoppingDistance)
         {
             Anim.SetBool("Running", true);
         }
         else
         {
             Anim.SetBool("Running", false);
         }
         Hit = Physics.OverlapSphere(transform.position, SpottingDistance, layerMask);
         foreach (Collider target in Hit)
         {
             if (target.gameObject != this.gameObject && target.tag == "NPC" && !FriendlyList.Contains(target.name))
             {
                 if (!FriendlyList.Contains(target.name))
                 {
                     ReturnToPosition = false;
                     Target           = target.transform;
                     EquippedHammer.SetActive(true);
                     UnEquippedHammer.SetActive(false);
                     break;
                 }
             }
         }
     }
     else if (Target != null)
     {
         if (!IsAtTarget)
         {
             agent.SetDestination(Target.position);
         }
         if (agent.remainingDistance > agent.stoppingDistance)
         {
             Anim.SetBool("Running", true);
             IsAtTarget = false;
             float Distance = Vector3.Distance(transform.position, Target.position);
             if (Distance > 25)
             {
                 EnemyDied(null);
             }
         }
         else if (!IsAtTarget && agent.remainingDistance > 0.1f)
         {
             IsAtTarget = true;
             Anim.SetBool("Running", false);
             AtTarget();
         }
     }
 }
Ejemplo n.º 4
0
 protected new void Start()
 {
     AtTarget += AttackTarget;
     FriendlyList.Add(name);
     Commander = Level1Manager.Instance.NPCtoKill.transform;
     Level1Manager.Instance.KillRaiders += KillRaider;
     base.Start();
     if (!PreEnemy)
     {
         gameObject.SetActive(false);
     }
 }
Ejemplo n.º 5
0
 protected override void Start()
 {
     if (!IsBoss)
     {
         AtTarget += AttackTarget;
         FriendlyList.Add(name);
         if (!IsCommander)
         {
             Level1Manager.Instance.KillRaiders += KillKnights;
         }
     }
     base.Start();
 }
Ejemplo n.º 6
0
 void FixedUpdate()
 {
     if (Target == null)
     {
         agent.SetDestination(StartPos);
         if (agent.remainingDistance > agent.stoppingDistance)
         {
             Anim.SetBool("Running", true);
         }
         else
         {
             Anim.SetBool("Running", false);
         }
         Hit = Physics.OverlapSphere(transform.position, SpottingDistance, layerMask);
         foreach (Collider target in Hit)
         {
             if (target.gameObject != this.gameObject && target.tag == "NPC")
             {
                 if (!FriendlyList.Contains(target.name))
                 {
                     ReturnToPosition = false;
                     Target           = target.transform;
                     //if (target.name != "Player")
                     //   target.GetComponent<BaseNPC>().OnDeath += EnemyDied;
                     EquippedHammer.SetActive(true);
                     UnEquippedHammer.SetActive(false);
                     break;
                 }
             }
         }
     }
     else if (Target != null)
     {
         agent.SetDestination(Target.position);
         if (agent.remainingDistance > agent.stoppingDistance)
         {
             //agent.isStopped = false;
             Anim.SetBool("Running", true);
             IsAtTarget = false;
         }
         else if (!IsAtTarget && agent.remainingDistance > 0.1f)
         {
             IsAtTarget = true;
             //agent.isStopped = true;
             Anim.SetBool("Running", false);
             //transform.LookAt(Target);
             AtTarget();
         }
     }
 }
Ejemplo n.º 7
0
    void FixedUpdate()
    {
        if (IsFrozen)
        {
            return;
        }
        if (Target == null)
        {
            agent.SetDestination(Commander.position);
            Hit = Physics.OverlapSphere(transform.position, SpottingDistance, layerMask);
            foreach (Collider target in Hit)
            {
                if (target.gameObject != this.gameObject && target.tag == "NPC" && !FriendlyList.Contains(target.name))
                {
                    if (target.gameObject.name != "Player" && !target.GetComponent <BaseNPC>().HasTarget || target.name == "Commander")
                    {
                        target.GetComponent <BaseNPC>().HasTarget = true;
                        Target = target.transform;

                        break;
                    }
                }
            }
        }
        else if (Target != null)
        {
            agent.SetDestination(Target.position);
            if (agent.remainingDistance > agent.stoppingDistance)
            {
                //agent.isStopped = false;
                Anim.SetBool("Running", true);
                IsAtTarget = false;
            }
            else if (!IsAtTarget && agent.remainingDistance > 0.1f)
            {
                IsAtTarget = true;
                //agent.isStopped = true;
                Anim.SetBool("Running", false);
                //transform.LookAt(Target);
                AtTarget();
            }
        }
    }
Ejemplo n.º 8
0
 private void Roam()
 {
     agent.speed = WalkSpeed;
     if (Roaming)
     {
         agent.SetDestination(WalkToPoint);
         if (agent.remainingDistance > agent.stoppingDistance)
         {
             Anim.SetBool(RoamingAnim, true);
         }
         else if (agent.remainingDistance > 0.1f)
         {
             Anim.SetBool(RoamingAnim, false);
             Roaming = false;
         }
         Hit = Physics.OverlapSphere(transform.position, SpottingDistance, layerMask);
         foreach (Collider target in Hit)
         {
             if (target.gameObject != this.gameObject && target.tag == "NPC" && !FriendlyList.Contains(target.name))
             {
                 if (!FriendlyList.Contains(target.name))
                 {
                     Target = target.transform;
                     break;
                 }
             }
         }
     }
     else
     {
         if (Physics.Raycast(Spawner.Pos() + new Vector3(0, 10, 0), Vector3.down, out hit, 11))
         {
             if (hit.collider.name == "Terrain")
             {
                 WalkToPoint = hit.point;
                 Roaming     = true;
             }
         }
     }
 }
        public SkillReplayControlViewModel()
        {
            replayer = new SkillPlayer(this);

            var config = SkillReplayConfig.Instance;

            Language      = new ReactiveProperty <string>(config.Language);
            TextFFLogsURL = new ReactiveProperty <string>(config.FFLogsURL);
            NumberPort    = new ReactiveProperty <int>(config.Port);
            AutoReplay    = new ReactiveProperty <int>(config.AutoReplay);
            AutoStop      = new ReactiveProperty <int>(config.AutoStop);
            AutoStopTime  = new ReactiveProperty <int>(config.AutoStopTime);
            LanguageList  = config.LanguageList;

            TextPlayButton = IsPlaying.Select(play => play ? "停止" : "再生").ToReactiveProperty();
            OverlayURL     = NumberPort.Select(port => $"https://rawrington.github.io/SkillDisplay/?HOST_PORT=ws://127.0.0.1:{port}/").ToReactiveProperty();


            var IsBusy = new[] { IsLoading, IsPlaying }.CombineLatest(a => a.Any(x => x));

            HasEvent = CurrentFight.CombineLatest(CurrentFriendly, CheckEvents).ToReactiveProperty();

            FriendlyList = OriginalFriendlyList.CombineLatest(CurrentFight, (list, fight) =>
            {
                if (fight != null)
                {
                    string key = $".{fight.id}.";
                    return(list.Where(friend => friend.fights.Contains(key) && friend.type != "LimitBreak").ToList());
                }
                else
                {
                    return(new List <Friendly>());
                }
            }).ToReactiveProperty();

            FriendlyList.Subscribe(list =>
            {
                if (!list.Contains(CurrentFriendly.Value))
                {
                    CurrentFriendly.Value = null;
                }
            });

            CommandLoadFights = IsBusy.Select(b => !b).ToReactiveCommand();
            CommandLoadFights.Subscribe(LoadFights);

            CommandLoadSkill = CurrentFight.CombineLatest(CurrentFriendly, IsBusy, (fight, friend, busy) =>
            {
                if (busy)
                {
                    return(false);
                }
                if (fight == null)
                {
                    return(false);
                }
                if (friend == null)
                {
                    return(false);
                }
                return(true);
            }).ToReactiveCommand();
            CommandLoadSkill.Subscribe(LoadEvents);

            CommandReplay = HasEvent.ToReactiveCommand();
            CommandReplay.Subscribe(Replay);

            TextFFLogsURL.Subscribe(url =>
            {
                config.FFLogsURL = url;
                config.Save();
            });
            NumberPort.Subscribe(port =>
            {
                config.Port = port;
                config.Save();
            });
            AutoReplay.Subscribe(autoreplay =>
            {
                config.AutoReplay = autoreplay;
                config.Save();
            });
            AutoStop.Subscribe(autostop =>
            {
                config.AutoStop = autostop;
                config.Save();
            });
            AutoStopTime.Subscribe(autostoptime =>
            {
                config.AutoStopTime = autostoptime;
                config.Save();
            });

            Language.Subscribe(lang =>
            {
                config.Language = lang;
                config.Save();
            });

            PlayStopTagList = IsPlaying.Select(x => x ? "Stop" : "Play").ToReactiveProperty();
        }