Beispiel #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);
     }
 }
Beispiel #2
0
 void Update()
 {
     if (!key.GetComponent <IKey>().CanOpen())
     {
         return;
     }
     if (!once)
     {
         return;
     }
     action.DoAction(gameObject);
     once = false;
 }
Beispiel #3
0
 public void CollectItem()
 {
     currentColect++;
     if (currentColect != 0)
     {
         gameObject.SetActive(true);
     }
     UpdateText();
     if (currentColect == maxColect)
     {
         _actionEvent.DoAction(_actionObject);
     }
 }
Beispiel #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;
 }