//int side attacked from 0 for right, 1 for left //int player 1 for player 1 2 for player 2 //TODO have not tested this method public Meele(MeeleDetails mD, int side, PlayerInfo pi) { this.mD = mD; if (side == 0) { direction = -1; minX = pi.x + mD.offsetXRight - (mD.sizeXRight / 2); maxX = pi.x + mD.offsetXRight + (mD.sizeXRight / 2); minY = pi.y + mD.offsetYRight - (mD.sizeYRight / 2); maxY = pi.y + mD.offsetYRight + (mD.sizeYRight / 2); } else { direction = 1; minX = pi.x + mD.offsetXLeft - (mD.sizeXLeft / 2); maxX = pi.x + mD.offsetXLeft + (mD.sizeXLeft / 2); minY = pi.y + mD.offsetYLeft - (mD.sizeYLeft / 2); maxY = pi.y + mD.offsetYLeft + (mD.sizeYLeft / 2); } }
public PlayerInfo(GameObject player) { isPrepFiring = 0; //set first melee to null to allow system to know it is not being used meele = null; this.player = player; //get playerWidth and script this.playerWidth = player.GetComponent <BoxCollider2D>().size.y; this.pScript = player.GetComponent <Player>(); //get the details of firing a projectile as well as the cost of blocking pd = new ProjectileDetails(pScript.projSpeed, pScript.setRangedAttack, pScript.setMeleeAttack); costManaBlock = pScript.manaBlock; //create the hit box of hitting enemy right1 = player.transform.FindChild("RightHitBox").gameObject; BoxCollider2D bcRight1 = right1.GetComponent <BoxCollider2D>(); left1 = player.transform.FindChild("LeftHitBox").gameObject; BoxCollider2D bcLeft1 = left1.GetComponent <BoxCollider2D>(); md = new MeeleDetails(pScript.manaMelee, pScript.setMeleeAttack, bcLeft1.offset.x, bcLeft1.size.x, bcRight1.offset.x, bcRight1.size.x, bcLeft1.offset.y, bcLeft1.size.y, bcRight1.offset.y, bcRight1.size.y); fired = new ArrayList(); Update(); }