protected override void OnHitTarget(ICapturable monster)
    {
        base.OnHitTarget(monster);
        if (!monster.Capturable)
        {
            return;
        }
        bool _captureSuccess = false;

        monster.Capturable = false;
        _flyTween.Kill();
        Sequence sequence = DOTween.Sequence();

        sequence.Append(GetComponent <Rigidbody>().DOMoveY(3f, 0.5f));
        sequence.AppendCallback(() =>
        {
            _captureSuccess = monster.OnHit(_cpd.CaptureChance + BoostChance);
            if (_captureSuccess)
            {
                GameObject Player = GameObject.FindGameObjectWithTag("Player");
                sequence.Append(GetComponent <Rigidbody>().DOMove(Player.transform.position, 0.5f)
                                .OnComplete(() =>
                {
                    Player.GetComponent <PlayerInventory>().OnEnterBag(new Item(((MonsterBase3D)monster).MonsterData.InBagSprite,
                                                                                ((MonsterBase3D)monster)._monsterTransform));
                    Destroy(gameObject);
                }));
            }
            else
            {
                Destroy(gameObject);
            }
        });
    }
        public void AssignCapturable(GameObject capturable)
        {
            if (capturable == null)
            {
                this._capturable = null;
            }

            GameObject capturableObject = GameObject.Instantiate(capturable, this.transform, false);

            this._capturable = capturableObject.GetComponent <ICapturable>();
        }
Beispiel #3
0
 /// <summary>
 /// When Capture Utility Hit the Capturable Target
 /// </summary>
 /// <param name="monster"></param>
 protected virtual void OnHitTarget(ICapturable monster)
 {
     _CanCapture = false;
 }
Beispiel #4
0
 void Start()
 {
     capturePoint            = new CapturePointOnlyOnce(2.0f, 1.0f, 10.0f, this.gameObject);
     capturePoint.Capturing += CapturePoint_Capturing;
     capturePoint.Captured  += CapturePoint_Captured;
 }
Beispiel #5
0
 public void Capture(ICapturable capturable)
 {
     Global.GameData.AddSilverCoin(1);
     Debug.Log($"Capture --> {capturable.GetStatus().CharaName}");
 }