public static void ReplaceDropPart(Drops drop, RobotLoadout player) { Item tempItem = IdentifyReplacePart(drop.thisItem, player); for (int i = 0; i < player.loadout.Length; i++) { if (player.loadout[i].itemLoc == drop.thisItem.itemLoc) { player.loadout[i] = drop.thisItem; // switch players items heath with drops health drop.thisItem = tempItem; int tempHP = player.hitPoints[i]; player.hitPoints[i] = drop.hitPoints; drop.hitPoints = tempHP; // switch players items power with drops power float tempPower = player.power[i]; player.power[i] = drop.power; drop.power = tempPower; if (player.loadout[i].itemType == ItemType.melee || player.loadout[i].itemType == ItemType.range || player.loadout[i].itemLoc == ItemLoc.legs) { AnimationSwap(player, i); } if (player.loadout[i].itemSpecial) { Debug.Log("Checking Specials"); player.GetComponent <PlayerSpecial> ().ActivateSpecialPassive(player.loadout[i]); } break; } } }
public static void ReplacePart(Item item, RobotLoadout robot) { for (int i = 0; i < robot.loadout.Length; i++) { if (robot.loadout[i].itemLoc == item.itemLoc) { robot.loadout[i] = item; robot.hitPoints[i] = item.itemHitpoints; // switch players items power with drops power robot.power[i] = item.itemPower; if (robot.loadout[i].itemType == ItemType.melee) { AnimationSwap(robot, i); } else if (robot.loadout[i].itemType == ItemType.range) { AnimationSwap(robot, i); } if (robot.loadout[i].itemSpecial) { Debug.Log("Checking Specials"); robot.GetComponent <PlayerSpecial> ().ActivateSpecialPassive(robot.loadout[i]); } break; } } }
private void OnEnable() { player = GameObject.FindGameObjectWithTag("Player").transform; rolo = GetComponent <RobotLoadout> (); StartCoroutine(DefineRotation()); StartCoroutine(SpawnBullets(rolo.loadout[3])); }
void Start() { special = GetComponentInParent <PlayerSpecial> (); canSpecial = GetComponentInParent <PlayerSpecial> (); roLo = GetComponentInParent <RobotLoadout> (); StartMovement(); }
private void PlayerPickupDrop(GameObject player) { RobotLoadout playerLo = player.GetComponent <RobotLoadout> (); if (TutorialFunctions.instance) { if (thisItem.itemType == ItemType.range) { TutorialFunctions.instance.DialogueTriggerValue(2); } if (thisItem.itemLoc == ItemLoc.core || thisItem.itemLoc == ItemLoc.back) { TutorialFunctions.instance.DialogueTriggerValue(3); } } if (Database.instance.ArmIsambidextrous(thisItem)) { print("Item can go on either arm."); ItemWheel itemWheel = FindObjectOfType <ItemWheel> (); itemWheel.PickupWeaponWheel(thisItem, this); } else { PerformTheItemSwitch(playerLo); } }
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(); }
void Start () { roLo = GetComponent<RobotLoadout> (); special = GetComponent<PlayerSpecial> (); np = FindObjectOfType<NotificationsPanel> (); rb = GetComponent<Rigidbody2D> (); PlayerSpawn (); dodgeAvailable = true; }
// Use this for initialization void Start() { roLo = GetComponent <RobotLoadout> (); anim = GetComponent <Animator> (); arms = GetComponentsInChildren <Animator> (); isPlayer = GetComponent <PlayerController> (); aoc = new AnimatorOverrideController(anim.runtimeAnimatorController); anim.runtimeAnimatorController = aoc; }
void Start() { attack = GetComponentInChildren <RobotAttack> (); animCont = GetComponentInParent <RobotAnimationController> (); anim = GetComponent <Animator> (); roLo = GetComponentInParent <RobotLoadout> (); isPlayer = GetComponentInParent <PlayerController> (); aoc = new AnimatorOverrideController(anim.runtimeAnimatorController); anim.runtimeAnimatorController = aoc; }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; roLo = GetComponent <RobotLoadout> (); BasicEnemySetup(); for (int i = 0; i < roLo.loadout.Length; i++) { roLo.hitPoints[i] = Mathf.RoundToInt(roLo.hitPoints[i] / 2); } parentRoom = GetComponentInParent <RoomGeneration> (); }
void Start() { player = GameObject.FindGameObjectWithTag("Player").transform; roLo = GetComponent <RobotLoadout> (); BasicEnemySetup(); attack = Mathf.RoundToInt((roLo.loadout[(int)ItemLoc.rightArm].itemDamage + roLo.loadout[(int)ItemLoc.leftArm].itemDamage) / 2); for (int i = 0; i < roLo.loadout.Length; i++) { roLo.hitPoints[i] = Mathf.RoundToInt(roLo.hitPoints[i] / 2); } }
static Item IdentifyReplacePart(Item item, RobotLoadout player) { Item tempItem = new Item(); for (int i = 0; i < player.loadout.Length; i++) { if (player.loadout[i].itemLoc == item.itemLoc) { tempItem = player.loadout[i]; RobotAnimationController.UpdatePlayerSprites = true; return(tempItem); } } return(tempItem); }
// Use this for initialization void Start() { rolo = GetComponent <RobotLoadout> (); parentRoom = GetComponentInParent <RoomGeneration> (); rolo.InitializeLoadout( new Item(), Database.instance.items[1], new Item(), Database.instance.items[18], new Item(), new Item(), new Item() ); StartCoroutine(DefineRotation()); StartCoroutine(SpawnBullets(rolo.loadout[3])); }
public static void AnimationSwap(RobotLoadout robot, int i) { RobotAnimationController mainAnim = robot.GetComponent <RobotAnimationController> (); RobotArmsAnim[] anim = robot.GetComponentsInChildren <RobotArmsAnim> (); if (robot.loadout[i].itemLoc == ItemLoc.leftArm) { anim[0].SwapWeapons(robot.loadout[i].itemAnim); } if (robot.loadout[i].itemLoc == ItemLoc.rightArm) { anim[1].SwapWeapons(robot.loadout[i].itemAnim); } if (robot.loadout[i].itemLoc == ItemLoc.legs) { mainAnim.SwapLegs(robot.loadout[i].itemAnim); } }
// Use this for initialization void Start() { coll = GetComponent <CapsuleCollider2D> (); tracking = transform.position; player = FindObjectOfType <PlayerController> (); pathfinding = GetComponent <Pathfinding> (); cNavMesh = GetComponentInParent <CustomNavMesh> (); myRoom = GetComponentInParent <RoomGeneration> (); roLo = GetComponent <RobotLoadout> (); anims = GetComponentsInChildren <Animator> (); if (enemyType == 0) { basic = GetComponent <BasicEnemy> (); } if (enemyType == 1) { rangeShort = GetComponent <RangeShortEnemy> (); } }
IEnumerator SpawnBullets(Item weapon) { RangedWeapon rw = Database.instance.ItemsRangedWeapon(weapon); RobotLoadout roLo = FindObjectOfType <PlayerController> ().GetComponent <RobotLoadout> (); int itemLoc = (int)weapon.itemLoc; localCooldown = true; firing = true; // loop breaks if you stop firing, run out of power or run out of health while (firing && roLo.power[itemLoc] > 0 && roLo.hitPoints[itemLoc] > 0) { for (int i = 0; i < rw.rangedWeaponSpread; i++) { GameObject bullet = Instantiate(Resources.Load("bulletFriendly", typeof(GameObject))) as GameObject; bullet.GetComponent <BulletWeapon> ().BulletSetup(rw, transform.position, FiringArc); //COMMENTED OUT FOR SOUND BUG, REPEATS ON EVERY SHOT AT MAX VOLUME //Utilities.PlaySoundEffect (roLo.loadout[armLocation].itemSound[0]); } roLo.power[itemLoc] -= rw.rangeWeaponPowerUse; yield return(new WaitForSeconds(rw.rangeWeaponRateOfFire)); } localCooldown = false; }
public static int DropByID(RobotLoadout roLo, int dropOffset) { GameManager.RandomDropModifier += 5; int dropItemID = -1; int rand = Random.Range(0, 100); if (rand <= 35 + GameManager.RandomDropModifier + dropOffset) { GameManager.RandomDropModifier = 0; List <int> avalibleItems = new List <int> (); //Item[] playerInv = player.GetComponent<RobotLoadout>().loadout; int maxMultiplier = 5; for (int i = 0; i < roLo.loadout.Length; i++) { // If the item is not one of the basics. if (roLo.loadout[i].itemID > 6 || itemDropMultiplier[i] >= maxMultiplier) { // If the player doesn't have the item TODO remove this maybe. //if (roLo.loadout[i].itemID != playerInv[i].itemID) //{ // add that items ID to a List for (int j = 0; j < itemDropMultiplier[i]; j++) { Debug.Log("Doing this thing"); avalibleItems.Add(roLo.loadout[i].itemID); } //} } } if (avalibleItems.Count > 0) { int rand2 = Random.Range(0, avalibleItems.Count); dropItemID = avalibleItems[rand2]; } } return(dropItemID); }
IEnumerator Bleed(SpecialItems special, RobotLoadout enemyLo) { List <int> liveParts = new List <int> (); for (int i = 0; i < enemyLo.hitPoints.Length; i++) { if (enemyLo.hitPoints[i] > 0) { liveParts.Add(i); // twice as likely to hit everything but the head if (enemyLo.loadout[i].itemLoc != ItemLoc.head) { liveParts.Add(i); } } } int rand = Random.Range(0, liveParts.Count); while (enemyLo.hitPoints[liveParts[rand]] > 0 || enemyLo) { enemyLo.hitPoints[liveParts[rand]] -= special.specialDamage; yield return(new WaitForSeconds(special.specialDuration)); } }
// Use this for initialization void Start() { rolo = GetComponent <RobotLoadout> (); rolo.hitPoints[1] = 100; spRender = GetComponent <SpriteRenderer> (); }
void BleedEnemy(SpecialItems special, GameObject enemy) { RobotLoadout enemyLo = enemy.GetComponent <RobotLoadout> (); StartCoroutine(Bleed(special, enemyLo)); }
void Start() { playerLo = GetComponent <RobotLoadout> (); }