Exemple #1
0
    void OnCollision(IPhysicItem item)
    {
        var bagItem = item.View.GetComponent <IPoolBagItem>();

        if (bagItem != null)
        {
            model.GetBag().AddBagItem(bagItem.GetBagItem());
            IgoPoolManager.Unspawn(item.View.gameObject);
            return;
        }


        var ai = item.View.GetComponent <AiController>();

        if (ai != null)
        {
            if (Time.time - oldAiCollisionT > 0.5f)
            {
                oldAiCollisionT = Time.time;


                var direcr = Mathf.Sign(transform.position.x - ai.transform.position.x);
                var vect   = transform.position - ai.transform.position;
                pysicItem.AddVelocity(-pysicItem.velocity);
                pysicItem.AddVelocity(vect.normalized * 14);//new Vector2(direcr*7, 8));

                ai.GetComponent <UnitViewReciver>().PlayAttck();

                Damage(5);
                TweenAlpha(0.2f, true);
                CooldownManager.AddCooldown(0.5f, null, () => {
                    TweenAlpha(0.2f, false);
                });
            }
            ;
            // ai.behaviour.Jamp();
            return;
        }
    }
Exemple #2
0
 protected virtual void UnSpawn()
 {
     IgoPoolManager.Unspawn(gameObject);
 }
Exemple #3
0
 protected override void UnSpawn()
 {
     IgoPoolManager.Unspawn(gameObject);
 }