예제 #1
0
 void Update()
 {
     if (!isActive)
     {
         return;
     }
     if (slider.value < bossTime)
     {
         slider.value += Time.deltaTime;
         currentTime  += Time.deltaTime;
         if (currentTime >= spawnRate)
         {
             currentTime = 0;
             float      randomPos  = Random.Range(leftCorner.position.x, rightCorner.position.x);
             GameObject projectile = Instantiate(projectilePref, new Vector2(randomPos, leftCorner.position.y), Quaternion.identity);
             projectile.transform.parent = leftCorner.transform;
         }
     }
     else
     {
         foreach (Transform item in leftCorner.transform)
         {
             Destroy(item.gameObject);
         }
         timeSlider.SetActive(false);
         actionEvent.DoAction(actionObject);
     }
 }
예제 #2
0
 void Update()
 {
     if (!key.GetComponent <IKey>().CanOpen())
     {
         return;
     }
     if (!once)
     {
         return;
     }
     action.DoAction(gameObject);
     once = false;
 }
예제 #3
0
 public void CollectItem()
 {
     currentColect++;
     if (currentColect != 0)
     {
         gameObject.SetActive(true);
     }
     UpdateText();
     if (currentColect == maxColect)
     {
         _actionEvent.DoAction(_actionObject);
     }
 }
예제 #4
0
 public void Interact(Transform player)
 {
     if (_dialog.dialog.dialog.Count > _dialogIndex)
     {
         _dialog.dialogWindow.SetActive(true);
         _fixedJoint.enabled       = true;
         _fixedJoint.connectedBody = player.GetComponent <Rigidbody2D>();
         StartCoroutine(_dialog.WriteText(_dialogIndex++, _dialogText));
     }
     else
     {
         _dialog.dialogWindow.SetActive(false);
         _fixedJoint.enabled = false;
         _dialogIndex        = 0;
         if (doAction)
         {
             _actionEvent.DoAction(_actionObject);
         }
     }
     player.GetComponent <Player.PlayerInput>().states.interactable = false;
 }