private void Start()
 {
     _characterController = GetComponent <CharacterController>(); // 毎フレームアクセスするので、負荷を下げるためにキャッシュしておく
     _transform           = transform;                            // Transformもキャッシュすると少しだけ負荷が下がる
     _status = GetComponent <PlayerStatus>();
     _attack = GetComponent <MobAttack>();
 }
Exemplo n.º 2
0
 public void Dispose()
 {
     if (dest == null) return;
     if (attacking == true && attacktask != null) attacktask.Deactivate();
     attacktask = null;
     this.status = CommandStatus.FINISHED;
 }
Exemplo n.º 3
0
 public void Dispose()
 {
     if (dest == null)
     {
         return;
     }
     if (attacking == true && attacktask != null)
     {
         attacktask.Deactivate();
     }
     attacktask  = null;
     this.status = CommandStatus.FINISHED;
 }
Exemplo n.º 4
0
    private void Create()
    {
        GameObject currentBoss      = _bossPrefabs[waveNumber];
        Vector3    randomSpawnPoint = _spawnPoints[Random.Range(0, _spawnPoints.Length)].position;

        GameObject boss = Instantiate(currentBoss, randomSpawnPoint, Quaternion.identity);

        boss.GetComponent <BossDeath>().waveController = _waveController;
        boss.GetComponent <MobNavMesh>().target        = _target;
        MobAttack mobAttack = boss.GetComponent <MobAttack>();

        mobAttack.target          = _target;
        mobAttack.characterHealth = _characterHealth;
    }
Exemplo n.º 5
0
 public void Update(object para)
 {
     dest = CurrentTarget();
     if (dest == null)
     {
         mob.ai.AIActivity =  MobAI.Activity.LAZY;
         if (mob.ai.commands.ContainsKey("Chase") == true) mob.ai.commands.Remove("Chase"); ;
         return;
     }
     mob.ai.AIActivity =  MobAI.Activity.BUSY;
     if (mob.ai.commands.ContainsKey("Move") == true) mob.ai.commands.Remove("Move");
     attacktask.dActor = dest;
     if (mob.ai.commands.ContainsKey("Chase") == true)
     {
         if (attacktask.Activated() == true) attacktask.Deactivate();
         attacking = false;
         return;
     }
     if (dest.stance == Global.STANCE.DIE)
     {
         if (mob.Hate.ContainsKey(dest.id)) mob.Hate.Remove(dest.id);
         if (attacktask.Activated() == true) attacktask.Deactivate();
         attacktask = null;
         return;
     }
     ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)dest.e;
     if (eh.C.state == MapClient.SESSION_STATE.LOGGEDOFF)
     {
         if (mob.Hate.ContainsKey(dest.id)) mob.Hate.Remove(dest.id);
         if (attacktask.Activated() == true) attacktask.Deactivate();
         attacktask = null;
         return;
     }
     float[] src = new float[3] { mob.Actor.x, mob.Actor.y, mob.Actor.z };
     float[] dst = new float[3] { dest.x, dest.y, dest.z };
     if (MobAI.GetDistance2(src, dst) > (150 + (mob.Size)))
     {
         Chase chase = new Chase(this.mob, dest);
         mob.ai.commands.Add("Chase", chase);
         if (attacktask.Activated() == true) attacktask.Deactivate();
         attacking = false;
     }
     else
     {
         if (attacktask.Activated() == false) attacktask.Activate();
         attacking = true;
     }
 }
Exemplo n.º 6
0
    public void Create(int mobCountInWave)
    {
        for (int count = 0; count < mobCountInWave; count++)
        {
            Vector3           randomSpawnPoint = _spawnPoints[Random.Range(0, _spawnPoints.Length)].position;
            Pool <PoolObject> randomPool       = _poolList[Random.Range(0, _poolList.Count)];

            PoolObject poolObject = randomPool.Take();
            GameObject mob        = poolObject.gameObject;

            mob.SetActive(true);
            mob.transform.position = randomSpawnPoint;
            mob.GetComponent <PoolObject>().pool   = randomPool;
            mob.GetComponent <MobNavMesh>().target = _target;
            MobDeath mobDeath = mob.GetComponent <MobDeath>();
            mobDeath.bossCreate   = _bossCreate;
            mobDeath.showMobCount = _showMobCount;
            MobAttack mobAttack = mob.GetComponent <MobAttack>();
            mobAttack.target          = _target;
            mobAttack.characterHealth = _characterHealth;
        }
    }
Exemplo n.º 7
0
 public void Update(object para)
 {
     dest = CurrentTarget();
     if (dest == null)
     {
         mob.ai.AIActivity = MobAI.Activity.LAZY;
         if (mob.ai.commands.ContainsKey("Chase") == true)
         {
             mob.ai.commands.Remove("Chase");
         }
         ;
         return;
     }
     mob.ai.AIActivity = MobAI.Activity.BUSY;
     if (mob.ai.commands.ContainsKey("Move") == true)
     {
         mob.ai.commands.Remove("Move");
     }
     attacktask.dActor = dest;
     if (mob.ai.commands.ContainsKey("Chase") == true)
     {
         if (attacktask.Activated() == true)
         {
             attacktask.Deactivate();
         }
         attacking = false;
         return;
     }
     if (dest.stance == Global.STANCE.DIE)
     {
         if (mob.Hate.ContainsKey(dest.id))
         {
             mob.Hate.Remove(dest.id);
         }
         if (attacktask.Activated() == true)
         {
             attacktask.Deactivate();
         }
         attacktask = null;
         return;
     }
     ActorEventHandlers.PC_EventHandler eh = (SagaMap.ActorEventHandlers.PC_EventHandler)dest.e;
     if (eh.C.state == MapClient.SESSION_STATE.LOGGEDOFF)
     {
         if (mob.Hate.ContainsKey(dest.id))
         {
             mob.Hate.Remove(dest.id);
         }
         if (attacktask.Activated() == true)
         {
             attacktask.Deactivate();
         }
         attacktask = null;
         return;
     }
     float[] src = new float[3] {
         mob.Actor.x, mob.Actor.y, mob.Actor.z
     };
     float[] dst = new float[3] {
         dest.x, dest.y, dest.z
     };
     if (MobAI.GetDistance2(src, dst) > (150 + (mob.Size)))
     {
         Chase chase = new Chase(this.mob, dest);
         mob.ai.commands.Add("Chase", chase);
         if (attacktask.Activated() == true)
         {
             attacktask.Deactivate();
         }
         attacking = false;
     }
     else
     {
         if (attacktask.Activated() == false)
         {
             attacktask.Activate();
         }
         attacking = true;
     }
 }
Exemplo n.º 8
0
 public Attack(Mob mob)
 {
     this.mob    = mob;
     this.Status = CommandStatus.INIT;
     attacktask  = new MobAttack(mob, mob.ASPD, dest);
 }
Exemplo n.º 9
0
 public Attack(Mob mob)
 {
     this.mob = mob;
     this.Status = CommandStatus.INIT;
     attacktask = new MobAttack(mob, mob.ASPD, dest);
 }