Exemplo n.º 1
0
 public Mage(string name, int health)
 {
     CharacterClass = "Mage";
     attackBehavior = new FireAttack();
     Name           = name;
     Health         = health;
 }
Exemplo n.º 2
0
 public override void OnFire(Stats playerStats)
 {
     if (playerStats.manna > 0)
     {
         GameObject newBarrier = Instantiate(Barrier);
         playerStats.manna -= 20;
         FireAttack?.Invoke();
         Destroy(newBarrier.gameObject, 5);
     }
 }
Exemplo n.º 3
0
 public override void OnFire(Stats playerStats)
 {
     if (BaseDamageLevel == 0)
     {
         BaseDamageLevel = playerStats.Damage;
         stats           = playerStats;
     }
     playerStats.Damage = BaseDamageLevel + ExtraDamage;
     playerStats.manna--;
     FireAttack?.Invoke();
 }
Exemplo n.º 4
0
        public override Skill Clone(int value)
        {
            var tmp = new FireAttack
            {
                Description = Description,
                MaxValue    = MaxValue,
                Name        = Name,
                Value       = value
            };

            return(tmp);
        }
Exemplo n.º 5
0
    public override void OnFire(Stats playerstats)
    {
        if (MaxTurretsCount > countOfSpawned)
        {
            GameObject newTurret = Instantiate(TurretPrefab);
            newTurret.transform.position = TurretMask.transform.position;

            newTurret.GetComponent <TurretScript>().OnTurretDestroyed.AddListener(() => countOfSpawned--);
            //  newTurret.transform.localScale = Vector3.one;
            countOfSpawned++;
            FireAttack?.Invoke();
        }
    }
Exemplo n.º 6
0
    public override void OnFire(Stats playerStats)
    {
        if (stats.manna > 0)
        {
            Vector3 direction = crossHair.position - transform.position;

            transform.right = direction;
            SkillAnimation.Play("SkillAnimation");

            timeShot = 2;

            stats.manna -= mannaMinus;

            FireAttack?.Invoke();
        }
    }
Exemplo n.º 7
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }

        else if (instance != this)
        {
            Destroy(gameObject);
        }

        fireAttack = FindObjectOfType <FireAttack>();
        player     = FindObjectOfType <Player>();
        playerUI   = FindObjectOfType <PlayerUI>();
    }
Exemplo n.º 8
0
    public override void OnFire(Stats playerStats)
    {
        Debug.Log("fire");
        if (CurrentWeapon != null)
        {
            Debug.Log("fire2");
            if (timeShot <= 0)
            {
                Debug.Log("fire3");
                if (GetComponentInParent <Inventory>().Ammo > 0)
                {
                    Debug.Log("fire");
                    Vector3    direction = shotDir.right;
                    GameObject bullet    = Instantiate(CurrentWeapon.ammo, shotDir.position, transform.rotation);
                    //Debug.Log(bullet.transform.position +"   "+shotDir.position);

                    Vector3 pos = bullet.transform.position;
                    pos.z = 0;
                    bullet.transform.position = pos;
                    bullet.GetComponent <BulletScipt>().TargetTag = "Enemy";
                    bullet.GetComponent <BulletScipt>().Damage    = CurrentWeapon.Damage + (int)playerStats.Damage;
                    if (transform.parent.localScale.x > 0)
                    {
                        bullet.GetComponent <Rigidbody2D>().AddForce(direction * CurrentWeapon.Force);// затем прикладываем к  компоненту Rigidbody2D выктор силы: вправо от объекта Shooter с силой shootForce
                    }
                    else
                    {
                        bullet.GetComponent <Rigidbody2D>().AddForce(-1 * direction * CurrentWeapon.Force); // затем прикладываем к  компоненту Rigidbody2D выктор силы: вправо от объекта Shooter с силой shootForce
                    }
                    Destroy(bullet.gameObject, CurrentWeapon.BulletDestroyTime);                            // уничтожаем копию пули с задержкой
                    timeShot = CurrentWeapon.CoolDown;

                    GetComponentInParent <Inventory>().Ammo--;
                    FireAttack?.Invoke();
                }
            }
        }
    }
Exemplo n.º 9
0
 protected void Awake()
 {
     _fireAttack = GetComponentInParent <FireAttack>();
     gameObject.SetActive(false);
 }
Exemplo n.º 10
0
 // Start is called before the first frame update
 void Start()
 {
     fireAttack = new FireAttack(fire);
     bodyBlow   = GetComponent <BodyBlow>();
     StartCoroutine(AttackIntarval());
 }
Exemplo n.º 11
0
        public void BuildBlocks(string input)
        {
            if (Room.Id == 13)
            {
                buildblocks13(input); return;
            }
            switch (input)
            {
            //BLOCKS

            case "TILE":
                IBlock tile = new FloorBlock(Position);
                Room.blocks.Add(tile);
                break;

            case "BLOK":
                IBlock blok = new RegularBlock(Position);
                Room.blocks.Add(blok);
                break;

            case "RFSH":
                IBlock rfsh = new Face1Block(Position);
                Room.blocks.Add(rfsh);
                break;

            case "LFSH":
                IBlock lfsh = new Face2Block(Position);
                Room.blocks.Add(lfsh);
                break;

            case "SPOT":
                IBlock spot = new SpottedBlock(Position);
                Room.blocks.Add(spot);
                break;

            case "BLCK":
                IBlock blck = new BlackBlock(Position);
                Room.blocks.Add(blck);
                break;

            case "BRIK":
                IBlock brik = new BrickBlock(Position);
                Room.blocks.Add(brik);
                break;

            case "DARK":
                IBlock dark = new DarkBlueBlock(Position);
                Room.blocks.Add(dark);
                break;

            case "STAR":
                IBlock star = new StairsBlock(Position);
                Room.blocks.Add(star);
                break;

            case "STIP":
                IBlock stip = new StripeBlock(Position);
                Room.blocks.Add(stip);
                break;

            case "MVBK":
                IBlock mvbk = new MovingVertBlock(Position);
                Room.blocks.Add(mvbk);
                break;

            case "MLBK":
                IBlock mlbk = new MovingLeftBlock(Position);
                Room.blocks.Add(mlbk);
                break;

            //ENEMIES
            case "BBAT":
                IEntity bat = new BlueBatEnemy(Position);
                Room.enemies.Add(enemyID, bat);
                enemyID++;
                break;

            case "SKLN":
                IEntity skel = new SkeletonEnemy(Position);
                Room.enemies.Add(enemyID, skel);
                enemyID++;
                break;

            case "BOSS":
                IAttack up     = new FireAttack(1);
                IAttack center = new FireAttack(0);
                IAttack down   = new FireAttack(2);
                Room.enemies.Add(enemyID, up);
                enemyID++;
                Room.enemies.Add(enemyID, down);
                enemyID++;
                Room.enemies.Add(enemyID, center);
                enemyID++;
                Room.enemies.Add(enemyID, new FinalBossEnemy(Position, up, center, down));
                enemyID++;
                break;

            case "FIRE":
                IEntity fire = new FireEnemy(Position);
                Room.enemies.Add(enemyID, fire);
                enemyID++;
                break;

            case "GELY":
                IEntity gel = new GelEnemy(Position);
                gel.X = gel.Position.X + FOUR * Global.Var.SCALE;
                gel.Y = gel.Position.Y + FOUR * Global.Var.SCALE;
                Room.enemies.Add(enemyID, gel);
                enemyID++;
                break;

            case "GORY":
                IBoomerang goriyaBoomerang = new BoomerangItem();
                IEntity    goriya          = new GoriyaEnemy(goriyaBoomerang, Position);
                Room.enemyProj.Add(goriyaBoomerang);
                Room.enemies.Add(enemyID, goriya);
                enemyID++;
                break;

            case "HAND":
                IEntity hand = new HandEnemy(Position);
                Room.enemies.Add(enemyID, hand);
                enemyID++;
                break;

            case "OLDM":
                IEntity man = new OldManNPC(Position);
                man.X = man.Position.X + EIGHT * Global.Var.SCALE;
                Room.enemies.Add(enemyID, man);
                enemyID++;
                break;

            case "MNFR":
                IEntity fire1 = new FireEnemy(Position);
                IEntity fire2 = new FireEnemy(Position);
                Room.enemies.Add(enemyID, fire1);
                enemyID++;
                Room.enemies.Add(enemyID, fire2);
                enemyID++;

                IEntity manAndFire = new OldMan_FireEnemy(Position, fire1, fire2);
                manAndFire.X = manAndFire.Position.X + EIGHT * Global.Var.SCALE;
                Room.enemies.Add(enemyID, manAndFire);
                enemyID++;
                break;

            case "SPKE":
                IEntity spike = new SpikeEnemy(Position, spikeNum);
                Room.enemies.Add(enemyID, spike);
                enemyID++;
                spikeNum++;
                if (spikeNum > 4)
                {
                    spikeNum = 1;
                }
                break;


            //ITEMS
            // Probably could use a static bomb and boomerang object now that I think of it.
            case "KEYI":
                IItem key = new KeyItem(Position);
                key.X = key.Position.X + FOUR * Global.Var.SCALE;
                Room.items.Add(key);
                break;

            case "BOWI":
                IItem bow = new BowItem(Position);
                Room.items.Add(bow);
                break;

            case "CLCK":
                IItem clock = new ClockItem(Position);
                Room.items.Add(clock);
                break;

            case "CMPS":
                IItem compass = new CompassItem(Position);
                compass.X = compass.Position.X + TWO * Global.Var.SCALE;
                compass.Y = compass.Position.Y + TWO * Global.Var.SCALE;
                Room.items.Add(compass);
                break;

            case "FARY":
                IItem fairy = new FairyItem(Position);
                Room.items.Add(fairy);
                break;

            case "HCON":
                IItem hcont = new HeartContainerItem(Position);
                hcont.X = hcont.Position.X + ONE * Global.Var.SCALE;
                hcont.Y = hcont.Position.Y + ONE * Global.Var.SCALE;
                Room.items.Add(hcont);
                break;

            case "HART":
                IItem heart = new HeartItem(Position);
                Room.items.Add(heart);
                break;

            case "MAPI":
                IItem map = new MapItem(Position);
                map.X = map.Position.X + FOUR * Global.Var.SCALE;
                Room.items.Add(map);
                break;

            case "RUPE":
                IItem rupee = new RupeeItem(Position);
                Room.items.Add(rupee);
                break;

            case "BOMB":
                IItem bomb = new BombStaticItem(Position);
                Room.items.Add(bomb);
                break;

            case "BMRG":
                IItem boom = new BoomerangStaticItem(Position);
                boom.X = boom.Position.X + BMRG_X_OFFSET * Global.Var.SCALE;
                boom.Y = boom.Position.Y + BMRG_Y_OFFSET * Global.Var.SCALE;
                Room.items.Add(boom);
                break;

            case "BRUP":
                IItem brup = new BlueRupeeItem(Position);
                Room.items.Add(brup);
                break;

            case "TRIF":
                IItem triforce = new TriforceItem(Position);
                triforce.X = triforce.Position.X + ELEVEN * Global.Var.SCALE;
                triforce.Y = triforce.Position.Y + ELEVEN * Global.Var.SCALE;
                Room.items.Add(triforce);
                break;
            }
        }
Exemplo n.º 12
0
 public void SetUpFireAttack()
 {
     fireAttack = new FireAttack(GameObject.Find("FireAttack"),
                                 new AbilitiesDatabaseConn("FireAttack"));
     fireAttack.SetCharacterAnimationController(characterAnimationController);
 }
Exemplo n.º 13
0
 public BlazeJewel1()
 {
     Name  = "Blaze Jewel 1";
     Skill = new FireAttack(1);
     Type  = SlotType.Small;
 }