Commit 90fdb437 authored by 황호기's avatar 황호기

fix miner bugs

the problem of victory and minus mine and bi explosion
parent d5aa8a32
......@@ -17,7 +17,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
......
......@@ -17,7 +17,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = Assembly-CSharp.csproj
Policies = $0
$0.TextStylePolicy = $1
......
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\mine.cs">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\game.cs">
<Files>
<File FileName="Assets\Scripts\mikudayo.cs" Line="57" Column="2" />
<File FileName="Assets\Scripts\LOLingmine.cs" Line="154" Column="21" />
<File FileName="Assets\Scripts\mine.cs" Line="36" Column="21" />
<File FileName="Assets\Scripts\character.cs" Line="293" Column="22" />
<File FileName="Assets\Scripts\game.cs" Line="208" Column="4" />
<File FileName="Assets\Scripts\game.cs" Line="295" Column="1" />
<File FileName="Assets\Scripts\bi.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\mikumiku.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\enemy.cs" Line="174" Column="44" />
<File FileName="Assets\Scripts\mikudayo.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\LOLingmine.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\mine.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\character.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\enemy.cs" Line="1" Column="1" />
<File FileName="Assets\Scripts\game.cs" Line="92" Column="4" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.DebuggingService.Breakpoints>
......
......@@ -105,50 +105,54 @@ public class LOLingmine : mine {
}
moveturn=0;
}
enemycheck (enemies,nowenemy);
enemycheck (enemies,mines,nowenemy,nowmine);
}
public override void explosiontrigger(){
state="explosion";
dmap.minenumber [1]--;
int[,] explosions= new int[3,2];
for (int ind=0; ind<3; ind++) {
switch (direction) {
case 0 :
{
explosions [ind, 0] = positionx+ind;
explosions [ind, 1] = positiony;
break;
}
case 1 :
{
explosions [ind, 0] = positionx-ind;
explosions [ind, 1] = positiony;
break;
}
case 2 :
{
explosions [ind, 0] = positionx;
explosions [ind, 1] = positiony+ind;
break;
}
case 3 :
{
explosions [ind, 0] = positionx;
explosions [ind, 1] = positiony-ind;
break;
}
default :
{
break;
}
if (state != "explosion") {
state = "explosion";
dmap.minenumber [1]--;
int[,] explosions = new int[3, 2];
for (int ind=0; ind<3; ind++) {
switch (direction) {
case 0:
{
explosions [ind, 0] = positionx + ind;
explosions [ind, 1] = positiony;
break;
}
case 1:
{
explosions [ind, 0] = positionx - ind;
explosions [ind, 1] = positiony;
break;
}
case 2:
{
explosions [ind, 0] = positionx;
explosions [ind, 1] = positiony + ind;
break;
}
case 3:
{
explosions [ind, 0] = positionx;
explosions [ind, 1] = positiony - ind;
break;
}
default :
{
break;
}
}
}
GameObject.Find ("Main Camera").GetComponent<game> ().deleteallunit (explosions, 3);
GameObject.Destroy (this.gameObject);
}
GameObject.Find ("Main Camera").GetComponent<game> ().deleteallunit (explosions,3);
GameObject.Destroy(this.gameObject);
}
public override void delete(){
state="explosion";
dmap.minenumber [1]--;
GameObject.Destroy(this.gameObject);
if (state != "explosion") {
state = "explosion";
dmap.minenumber [1]--;
GameObject.Destroy (this.gameObject);
}
}
}
......@@ -8,12 +8,7 @@ public class bi : enemy {
move ();
if (positionx == player.positionx && positiony == player.positiony)
attack ();
for (int ind=0; ind<nowmine; ind++) {
if (positionx == mines [ind].positionx && positiony == mines [ind].positiony) {
mines [ind].delete ();
mineeatcounter++;
}
}
minecheck(mines,nowmine);
if(mineeatcounter>=3){
mineeatcounter=0;
GameObject.Find ("Main Camera").GetComponent<game> ().biexplosion();
......@@ -23,6 +18,14 @@ public class bi : enemy {
state="stand";
}
}
public override void minecheck(mine[] mines,int nowmine){
for (int ind=0; ind<nowmine; ind++) {
if (positionx == mines [ind].positionx && positiony == mines [ind].positiony) {
mines [ind].delete ();
mineeatcounter++;
}
}
}
public override void attack(){
mineeatcounter++;
}
......
......@@ -239,58 +239,59 @@ public class character : MonoBehaviour {
}
public void knuckback(int direction,int size){
for (int ind=0; ind<size; ind++) {
switch (direction) {
case 0:
{
if (positionx != 14 && dmap.mapparts [positiony, positionx + 1] != 0) {
positionx++;
if (state != "dead") {
switch (direction) {
case 0:
{
if (positionx != 14 && dmap.mapparts [positiony, positionx + 1] != 0) {
positionx++;
} else {
state = "stun";
time = 0;
stunturn = dmap.turn + 2;
}
break;
}
else{
state="stun";
time=0;
stunturn=dmap.turn+2;
case 1:
{
if (positionx != 0 && dmap.mapparts [positiony, positionx - 1] != 0) {
positionx--;
} else {
state = "stun";
time = 0;
stunturn = dmap.turn + 2;
}
break;
}
break;
}
case 1:
{
if (positionx != 0 && dmap.mapparts [positiony, positionx - 1] != 0) {
positionx--;
}else{
state="stun";
time=0;
stunturn=dmap.turn+2;
case 2:
{
if (positiony != 14 && dmap.mapparts [positiony + 1, positionx] != 0) {
positiony++;
} else {
state = "stun";
time = 0;
stunturn = dmap.turn + 2;
}
break;
}
break;
}
case 2:
{
if (positiony != 14 && dmap.mapparts [positiony + 1, positionx] != 0) {
positiony++;
}else{
state="stun";
time=0;
stunturn=dmap.turn+2;
case 3:
{
if (positiony != 0 && dmap.mapparts [positiony - 1, positionx] != 0) {
positiony--;
} else {
state = "stun";
time = 0;
stunturn = dmap.turn + 2;
}
break;
}
break;
}
case 3:
{
if (positiony != 0 && dmap.mapparts [positiony - 1, positionx] != 0) {
positiony--;
}else{
state="stun";
time=0;
stunturn=dmap.turn+2;
default :
{
break;
}
break;
}
default :
{
break;
}
}
mygame.knuckresult ();
}
mygame.knuckresult ();
}
}
}
......@@ -64,16 +64,19 @@ public class enemy : MonoBehaviour {
move ();
if (positionx == player.positionx && positiony == player.positiony)
attack ();
for (int ind=0; ind<nowmine; ind++) {
if (positionx == mines [ind].positionx && positiony == mines [ind].positiony) {
mines [ind].explosiontrigger ();
}
}
minecheck(mines,nowmine);
} else if (state == "stun") {
if(stunturn==dmap.turn)
state="stand";
}
}
public virtual void minecheck(mine[] mines,int nowmine){
for (int ind=0; ind<nowmine; ind++) {
if (positionx == mines [ind].positionx && positiony == mines [ind].positiony) {
mines [ind].explosiontrigger ();
}
}
}
public virtual void move(){
direction = Random.Range (0, 4);
switch (direction) {
......
......@@ -88,7 +88,8 @@ public class game : MonoBehaviour {
// Update is called once per frame
void Update () {
clearjudge ();
turnchange ();
if(!gameclear)
turnchange ();
}
void OnGUI()
{
......@@ -170,19 +171,29 @@ public class game : MonoBehaviour {
}
}
public void biexplosion(){
int[,,] explosions = new int[20,9,2];
int explosionumber = 0;
for (int ind2=0; ind2<nowenemy; ind2++) {
if (enemies [ind2] is bi) {
int[,] explosions = new int[9, 2];
for (int y=0; y<3; y++) {
for (int x=0; x<3; x++) {
explosions [3 * y + x, 0] = enemies [ind2].positionx + x - 1;
explosions [3 * y + x, 1] = enemies [ind2].positiony + y - 1;
explosions [explosionumber,3 * y + x, 0] = enemies [ind2].positionx + x - 1;
explosions [explosionumber,3 * y + x, 1] = enemies [ind2].positiony + y - 1;
}
}
deleteallunit (explosions,9);
ind2=-1;
explosionumber++;
}
}
for (int ind2=0; ind2<explosionumber; ind2++) {
int[,] nowexplosion = new int[9,2];
for (int y=0; y<3; y++) {
for (int x=0; x<3; x++) {
nowexplosion [3 * y + x, 0] = explosions [ind2,3 * y + x, 0];
nowexplosion [3 * y + x, 1] = explosions [ind2,3 * y + x, 1];
}
}
deleteallunit(nowexplosion,9);
}
}
public void deleteallunit(int[,] explosions,int explosionnum){
for(int ind=0; ind<explosionnum; ind++){
......
......@@ -10,11 +10,7 @@ public class mikudayo : enemy {
if (positionx == player.positionx && positiony == player.positiony)
attack ();
state=tempstate;
for (int ind=0; ind<nowmine; ind++) {
if (positionx == mines [ind].positionx && positiony == mines [ind].positiony) {
mines [ind].explosiontrigger();
}
}
minecheck(mines,nowmine);
for (int ind=0; ind<nowenemy; ind++) {
if (positionx == enemies [ind].positionx && positiony == enemies [ind].positiony) {
enemies [ind].knuckback (direction,2,mines,nowmine);
......
......@@ -54,24 +54,28 @@ public class mikumiku : mine {
}
plusturn=0;
}
enemycheck (enemies,nowenemy);
enemycheck (enemies,mines,nowenemy,nowmine);
}
public override void explosiontrigger(){
state="explosion";
dmap.minenumber [2]--;
int[,] explosions= new int[9,2];
for (int y=0; y<3; y++) {
for (int x=0; x<3; x++) {
explosions [3*y+x, 0] = positionx+x-1;
explosions [3*y+x, 1] = positiony+y-1;
if (state != "explosion") {
state = "explosion";
dmap.minenumber [2]--;
int[,] explosions = new int[9, 2];
for (int y=0; y<3; y++) {
for (int x=0; x<3; x++) {
explosions [3 * y + x, 0] = positionx + x - 1;
explosions [3 * y + x, 1] = positiony + y - 1;
}
}
GameObject.Find ("Main Camera").GetComponent<game> ().deleteallunit (explosions, 9);
GameObject.Destroy (this.gameObject);
}
GameObject.Find ("Main Camera").GetComponent<game> ().deleteallunit (explosions,9);
GameObject.Destroy(this.gameObject);
}
public override void delete(){
state="explosion";
dmap.minenumber [2]--;
GameObject.Destroy(this.gameObject);
if (state != "explosion") {
state = "explosion";
dmap.minenumber [2]--;
GameObject.Destroy (this.gameObject);
}
}
}
......@@ -17,19 +17,17 @@ public class mine : MonoBehaviour {
}
public virtual void turnAI(enemy[] enemies,mine[] mines,int nowenemy,int nowmine){
enemycheck (enemies,nowenemy);
enemycheck (enemies,mines,nowenemy,nowmine);
}
public void enemycheck(enemy[] enemies,int nowenemy){
public void enemycheck(enemy[] enemies,mine[] mines,int nowenemy,int nowmine){
for(int ind=0;ind<nowenemy;ind++){
if(positionx==enemies[ind].positionx&&positiony==enemies[ind].positiony){
if(enemies[ind] is bi)
bi.mineeatcounter++;
else
explosiontrigger();
enemies[ind].minecheck(mines,nowmine);
}
}
}
public virtual void explosiontrigger(){
if (state != "explosion") {
state="explosion";
dmap.minenumber [0]--;
int[,] explosions= new int[1,2];
......@@ -37,10 +35,13 @@ public class mine : MonoBehaviour {
explosions [0, 1] = positiony;
GameObject.Find ("Main Camera").GetComponent<game> ().deleteallunit (explosions,1);
GameObject.Destroy(this.gameObject);
}
}
public virtual void delete(){
state="explosion";
dmap.minenumber [0]--;
GameObject.Destroy(this.gameObject);
if (state != "explosion") {
state = "explosion";
dmap.minenumber [0]--;
GameObject.Destroy (this.gameObject);
}
}
}
......@@ -14,6 +14,6 @@
000000000000000
000000000000000
9900030000
11100
10000
7
5
......@@ -5,6 +5,7 @@
000000000000000
000000000000000
000000000000000
000321100000000
000000000000000
000000000000000
000000000000000
......@@ -12,8 +13,7 @@
000000000000000
000000000000000
000000000000000
000000000000000
0000000000
00000
0
0
1000000000
10000
5
7
2014-08-25-09-14-09
2014-08-25-08-50-56
2014-08-25-11-03-27
2014-08-29-10-54-42
2014-08-25-11-48-06
2014-08-22-19-28-32
2014-08-29-18-46-23
2014-08-22-19-28-34
2014-08-22-19-28-33
2014-08-22-19-28-35
......
000000030000000
000000020000000
000000010000000
000000010000000
000000010000000
000000010000000
000000010000000
000000212000000
000000111000000
000000111000000
111111000000000
111111000000000
111111000000000
111111000000000
111121000000000
111111000000000
111111000000000
111111000000000
111111000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
9905000000
00000
7
8
000000000000000
0700000000
10000
0
4
111011000000000
111011000000000
111011000000000
111111000000000
111312000000000
111111000000000
111011000000000
111011000000000
111011000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000111000000
000000111000000
000000212000000
000000111000000
000000111000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
9905000000
00000
7
8
0700000000
10000
0
4
101101000000000
111111000000000
201102000000000
001100000000000
111113000000000
001100000000000
201102000000000
111111000000000
101101000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
0000000000
00000
0
0704000000
10000
0
4
121010121000000
101131101000000
121010121000000
010010010000000
111111111000000
010010010000000
121010121000000
101131101000000
121010121000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
000000000000000
0000000000
00000
0
0802000000
10000
0
4
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment