Ejemplo n.º 1
0
        protected override void OnSelected(PlayerBehaviour player)
        {
            _spriteRenderer.color = new Color(0.7f, 0.7f, 0.7f, 1);

            player.BindInteraction(KeyCode.P, "收集",
                                   new Action(() =>
            {
                SendMessage("OnPlayerPickup", player);
            }));
        }
Ejemplo n.º 2
0
        IEnumerator KillAnimaCoroutine(PlayerBehaviour player)
        {
            var alpha = 1f;

            while (alpha >= 0)
            {
                alpha -= Time.deltaTime * 5;

                _spriteRenderer1.color =
                    new Color(
                        _spriteRenderer1.color.r,
                        _spriteRenderer1.color.g,
                        _spriteRenderer1.color.b,
                        alpha);
                _spriteRenderer2.color =
                    new Color(
                        _spriteRenderer2.color.r,
                        _spriteRenderer2.color.g,
                        _spriteRenderer2.color.b,
                        alpha);

                _spriteRenderer1.transform.position += Vector3.down * Time.deltaTime;
                _spriteRenderer2.transform.position += Vector3.down * Time.deltaTime;

                yield return(1);
            }

            var entityChunk = Entity.GetChunk();

            if (entityChunk == null)
            {
                yield break;
            }

            var fallingItem = envElement.GetFallingItem();

            entityChunk.CreateDropItem(fallingItem.itemProxy?.Name, fallingItem.count, transform.position);

            Entity.BeKilled(player.Entity);
        }
Ejemplo n.º 3
0
 protected virtual void OnSelected(PlayerBehaviour player)
 {
 }
Ejemplo n.º 4
0
 protected override void OnUnselected(PlayerBehaviour player)
 {
     _spriteRenderer1.color = Color.white;
     _spriteRenderer2.color = Color.white;
 }
Ejemplo n.º 5
0
 void OnPlayerCollect(PlayerBehaviour player)
 {
     StartCoroutine(KillAnimaCoroutine(player));
 }
Ejemplo n.º 6
0
 void OnPlayerOpen(PlayerBehaviour player)
 {
     _inventoryBehaviour.ShowUI();
 }
Ejemplo n.º 7
0
 protected void OnPlayerPickup(PlayerBehaviour player)
 {
     _pickupBy = player.Inventory;
 }
Ejemplo n.º 8
0
 void OnPlayerOpen(PlayerBehaviour player)
 {
     _inventoryBehaviour.ShowUI();
     var craftTablePannel = _inventoryBehaviour.GetPannel().GetComponent <CraftTablePannel>();
 }