예제 #1
0
	// Update is called once per frame
    void Update()
    {

            //Rotate Player Towards the Mouse_Pos
            Mouse_Pos = MainCamera.ScreenToWorldPoint(Input.mousePosition);
            Mouse_Pos.y = 10;
            transform.LookAt(Mouse_Pos, Vector3.up);

            //Move Player with WASD
            /*
            if (Input.GetButton("Horizontal"))
            {
                transform.Translate(Vector3.right * Move_Speed * Input.GetAxisRaw("Horizontal"), Space.Self);
            }*/
            if (Input.GetButton("Vertical"))
            {
                transform.Translate(Vector3.forward * Move_Speed * Input.GetAxisRaw("Vertical"), Space.Self);
            }

            //Attack with Left_Click
            if (Input.GetButtonDown("Fire1"))
            {
                Player_Animator.SetBool("Attack", true);
            }
            CheckForFires();
            enemyhisColliders = Physics.OverlapSphere(this.transform.position, 80, EnemyCheckLayer);
            if (enemyhisColliders.Length != 0)
            {
                for (array_index = 0; array_index < enemyhisColliders.Length; array_index++)
                {
                    if (enemyhisColliders[array_index].tag == "Dragon")
                    {

                    }
                    else
                    {
                        enemy = enemyhisColliders[array_index].GetComponent<Enemy1_Script>();
                        enemy.Activate();
                    }
                }
            }
            spawnerhisColliders = Physics.OverlapSphere(this.transform.position, 80, SpawnerCheckLayer);
            if (spawnerhisColliders.Length != 0)
            {
                for (array_index = 0; array_index < spawnerhisColliders.Length; array_index++)
                {

                    spawner = spawnerhisColliders[array_index].GetComponent<Spawner_Script>();
                    spawner.Activate = true;
                }
            }
        
    }
예제 #2
0
 void AttackHit()
 {
    hitColliders = Physics.OverlapSphere(Sword_Trans.position, Attack_Range, EnemyCheckLayer);
    if (hitColliders.Length != 0)
    {
        Hit_SFX.Play();
        for (array_index = 0; array_index < hitColliders.Length; array_index++)
        {
            if (hitColliders[array_index].tag == "Dragon")
            {
                dragon = hitColliders[array_index].GetComponent<Dragon_Script>();
                dragon.HP -= ATK;
                if (dragon.HP <= 0)
                {
                    Destroy(hitColliders[array_index].gameObject);
                    MainCamera.GetComponent<FOWEffect>().enabled = false;
                    Instantiate(Light_Prefab);
                }
            }
            else
            {
                enemy = hitColliders[array_index].GetComponent<Enemy1_Script>();
                enemy.HP -= ATK;
                if (enemy.HP <= 0)
                {
                    Destroy(hitColliders[array_index].gameObject);
                    Instantiate(Fire_Prefab, hitColliders[array_index].transform.position, Quaternion.identity);
                }
            }
        }
    }
 }