コード例 #1
0
 private void OnDrawGizmos()
 {
     Gizmos.DrawWireCube(new Vector2(gameObject.transform.position.x + MyBodyCollision.GetComponent <BoxCollider2D>().offset.x, gameObject.transform.position.y + MyBodyCollision.GetComponent <BoxCollider2D>().offset.y), new Vector3(1, 1, 0));
 }
コード例 #2
0
 override public void Update()
 {
     if (ActivateBoss == false)
     {
         if (MyCamera.Instance.CurrentRoom == myRoom && MyCamera.Instance.m_IsUpdatingPosition == false)
         {
             if (InitiatedDialog == false)
             {
                 DialogManager.OnSpeak(startDialog);
                 InitiatedDialog = true;
             }
             if (!DialogBox.IsVisible())
             {
                 AudioManager.ChangeBGM(RoomManager.Instance.bossTheme);
                 ActivateBoss = true;
             }
         }
     }
     if (ActivateBoss == true)
     {
         if (UIBossHealthBar.MyInstance.HealthModel == null)
         {
             UIBossHealthBar.MyInstance.HealthModel = GetComponentInChildren <AttackableEnemy>();
             UIBossHealthBar.MyInstance.RevealImage();
         }
         if (!m_MovementModel.CanAttack()) //this likely wont be here later on
         {
             return;
         }
         UpdateDirection();
         if (m_IsCharacterInRange != null)
         {
             Vector2 myPosition    = new Vector2(gameObject.transform.position.x + MyBodyCollision.GetComponent <BoxCollider2D>().offset.x, gameObject.transform.position.y + MyBodyCollision.GetComponent <BoxCollider2D>().offset.y);
             Vector2 otherPosition = new Vector2(m_IsCharacterInRange.transform.position.x + m_IsCharacterInRange.GetComponent <BoxCollider2D>().offset.x, m_IsCharacterInRange.transform.position.y + m_IsCharacterInRange.GetComponent <BoxCollider2D>().offset.y);
             // Debug.Log(Vector2.Distance(otherPosition, myPosition));
             Vector3 direction = m_MovementModel.GetFacingDirection();
             if (direction.x == 0 & direction.y == 0)
             {
                 return; //this makes it so that the character cant shoot something without moving first
             }
             if (Vector2.Distance(otherPosition, myPosition) <= 1.3)
             {
                 if (Attack == true)
                 {
                     closeRangeAttack.OnAttackByEnemy();
                     Attack = false;
                     StartCoroutine(WaitUntilAbleToAttack(1));
                 }
             }
             if (Vector2.Distance(otherPosition, myPosition) >= 1.3 & Vector2.Distance(otherPosition, myPosition) <= 3)
             {
                 if (Attack == true)
                 {
                 }
             }
             if (Vector2.Distance(otherPosition, myPosition) >= 3)
             {
                 if (Attack == true)
                 {
                     Debug.Log(gameObject.name + " is making a long range attack");
                     longRangeAttack.OnAttackByEnemy();
                     Attack = false;
                     StartCoroutine(WaitUntilAbleToAttack(2));
                 }
             }
         }
     }
 }