Beispiel #1
0
    void Counter()
    {
        //プレイヤーに若干のダメージを与える
        int damage = MobBase.calcDamage(minAtk, maxAtk);

        hpapi.Damage(damage);
    }
Beispiel #2
0
 //モブを殺すアニメーションの再生を行う
 public void MobKilling(Vector2 killPos, MobBase killMob)
 {
     animeTimer = 0.0f;
     animeState = Animation.TargetToMove;
     targetPos  = killPos;
     KillingMob = killMob;
 }
Beispiel #3
0
    protected virtual void LocalUpdate()
    {
        if (_enemyMob != null && !_enemyMob.IsAlive())
        {
            _enemyMob      = null;
            _currentTarget = null;
        }

        if (_enemyMob == null)
        {
            _enemyMob = FindEnemyInRadius(viewRange);

            _currentTarget = _enemyMob != null ? _enemyMob.transform : _enemyMainBuilding.transform;

            _navMeshAgent.SetDestination(_currentTarget.position);
            _navMeshAgent.isStopped = false;
        }

        if (IsTargetOnAttackDistance())
        {
            transform.DOLookAt(_currentTarget.transform.position, 0.5f);
            _navMeshAgent.isStopped = true;


            if (_enemyMob != null && _skill != null && _skill.IsReady() && _health.currentMana >= _skill.manaCost)
            {
                _skill.UseSkill();
                return;
            }

            StartCoroutine(Attacking());
        }
    }
Beispiel #4
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject target = other.gameObject;

        if (other.tag == "Attachment")
        {
            AttachmentBase a = other.GetComponent <AttachmentBase>();

            target = a.parent.gameObject;
            if (target.tag == "Enemy")
            {
                MobBase mob = other.GetComponent <MobBase>();
                mob.Damage(damage);
            }

            if (target.tag != "Player")
            {
                Destroy(gameObject);
            }
        }

        if (other.tag == "Enemy")
        {
            MobBase mob = other.GetComponent <MobBase>();
            mob.Damage(damage);
        }

        if (other.tag != "Player")
        {
            Destroy(gameObject);
        }
    }
Beispiel #5
0
 protected virtual void CreateMob(MobBase mob, Vector3 position, Quaternion rotation)
 {
     if (photonView.IsMine)
     {
         PhotonNetwork.Instantiate(Path.Combine("Prefabs", mob.name), position, rotation);
     }
 }
Beispiel #6
0
    //概要 : モブのキル判定(ひざ切り)
    //引数 : Vectro2 clickPos    クリックされた座標
    //        MobBase killingMob  キル判定するモブ
    //返値 : bool TRUE:キルされた/FALSE:失敗
    public bool KillCheckMob(Vector2 clickPos, MobBase killingMob)
    {
        //条件をクリアしたことにする
        foreach (MobBase mobs in ManagingMobs)
        {
            if (mobs == null)
            {   //err
                continue;
            }
            //モブのキル判定
            if (mobs.KillCheck(clickPos, killingMob, GetPsychoPos()))
            {   //殺すの失敗
                GameOver();
                return(false);
            }
        }

        //選択したモブは死ぬ
        if (ManagingPsychopath)
        {
            ManagingPsychopath.MobKilling(clickPos, killingMob);
        }
        else
        {   //err
            Debug.Log("ERROR : GameControllerにPsychopathが設定されていない。");
        }
        return(true);
    }
Beispiel #7
0
 //範囲内に何かが入ると動く
 private void OnTriggerEnter(Collider other)
 {
     //プレイヤータグの場合はダメージを与えて消す
     if (other.tag == "Player")
     {
         int damage = MobBase.calcDamage(minAtk, maxAtk);
         hpapi.Damage(damage);
         Destroy(wepon);
     }
 }
Beispiel #8
0
    public void Depop(MobBase mob)
    {
        Destroy(mob.transform.root.gameObject);
        this.addable++;

        if (this.addable == this.maxPopCount)
        {
            GameObject.Find("StageManager").GetComponent <StageManager>().Clear();
        }
    }
Beispiel #9
0
    IEnumerator Attack()
    {
        int damage = MobBase.calcDamage(minAtk, maxAtk);

        hpapi.Damage(damage);

        yield return(new WaitForSeconds(this.damageSpan));

        this.isAttacking = false;
    }
Beispiel #10
0
 //範囲内に何かが入ると動く
 private void OnTriggerEnter(Collider other)
 {
     //プレイヤータグの場合はダメージを与えて判定を消す
     if (other.tag == "Player")
     {
         int damage = MobBase.calcDamage((int)(boss.minAtk * 1.2), (int)(boss.maxAtk * 1.2));
         hpapi.Damage(damage);
         transform.root.gameObject.GetComponent <BoxCollider>().enabled = false;
     }
 }
Beispiel #11
0
 public PlayerCharacter(MobBase mobBase, Vector2 startingPosition) : base(mobBase, startingPosition)
 {
     PrecisionSpeed       = mobBase.MoveSpeed / 2;
     Active               = true;
     Position             = startingPosition;
     Lives                = 5;
     invincible           = false;
     invincibleStartFrame = 0;
     bulletMaker          = new BulletMaker();
     defaultStartPosition = startingPosition;
 }
Beispiel #12
0
 //範囲内に何かが入ると動く
 private void OnTriggerEnter(Collider other)
 {
     //プレイヤータグの場合はダメージを与えて消す
     if (other.tag == "Player")
     {
         int damage = MobBase.calcDamage(minAtk, maxAtk);
         hpapi.Damage(damage);
         this.transform.parent = null;
         Destroy(this.transform.root.gameObject);
         boss.CoolOn();
     }
 }
Beispiel #13
0
 //概要 : モブを管理に含める
 //引数 : MobBase newMob  管理に追加する新しいモブ
 //返値 : bool 成否    TRUE:成功/FALSE:失敗
 //詳細 : GameControllerにモブを追加します。
 //        追加されたモブは「ItemEvent」を受け取ることができます。
 //        返値にFALSEが返った場合は既に管理に含まれるか
 //        管理の上限に達している場合です。
 public bool AddMob(MobBase newMob)
 {
     foreach (MobBase mobs in ManagingMobs)
     {     //管理中に同じモブがいないか確認する
         if (mobs == newMob)
         { //既に管理されているのでエラー
             return(false);
         }
     }
     for (int i = 0; i < ManagingMobs.Length; ++i)
     {     //管理に追加できそうなインデックスを探す
         if (ManagingMobs[i] == null)
         { //追加処理
             ManagingMobs[i] = newMob;
             return(true);
         }
     }
     //管理の追加に失敗したのでエラー
     return(false);
 }
Beispiel #14
0
    public virtual MobBase FindEnemyInRadius(float radius)
    {
        MobBase nearestEnemy = null;

        MobBase[] mobs = FindEnemiesInRadius(radius);

        float minimumDistance = Mathf.Infinity;

        foreach (MobBase mob in mobs)
        {
            // TODO: order mobs by health and select first

            float distance = Vector3.Distance(transform.position, mob.transform.position);
            if (distance < minimumDistance)
            {
                nearestEnemy    = mob;
                minimumDistance = distance;
            }
        }

        return(nearestEnemy);
    }
Beispiel #15
0
    //アニメーションイベントで使用する
    void Attack1()
    {
        int damage = MobBase.calcDamage(minAtk, maxAtk);

        hpapi.Damage(damage);
    }
Beispiel #16
0
    /***
     * @param pos マウスのクリックされたポジション
     * @param mb  クリックされたモブキャラの親クラス
     * @return このキャラクターを殺しても良いか
     */
    public bool KillCheck(Vector2 pos, MobBase mb, Vector2 phychoPos)
    {
        int phychoDir = 0;

        // サイコパスの位置を判定      1: right   2:left   3:rear
        if (phychoPos.x > max.x * 0.75f)
        {
            phychoDir = 1;
        }
        else if (phychoPos.x < min.x * 0.75f)
        {
            phychoDir = 2;
        }

        // カウントを取得
        int count = GameCtrler.GetAlivingMobs();

        // 正面なら殺せないゲームオーバー
        if (nowDir == Dir.Front)
        {
            return(true);
        }


        // 対象の敵とサイコパスの判定

        // 左を向いている かつ 敵が左向き以外 殺せないゲームオーバー
        if (phychoDir == 1 && mb.nowDir != Dir.Left)
        {
            return(true);
        }
        // 右を向いている かつ 敵が右向き以外 殺せないゲームオーバー
        if (phychoDir == 2 && mb.nowDir != Dir.Right)
        {
            return(true);
        }
        // 上を向いている かつ 敵が後向き以外 殺せないゲームオーバー
        if (phychoDir == 3 && mb.nowDir != Dir.Rear)
        {
            return(true);
        }


        // ぼっちじゃない
        if (count > 1)
        {
            // このモブが対象のモブを見ている またはサイコパスを見ている 殺せないゲームオーバー
            // 左を向いている かつ 自分より左にいる時 殺せないゲームオーバー
            if (nowDir == Dir.Left && this.transform.position.x > pos.x)
            {
                return(true);
            }
            // 右を向いている かつ 自分より右にいる時 殺せないゲームオーバー
            if (nowDir == Dir.Right && this.transform.position.x < pos.x)
            {
                return(true);
            }
        }
        // それ以外は殺せる!!
        return(false);
    }
Beispiel #17
0
        public void SpawnMob(MobBase toSpawn, Vector2 pos)
        {
            ActiveMob newMob = new ActiveMob(toSpawn, pos);

            ActiveMobs.Add(newMob);
        }