Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Player player = new Player();

            Ork ork1 = new Ork();

            //ork1.PrintMethod();
            DarkWizard darkWizard = new DarkWizard();
            //darkWizard.PrintMethod();
            NPC npc2 = new DarkWizard();

            //npc2.PrintMethod();

            NPC[] ncps =
            {
                new DarkWizard(),
                new Enemy(),
                new DarkWizard(),
                new NPC()
            };
            ncps[0].PrintMethod();
            ncps[1].PrintMethod();
            ncps[2].PrintMethod();
            ncps[3].PrintMethod();

            Console.ReadLine();
        }
Ejemplo n.º 2
0
    private void Attack()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))                                                                   // Check the button strings in Project Settings->Input Manager
        {
            myAnimator.SetTrigger("Attacking");                                                                                 // Activate the animation

            Collider2D[] enemiesToHit = Physics2D.OverlapCircleAll(hurtBox.position, attackRadius, LayerMask.GetMask("Enemy")); // OverlapCircleAll returns an array of Collider2Ds
            Collider2D[] bossHit      = Physics2D.OverlapCircleAll(hurtBox.position, attackRadius, LayerMask.GetMask("Boss"));

            foreach (Collider2D enemy in enemiesToHit)
            {
                Enemy e = enemy.GetComponent <Enemy>();
                if (e != null)
                {
                    e.Dying(); // Get a reference to the script of a collider in the array and call the method Dying()
                }
            }

            foreach (Collider2D boss in bossHit)
            {
                DarkWizard d = boss.GetComponent <DarkWizard>();
                if (d != null)
                {
                    d.Hit();
                }
            }
        }
    }
        public void Setup()
        {
            Armor armor = new Armor();
            DefaultDefenseItem defaultDefenseItem = new DefaultDefenseItem();
            Helmet             helmet             = new Helmet();
            Shield             shield             = new Shield();

            //attackItems
            Axe               axe               = new Axe();
            Bow               bow               = new Bow();
            DarkSword         darkSword         = new DarkSword();
            Sword             sword             = new Sword();
            DefaultAttackItem defaultAttackItem = new DefaultAttackItem();

            //healthItems
            Bandage bandage = new Bandage();
            CureBox cureBox = new CureBox();
            Poison  poison  = new Poison();

            //magicItems
            DefaultMagicItem defaultMagicItem = new DefaultMagicItem();
            Excalibur        excalibur        = new Excalibur();
            SpellsBook       spellsBook       = new SpellsBook();
            Spell            spell1           = new Spell();
            Spell            spell2           = new Spell();

            Staff staff = new Staff();


            //heroes
            Dwarf  dwarf  = new Dwarf("Enano", axe, helmet, shield);
            Elf    elf    = new Elf("Elfo", bow, armor, helmet);
            Knight knight = new Knight("Caballero", sword, armor, shield);
            Wizard wizard = new Wizard("Gandalf", staff, shield, armor, spellsBook);

            //villanos
            DarkWizard darkWizard = new DarkWizard("Saruman", staff, armor, spellsBook);
            Demonio    demonio    = new Demonio("Lanthos", sword, armor);
            Dragon     dragon     = new Dragon("Shiva", bow, armor);
            Orco       orco       = new Orco("Ugly", axe, helmet);
        }
Ejemplo n.º 4
0
        private void DummyLoadLevel()
        {
            // DummyLoadGoblin(new Vector2(10.0f, 10.0f));
            // DummyLoadGoblin(new Vector2(15.0f, 10.0f));
            // DummyLoadGoblin(new Vector2(50.0f, 30.0f));
            // DummyLoadGoblin(new Vector2(35.0f, 20.0f));
            DarkWizard       darkwiz   = new DarkWizard(GameSession.NextID);
            PhysicsComponent darkwizPc = new PhysicsComponent(darkwiz.Id);

            darkwizPc.Type     = PhysicsComponent.PhysicsType.NONE;
            darkwizPc.Position = new Vector2(40.0f, 10.0f);
            darkwizPc.Hitbox   = MathUtils.GetRectangleHitbox(new Vector2(0, 1), 0.5f, 0.5f);
            _gs.PhysicsManager.Add(darkwizPc);
            RenderComponent darkwizRc = new RenderComponent(darkwiz.Id);

            darkwizRc.SpriteID = 1;
            _gs.RenderManager.Add(darkwizRc);
            _gs.EntityManager.Add(darkwiz);

            DummyLoadHero(new Vector2(25.0f, 25.0f));
        }
Ejemplo n.º 5
0
    void Start()
    {
        //get component
        myRigidbody = GetComponent <Rigidbody2D>();
        myAnimator  = GetComponent <Animator>();
        dw          = GameObject.FindGameObjectWithTag("Player").GetComponent <DarkWizard>();

        //fly to target
        fireTarget = dw.target;
        if (fireTarget == null)
        {
            if (dw.exitIndex == 0)
            {
                fireDirection = Vector2.up;
            }
            else if (dw.exitIndex == 1)
            {
                fireDirection = Vector2.right;
            }
            else if (dw.exitIndex == 2)
            {
                fireDirection = Vector2.down;
            }
            else if (dw.exitIndex == 3)
            {
                fireDirection = Vector2.left;
            }
            float angle = Mathf.Atan2(fireDirection.y, fireDirection.x) * Mathf.Rad2Deg;
            myRigidbody.velocity = fireDirection * fireSpeed;
            transform.rotation   = Quaternion.AngleAxis(angle, Vector3.forward);
        }
        else
        {
            Vector2 direction = fireTarget.position - transform.position;
            myRigidbody.velocity = direction.normalized * fireSpeed;
            float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg;
            transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
        }
    }
Ejemplo n.º 6
0
        public static void Main(string[] args)
        {
            DarkWizard dark = new DarkWizard("Emo", 56);

            System.Console.WriteLine(dark);
        }
Ejemplo n.º 7
0
 private void Start()
 {
     dw           = GetComponentInParent <DarkWizard>();
     enemyInRange = new List <GameObject>();
 }