Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        item_manager = GameObject.Find("ItemManager").GetComponent <ItemManager>();

        cow       = null; tiger = null; chicken = null;
        HPMax     = 1000;
        hp        = HPMax;
        hp_bar    = GameObject.FindWithTag("EChickenHp");
        hpbar_sx  = hp_bar.transform.localScale.x;
        hpbar_tx  = hp_bar.transform.localPosition.x;
        hpbar_tmp = hpbar_sx / HPMax;   //최대 체력에 따른 hp바 이동량 설정

        chicken_hp = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>();
        cow_hp     = GameObject.FindWithTag("cow").GetComponent <Cow_Attack>();
        tiger_hp   = GameObject.FindWithTag("tiger").GetComponent <Tiger_Attack>();

        e_attack_data = GameObject.Find("E_AttackData").GetComponent <E_AttackData>();
        attack        = e_attack_data.Echicken_attack;

        //농장씬에서 죽었는지 파악
        if (!item_manager.cow_die)
        {
            cow = GameObject.Find("Cow").gameObject;
        }
        if (!item_manager.chicken_die)
        {
            chicken = GameObject.Find("Chicken").gameObject;
        }
        if (!item_manager.tiger_die)
        {
            tiger = GameObject.Find("tiger").gameObject;
        }

        Debug.Log("적닭 공격력: " + attack);
    }
Esempio n. 2
0
    // Start is called before the first frame update
    void Start()
    {
        // isDie = GameObject.Find("Tiger_p").transform.GetChild(0).GetComponent<Tiger_Move>().isDie;

        HPMax     = 1000;
        hp        = HPMax;
        hp_bar    = GameObject.FindWithTag("TigerHp");
        hpbar_sx  = hp_bar.transform.localScale.x;
        hpbar_tx  = hp_bar.transform.localPosition.x;
        hpbar_tmp = hpbar_sx / HPMax;   //최대 체력에 따른 hp바 이동량 설정

        //hp 가져오기
        E_chicken_hp = GameObject.FindWithTag("chicken_enemy").GetComponent <E_ch_Attack>();
        E_cow_hp     = GameObject.FindWithTag("cow_enemy").GetComponent <E_cow_Attack>();
        E_tiger_hp   = GameObject.FindWithTag("tiger_enemy").GetComponent <E_t_Attack>();
        //

        fPazik = transform.GetChild(1).gameObject;
        fPazik.SetActive(false);
        cow     = GameObject.FindWithTag("cow").GetComponent <Cow_Attack>();
        chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>();

        //공격 레벨 가져오기
        item_manager = GameObject.Find("ItemManager").GetComponent <ItemManager>();
        level        = item_manager.tiger_level;

        //공격력 가져오기
        attack_data = GameObject.Find("AttackData").GetComponent <Attack_Data>();
        attack      = attack_data.getAttackValue(level);

        Debug.Log("호랑이 레벨: " + level + ", 공격력: " + attack);

        animator = GetComponent <Animator>();
    }
Esempio n. 3
0
    // Start is called before the first frame update
    void Start()
    {
        chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>();
        Camera  = GameObject.FindWithTag("MainCamera").GetComponent <camera_shake>();

        if (chicken.is_go_right)//적이 왼쪽이라면
        {
            pos = Vector3.left;
        }
        else
        {
            pos = Vector3.right;
        }
        Destroy(gameObject, 5);
    }
Esempio n. 4
0
    private void OnTriggerEnter(Collider other)
    {
        //공격 함
        //적이랑 닿으면 camera 움직임
        if ((other.gameObject.tag == "cow") && E_t.is_basic_attack && !cow.is_special_attack_time && E_t.is_target_cow)//소가 고유공격 안할때 데미지 줌
        {
            //cow = GameObject.FindWithTag("cow").GetComponent<Cow_Attack>();
            cow.hpMove(E_t.attack);

            E_t.is_Attack = true;
        }
        if ((other.gameObject.tag == "tiger") && E_t.is_basic_attack && E_t.is_target_tiger)
        {
            tiger = GameObject.FindWithTag("tiger").GetComponent <Tiger_Attack>();
            tiger.hpMove(E_t.attack);

            E_t.is_Attack = true;
        }
        if ((other.gameObject.tag == "chicken") && E_t.is_basic_attack && E_t.is_target_chicken)
        {
            chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>();
            chicken.hpMove(E_t.attack);

            E_t.is_Attack = true;
        }
        //공격 받음
        if (other.gameObject.tag == "chicken_wind")
        {
            if (other.gameObject.transform.position.x >= E_t.transform.position.x)//적이 오른쪽에 있다면
            {
                E_t.transform.position = new Vector3(E_t.transform.position.x + 1.5f, E_t.transform.position.y, E_t.transform.position.z);
            }
            else//적이 왼쪽
            {
                E_t.transform.position = new Vector3(E_t.transform.position.x - 1.5f, E_t.transform.position.y, E_t.transform.position.z);
            }
            E_t.is_basic_attack = false;
        }
    }
Esempio n. 5
0
    // Start is called before the first frame update
    void Start()
    {
        Debug.Log("Start Tree");

        a_chicken = gameObject.GetComponent <Chicken_Attack>();

        //root에 더함
        root.AddChild(selector);

        //selector에 더함
        selector.AddChild(seqBehavior);//행동

        find_Target.chicken_attack    = a_chicken;
        basic_Attack.chicken_attack   = a_chicken;
        special_Attack.chicken_attack = a_chicken;

        //행동들
        seqBehavior.AddChild(find_Target);
        seqBehavior.AddChild(basic_Attack);
        seqBehavior.AddChild(special_Attack);

        behaviorProcess = BehaviorProcess();
        StartCoroutine(behaviorProcess);
    }
Esempio n. 6
0
 // Start is called before the first frame update
 void Start()
 {
     chicken = GameObject.FindWithTag("chicken").GetComponent <Chicken_Attack>();
     Camera  = GameObject.FindWithTag("MainCamera").GetComponent <camera_shake>();
 }