コード例 #1
0
    void Start()
    {
        monsterTransform = this.gameObject.GetComponent <Transform>();
        playerTransform  = GameObject.FindWithTag("Player").GetComponent <Transform>();
        navAgent         = this.gameObject.GetComponent <NavMeshAgent>();
        alienAnimator    = GetComponent <Animator>();
        alienHP          = this.GetComponentInChildren <MonsterHP>();


        navAgent.destination = playerTransform.position + attackDistance * Vector3.forward; //플레이어를 목적지로 설정

        int randNum = Random.Range(1, 4);

        if (randNum == 1)
        {
            monsterTransform.position = (monsterTransform.transform.position + 2 * Vector3.forward);
        }
        else if (randNum == 2)
        {
            monsterTransform.transform.position = (monsterTransform.transform.position + 2 * Vector3.back);
        }
        else if (randNum == 3)
        {
            monsterTransform.transform.position = (monsterTransform.transform.position + 2 * Vector3.right);
        }
        else
        {
            monsterTransform.transform.position = (monsterTransform.transform.position + 2 * Vector3.left);
        }

        StartCoroutine(this.CheckState());             // 몬스터 상태체크
        StartCoroutine(this.CheckStateForAnimation()); // 상태에 따른 애니메이션
    }
コード例 #2
0
    void Start()
    {
        colliderTable.Clear();
        headSet.Clear();
        GameObject bruteObject = GameObject.Find("Brute");
        MonsterHP  brute       = bruteObject.GetComponent <Brute> ().monster;

        Collider[] bruteCollider = bruteObject.GetComponentsInChildren <Collider> ();
        for (int i = 0; i < bruteCollider.Length; ++i)
        {
            colliderTable.Add(bruteCollider [i], brute);
        }
        Collider bruteHead = bruteObject.GetComponentInChildren <SphereCollider> ();

        headSet.Add(bruteHead);
        Transform ghostPool     = GameObject.Find("GhostPool").transform;
        int       ghostPoolSize = ghostPool.gameObject.GetComponent <ObjectPool> ().poolSize;

        for (int i = 0; i < ghostPoolSize; ++i)
        {
            Transform  ghost         = ghostPool.GetChild(i);
            MonsterHP  monster       = ghost.gameObject.GetComponent <Ghost> ().monster;
            Collider[] ghostCollider = ghost.gameObject.GetComponents <Collider> ();
            for (int j = 0; j < ghostCollider.Length; ++j)
            {
                colliderTable.Add(ghostCollider [j], monster);
            }
            Collider ghostHead = ghost.gameObject.GetComponent <SphereCollider> ();
            headSet.Add(ghostHead);
        }
    }
コード例 #3
0
    void Awake()
    {
        AudioSource hurtSound = GetComponent <AudioSource> ();
        FadeImage   skull     = GameObject.Find("Skull").GetComponent <FadeImage> ();

        monster = new MonsterHP(hurtSound, hurtSound, skull);
    }
コード例 #4
0
 private void Start()
 {
     Set_command();
     _rigid = GetComponent <Rigidbody>();
     HP     = GetComponent <MonsterHP>();
     HP.HPInit();
 }
コード例 #5
0
 private void Start()
 {
     boss    = this.GetComponentInParent <BossControl>();
     bosshp  = GameObject.Find("BossHPCanvas01").GetComponent <MonsterHP>();
     bossAni = this.GetComponentInParent <Animator>();
     spawnPoint.gameObject.SetActive(false);
     timer = 0f;
     //this.gameObject.SetActive(false);
 }
コード例 #6
0
    private float deadTime = 4f; // 죽는 시간

    void Start()
    {
        bossTransform   = this.gameObject.GetComponent <Transform>();
        playerTransform = GameObject.FindWithTag("Player").GetComponent <Transform>();
        navAgent        = this.gameObject.GetComponent <NavMeshAgent>();
        bossAnimator    = GetComponent <Animator>();
        bossHP          = this.GetComponentInChildren <MonsterHP>();
        shield          = transform.Find("Shield").gameObject;

        navAgent.destination = playerTransform.position + attackDistance * Vector3.forward; //플레이어를 목적지로 설정

        StartCoroutine(this.CheckState());                                                  // 몬스터 상태체크
        StartCoroutine(this.CheckStateForAnimation());                                      // 상태에 따른 애니메이션
    }
コード例 #7
0
ファイル: Scoreontroller.cs プロジェクト: moonyh0918/100mb
    public void ScoreSetting()
    {
        GateTrophy = Character.instance.gateNum;
        MonsterHP  = Character.instance.sumMonsterHpNum;
        BossHp     = FinalBattle.instance.doomTrack - Boss.instance.BossDoomTrack;
        ItemAmount = Character.instance.characterInventory.Count;
        Clue       = Character.instance.clue;
        Basic      = FinalBattle.instance.doomTrack - TerrorLevel.instance.terrorlevel;


        num1.text = Basic.ToString();
        num2.text = BossHp.ToString();
        num3.text = GateTrophy.ToString();
        num4.text = MonsterHP.ToString();
        num5.text = Clue.ToString();
        num6.text = Score().ToString();
    }
コード例 #8
0
    void Start()
    {
        hpSliderObject = transform.Find("HPCanvas/HPSlider").gameObject;
        hpSlider       = hpSliderObject.GetComponent <UnityEngine.UI.Slider> ();
        if (gameObject.name == "Brute")
        {
            monster = GetComponent <Brute> ().monster;
            hpBar   = transform.Find("hipcontrol/hpbar");
        }
        else             // Ghost
        {
            monster = GetComponent <Ghost> ().monster;
            hpBar   = transform.Find("HpBar");
        }
        Camera characterCamera = GameObject.Find("Character/Camera").GetComponent <Camera> ();
        Canvas canvas          = transform.Find("HPCanvas").gameObject.GetComponent <Canvas> ();

        canvas.worldCamera   = characterCamera;
        canvas.planeDistance = 1.0f;
    }
コード例 #9
0
 // Use this for initialization
 void Start()
 {
     monsterHP = this;
 }
コード例 #10
0
 private void Start()
 {
     Set_State(BossState.STATE_Start);
     HP = GetComponent <MonsterHP>();
     HP.HPInit();
 }
コード例 #11
0
 void Start()
 {
     monsterHp = this.GetComponentInChildren <MonsterHP>();
     monster   = this.GetComponent <MonsterControl>();
     hpCanvas  = this.GetComponentInChildren <CanvasGroup>();
 }
コード例 #12
0
 protected virtual void Start()
 {
     HP = GetComponent <MonsterHP>();
     HP.HPInit();
     Move.MoveStart();
 }
コード例 #13
0
    void Awake()
    {
        FadeImage skull = GameObject.Find("Skull").GetComponent <FadeImage> ();

        monster = new MonsterHP(hurtSound, dieSound, skull);
    }