// Resets the player to basic loadout.
        public void InitializeLoadout(Item head, Item body, Item leftArm, Item rightArm, Item legs, Item back, Item core)
        {
            hitPoints = new int[7];
            power     = new float[7];
            loadout[(int)ItemLoc.head]     = head;
            loadout[(int)ItemLoc.body]     = body;
            loadout[(int)ItemLoc.leftArm]  = leftArm;
            loadout[(int)ItemLoc.rightArm] = rightArm;
            loadout[(int)ItemLoc.legs]     = legs;
            loadout[(int)ItemLoc.back]     = back;
            loadout[(int)ItemLoc.core]     = core;

            for (int i = 0; i < loadout.Length; i++)
            {
                hitPoints[i] = loadout[i].itemHitpoints;
            }
            for (int i = 0; i < loadout.Length; i++)
            {
                power[i] = loadout[i].itemPower;
            }
            if (robotType != RobotType.turret)
            {
                RobotFunctions.AnimationSwap(this, (int)ItemLoc.leftArm);
                RobotFunctions.AnimationSwap(this, (int)ItemLoc.rightArm);
                RobotFunctions.AnimationSwap(this, (int)ItemLoc.legs);
            }
            // Check for specials
        }
Esempio n. 2
0
        public void PerformTheItemSwitch(RobotLoadout playerLo)
        {
            string newText = playerLo.loadout[(int)thisItem.itemLoc].itemName + "\nSwitched for\n" + thisItem.itemName;

            np.NotificationsPanelSetEnable(newText);
            RobotFunctions.ReplaceDropPart(this, playerLo);
            RenameAndReset();
        }
Esempio n. 3
0
        void TurretRotationAnimationAndBulletSpawn()
        {
            if (RobotFunctions.FacingDirection(firingArc) != turretFacing)
            {
                turretFacing = RobotFunctions.FacingDirection(firingArc);
                switch (turretFacing)
                {
                case Facing.upperLeft:
                    turretBody.sprite   = turretSprites[0];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[0]);
                    break;

                case Facing.left:
                    turretBody.sprite   = turretSprites[1];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[1]);
                    break;

                case Facing.lowerLeft:
                    turretBody.sprite   = turretSprites[2];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[2]);
                    break;

                case Facing.down:
                    turretBody.sprite   = turretSprites[3];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[3]);
                    break;

                case Facing.lowerRight:
                    turretBody.sprite   = turretSprites[4];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[4]);
                    break;

                case Facing.right:
                    turretBody.sprite   = turretSprites[5];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[5]);
                    break;

                case Facing.upperRight:
                    turretBody.sprite   = turretSprites[6];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[6]);
                    break;

                case Facing.up:
                    turretBody.sprite   = turretSprites[7];
                    bulletSpawnLocation = SpawnLocationFromOffser(bulletSpawnLocations[7]);
                    break;
                }
            }
        }
Esempio n. 4
0
 public void MeleeAttack()
 {
     if (!meleeAttacking)
     {
         MeleeWeapon mw = Database.instance.ItemsMeleeWeapon(roLo.loadout[armLocation]);
         // Stop movement if applicable
         RaycastHit2D enemy = Physics2D.CircleCast(
             new Vector2(transform.position.x, transform.position.y),
             0.15f,
             Vector2.up,
             0.15f,
             enemyMask);
         // TODO this will need to be more universal.
         if (enemy.collider != null)
         {
             print(enemy.collider.gameObject.name);
             if (canSpecial)
             {
                 if (roLo.loadout[armLocation].itemSpecial && roLo.power[(int)roLo.loadout[armLocation].itemLoc] > 0)
                 {
                     roLo.power[(int)roLo.loadout[armLocation].itemLoc] -= Database.instance.ItemSpecialItem(roLo.loadout[armLocation]).specialPowerUse;
                     special.ActivateSpecialActive(roLo.loadout[armLocation], enemy.collider.gameObject);
                 }
             }
             RobotFunctions.DealDamage(Damage(enemy.collider.gameObject), enemy.collider.gameObject, true);
             if (roLo.loadout[armLocation].itemType == ItemType.melee)
             {
                 Utilities.PlaySoundEffect(roLo.loadout[armLocation].itemSound[0]);
             }
             else
             {
                 Utilities.PlaySoundEffect(Database.instance.items[3].itemSound[0]);
             }
         }
         else
         {
             if (roLo.loadout[armLocation].itemType == ItemType.melee)
             {
                 Utilities.PlaySoundEffect(roLo.loadout[armLocation].itemSound[1]);
             }
             else
             {
                 Utilities.PlaySoundEffect(Database.instance.items[3].itemSound[1]);
             }
         }
         meleeAttacking = true;
     }
 }
 private void StartDeath()
 {
     // Add if player later
     if (doesItDrop && !dropped)
     {
         if (bossSpawned)
         {
             int itemID = RobotFunctions.DropByID(this, 34);
             DropItem(itemID);
         }
         else
         {
             int itemID = RobotFunctions.DropByID(this, dropOffset);
             DropItem(itemID);
             if (itemID != -1)
             {
                 int itemLoc = (int)Database.instance.items[itemID].itemLoc;
                 GetComponent <RobotAnimationController> ().RemoveSprite(itemLoc);
             }
         }
         dropped = true;
     }
     else
     {
         GameManager.instance.playerAlive = false;
     }
     Collider2D[] colliders = GetComponents <Collider2D> ();
     foreach (Collider2D col in colliders)
     {
         col.enabled = false;
     }
     if (robotType == RobotType.turret)
     {
         Destroy(gameObject);
     }
     if (robotType == RobotType.boss)
     {
         Destroy(gameObject);
     }
     dead = true;
 }
Esempio n. 6
0
 void OnTriggerEnter2D(Collider2D coll)
 {
     RobotFunctions.DealDamage(damage, coll.gameObject, false);
     Destroy(gameObject);
 }