AddEnergy() public method

public AddEnergy ( ) : void
return void
Exemplo n.º 1
0
 void Tap(SwipeController.SwipeType type)
 {
     if (type == SwipeController.SwipeType.Tap)
     {
         energy.AddEnergy(addeng);
     }
 }
Exemplo n.º 2
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         energy.AddEnergy(inventory.Consume());
     }
 }
Exemplo n.º 3
0
    /// <summary>
    /// Sent when another object enters a trigger collider attached to this
    /// object (2D physics only).
    /// </summary>
    /// <param name="other">The other Collider2D involved in this collision.</param>
    void OnTriggerEnter2D(Collider2D other)
    {
        Energy e = other.gameObject.GetComponent <Energy>();

        if (e != null)         //checking if it is a ship
        {
            e.AddEnergy(energy);
            Destroy(gameObject);
        }
    }
Exemplo n.º 4
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "BeDestroyedObject" && transform.GetComponent <Rigidbody2D>().velocity != Vector2.zero)
     {
         Time.timeScale = 0.7f;
         shake.ShakeObject();
         col.gameObject.GetComponent <BeDestroyedObject>().BeginDamage(1);
         energy.AddEnergy(25.0f);
         Time.timeScale = 1f;
     }
 }
Exemplo n.º 5
0
 public void MarkSafe(GameObject unit)
 {
     if (unit.GetComponent <CrabController>() != null)
     {
         unit.GetComponent <CrabController>().Safe();
         en.AddEnergy(unit.GetComponent <CrabController>().giveFood());
         if (!crabUnits.Contains(unit))
         {
             crabUnits.Add(unit);
         }
     }
 }
Exemplo n.º 6
0
    private void StartDash()
    {
        if (Energy.CurrentEnergy >= dashEnergyCost)
        {
            foreach (GameObject actor in GameManager.Instance.actorsContainer.Keys)
            {
                if (actor.CompareTag("Enemy"))
                {
                    actor.GetComponent <Collider2D>().isTrigger = true;
                }
            }

            Energy.AddEnergy(-dashEnergyCost);
            IsInvulnerable = true;
            isMovable      = false;
            animator.SetTrigger("StartDash");
        }
    }
Exemplo n.º 7
0
    public void PerformAction()
    {
        if (food != null)
        {
            Vector3 colliderPosition = blob.transform.position;
            colliderPosition.y += blob.transform.localScale.y / 2;
            Collider[] hitColliders = Physics.OverlapSphere(colliderPosition, 0.25F, 0x0100); // 0x0100 is layermask for layer 8

            if (hitColliders.Any(x => x.gameObject.GetInstanceID() == food.GetInstanceID()))
            {
                energy.AddEnergy(food.GetComponent <Edible>().Bite(1));
                food = null;
                blobMovement.Stop();
            }
        }
        else if (!isWandering)
        {
            blobMovement.Stop();
        }
    }
Exemplo n.º 8
0
    public IEnumerator PluginAnimation(Energy energy)
    {
        _isPlayingBlockingAnimation = true;
        _playerInput.enabled        = false;
        _player.Stop();

        _animator.SetTrigger("plugin");

        yield return(new WaitForSeconds(pluginDuration));

        // TODO: Animate energy
        energy.AddEnergy(energy.maxEnergy);
        yield return(new WaitForSeconds(chargeDuration - pluginDuration));

        _animator.SetTrigger("unplug");
        var unplugDuration = _animator.GetCurrentAnimatorStateInfo(0).length;

        yield return(new WaitForSeconds(unplugDuration));

        _playerInput.enabled        = true;
        _isPlayingBlockingAnimation = false;
    }
Exemplo n.º 9
0
 private void Update()
 {
     energy.AddEnergy(-Time.deltaTime);
 }
Exemplo n.º 10
0
 public void AddEnergy(float energy)
 {
     Energy.AddEnergy(energy);
 }