Example #1
0
    // Use this for initialization
    void Start()
    {
        //ゲーム内からオブジェクトを検索し、そこで動作しているスクリプトを取得する
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
        boss  = GameObject.Find("Boss_A").GetComponent <Boss_A>();

        //ボスオブジェクトの子オブジェクトになる
        this.transform.parent = boss.transform;

        //自分の位置を取得
        nowPosithion = boss.transform.position;

        //目的地と現在地の距離と方角の差を求める
        directhion = boss.endPosithion - nowPosithion;

        //移動量を求める
        moveSpeed = directhion * boss.speed;

        //移動量が最低速度以下の場合、最低速度分早くする
        if (moveSpeed.x > 0 && moveSpeed.x < minSpeed)
        {
            moveSpeed.x += minSpeed;
        }
        else if (moveSpeed.x < 0 && moveSpeed.x > -minSpeed)
        {
            moveSpeed.x -= minSpeed;
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //スクリプトを読み込む
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
        boss  = GameObject.Find("Boss_C").GetComponent <Boss_C>();

        //現在アタッチされているオブジェクトを読み込む
        wepon = transform.root.gameObject;

        //向きの修正
        if (boss.transform.position.x - boss.playerPosithion.x < 0)
        {
            transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z);
        }

        //向きに応じて速度を与える
        if (boss.transform.localScale.x < 0)
        {
            wepon.GetComponent <Rigidbody>().velocity = new Vector3(weponSpeed, wepon.transform.position.y, wepon.transform.position.z);
        }
        else
        {
            wepon.GetComponent <Rigidbody>().velocity = new Vector3(-weponSpeed, wepon.transform.position.y, wepon.transform.position.z);
        }
    }
Example #3
0
File: Mob_A.cs Project: Pmang/TRGR
    // Use this for initialization
    public override void Start()
    {
        // MobBaseクラスのStart呼び出し
        base.Start();

        //プレイヤーの現在位置を取得したいのでフィールドを取得
        m = GameObject.FindWithTag("Player").GetComponent <Player>();

        //初期位置を保管(元の位置に戻る事があるので)
        startPosithon = this.transform.position;

        //移動先をとりあえず現在地に
        endPosithion = this.transform.position;

        //オブジェクトに引っ付いてるファイルを読み込む
        anime = transform.root.gameObject.GetComponent <Animator>();
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();

        //ヒールオブジェクトを取得
        heal = (GameObject)Resources.Load("Prefabs/heal_item");

        //初期stateはstay
        state = State.Stay;

        //フラグを初期化
        attack = false;

        dash = false;

        //トリガー準備
        attack1_Id = Animator.StringToHash("attack");

        move_Id = Animator.StringToHash("move");
    }
Example #4
0
File: Attack.cs Project: Pmang/TRGR
    public void OnClick()
    {
        int   damage = (int)(Random.value * 10000 + 1);
        HpApi api    = GameObject.Find("Canvas").GetComponent <HpApi>();

        api.Damage(damage);
        Debug.Log("hit! " + damage + " damage!");
    }
Example #5
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();

        //スクリプトを読み込む
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
        boss  = GameObject.Find("Boss_B").GetComponent <Boss_B>();

        //向きの修正
        if (boss.transform.position.x - boss.playerPosithion.x > 0)
        {
            transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z);
        }
    }
Example #6
0
    // Use this for initialization
    void Start()
    {
        //現在アタッチされているオブジェクトを読み込む
        wepon = transform.root.gameObject;

        //プレイヤーの現在位置を取得したいのでフィールドを取得
        m = GameObject.Find("Player").GetComponent <Player>();

        //プレイヤーと同じく座標を取得する為
        b = GameObject.Find("Boss_A").GetComponent <Boss_A>();

        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();

        first = true;
    }
Example #7
0
    // Use this for initialization
    void Start()
    {
        //スクリプトを読み込む
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
        boss  = GameObject.Find("Boss_C").GetComponent <Boss_C>();

        //向きの修正
        if (boss.transform.position.x - boss.playerPosithion.x < 0)
        {
            transform.localScale = new Vector3(transform.localScale.x * -1, transform.localScale.y, transform.localScale.z);
        }
        else
        {
        }
    }
Example #8
0
File: Mob_N.cs Project: Pmang/TRGR
    // 初期化、最初に行う処理
    public override void Start()
    {
        // MobBaseクラスのStart呼び出し
        base.Start();

        //プレイヤーの現在位置を取得したいのでフィールドを取得
        m = GameObject.FindWithTag("Player").GetComponent <Player>();

        //初期位置を保管(元の位置に戻る事があるので)
        startPosithon = this.transform.position;

        //移動先をとりあえず現在地に
        endPosithion = this.transform.position;

        //オブジェクトに引っ付いてるファイルを読み込む
        hpapi       = GameObject.Find("Canvas").GetComponent <HpApi>();
        isAttacking = false;

        //ヒールオブジェクトを取得
        heal = (GameObject)Resources.Load("Prefabs/heal_item");
    }
Example #9
0
File: Boss_B.cs Project: Pmang/TRGR
    // Use this for initialization
    public override void Start()
    {
        // MobBaseクラスのStart呼び出し
        base.Start();

        //プレイヤーの現在位置を取得したいのでオブジェクトから取得
        player = GameObject.FindWithTag("Player").GetComponent <Player>();

        //HPを取得
        hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();

        //ヒールオブジェクトを取得
        heal = (GameObject)Resources.Load("Prefabs/heal_item");

        //最初は攻撃を行わない状態
        state = State.Stay;

        isAttack = false;

        isAttack1 = false;

        isAttack2 = false;

        //各トリガーへ渡すハッシュを取得
        anime     = transform.root.gameObject.GetComponent <Animator>();
        stayId    = Animator.StringToHash("stay");
        attack1Id = Animator.StringToHash("attack1");
        attack2Id = Animator.StringToHash("attack2");
        guardId   = Animator.StringToHash("guard");
        jumpId    = Animator.StringToHash("jump");
        counterId = Animator.StringToHash("counter");

        //生成するゲームオブジェクトをプレハブから読み込む
        slash = (GameObject)Resources.Load("Prefabs/BossB_ef1");
        bomb  = (GameObject)Resources.Load("Prefabs/BossB_ef2");

        //Attack2用のカウンターを初期化
        a2 = 1;
    }
Example #10
0
 // Use this for initialization
 void Start()
 {
     //スクリプトを読み込む
     hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
     boss  = GameObject.Find("Boss_B").GetComponent <Boss_B>();
 }
Example #11
0
 // Use this for initialization
 void Start()
 {
     //オブジェクトに引っ付いてるファイルを読み込む
     hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
 }
Example #12
0
 // Use this for initialization
 void Start()
 {
     //現在アタッチされているオブジェクトを読み込む
     wepon = transform.root.gameObject;
     hpapi = GameObject.Find("Canvas").GetComponent <HpApi>();
 }