Exemple #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);
            }));
        }
Exemple #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);
        }
 protected virtual void OnSelected(PlayerBehaviour player)
 {
 }
Exemple #4
0
 protected override void OnUnselected(PlayerBehaviour player)
 {
     _spriteRenderer1.color = Color.white;
     _spriteRenderer2.color = Color.white;
 }
Exemple #5
0
 void OnPlayerCollect(PlayerBehaviour player)
 {
     StartCoroutine(KillAnimaCoroutine(player));
 }
 void OnPlayerOpen(PlayerBehaviour player)
 {
     _inventoryBehaviour.ShowUI();
 }
Exemple #7
0
 protected void OnPlayerPickup(PlayerBehaviour player)
 {
     _pickupBy = player.Inventory;
 }
 void OnPlayerOpen(PlayerBehaviour player)
 {
     _inventoryBehaviour.ShowUI();
     var craftTablePannel = _inventoryBehaviour.GetPannel().GetComponent <CraftTablePannel>();
 }