public IHesaplayıcı HesaplayiciFactoryMethod(DortIslem islem)
        {
            IHesaplayıcı sonuc = null;

            switch (islem)
            {
            case DortIslem.Bol:
                sonuc = new Bol();
                break;

            case DortIslem.Carp:
                sonuc = new Carp();
                break;

            case DortIslem.Cikar:
                sonuc = new Cikar();
                break;

            case DortIslem.Topla:
            default:
                sonuc = new Topla();
                break;
            }
            return(sonuc);
        }
Example #2
0
        static void Main(string[] args)
        {
            Enimal leo = new Leopard();
            //leo.Live();
            //leo.Run();
            //leo.Voise();

            Enimal croc = new Crocodile();
            //croc.Live();
            //croc.Crawling();
            //croc.Voise();

            Enimal orel = new Eagle();
            //orel.Live();
            //orel.Fly();
            //orel.Voise();

            Enimal carp = new Carp();
            //carp.Live();
            //carp.Float();
            //carp.Voise();

            List <Enimal> myzoo = new List <Enimal>();

            myzoo.Add(leo);
            myzoo.Add(croc);
            myzoo.Add(orel);
            myzoo.Add(carp);

            foreach (Enimal item in myzoo)
            {
                item.Live();
                item.Voise();

                Mammal  newMammal  = item as Mammal;
                Fish    newFish    = item as Fish;
                Bird    newBird    = item as Bird;
                Reptile newreptile = item as Reptile;

                if (newMammal is Mammal)
                {
                    newMammal.Run();
                }
                else if (newFish is Fish)
                {
                    newFish.Float();
                }
                else if (newBird is Bird)
                {
                    newBird.Fly();
                }
                else if (newreptile is Reptile)
                {
                    newreptile.Crawling();
                }
            }
        }
Example #3
0
    protected void SuperHit(Collision collision)
    {
        //pooling particles on the bat
        if (batParticles != null)
        {
            ParticleSystem go = poolingParticles.Instantiate(batParticles, collision.GetContact(0).point, Quaternion.identity);
            go.Play(true);
        }

        //if hit a carp, call his super hit
        Carp carp = collision.gameObject.GetComponent <Carp>();

        if (carp != null)
        {
            carp.SuperHit();
        }
    }