Esempio n. 1
0
 public WitchController CreateInstance()
 {
     if (W_instace == null)
     {
         W_instace = new WitchController();
     }
     return(W_instace);
 }
Esempio n. 2
0
    float skill_Ontime = 0.0f;         // 스킬이 생성되고 나서부터의 시간
    // Start is called before the first frame update
    void Start()
    {
        this.Witch = GameObject.Find("witch");
        this.transform.position = Witch.transform.position;
        WitchController player_direction = GameObject.Find("witch").GetComponent <WitchController>(); // witch에 부착된 WitchController 스크립트에서 witch의 방향을 호출한다.

        Skill_Move           = (player_direction.playerPos - Witch.transform.position).normalized;    // witch가 디텍팅한 player의 위치로 스킬 방향 벡터 설정
        transform.localScale = player_direction.PlayerScale;                                          // witch의 방향과 같은 방향으로 이미지 설정
    }
Esempio n. 3
0
    //mock atk
    void actionByATK()
    {
        Debug.Log("atk");
        Debug.Log(wizardOfPlayer2Test.Length);
        float[] atkArr = new float[wizardOfPlayer2Test.Length];

        foreach (GameObject i in wizardArr)
        {
            WitchController aWitch = i.GetComponent <WitchController> ();
            if (aWitch.cooldown == aWitch.maxCooldown)
            {
                int rand = Random.Range(0, atkArr.Length);
                if (wizardOfPlayer2Test [rand] == 0)
                {
                    for (int j = 0; j < wizardOfPlayer2Test.Length; j++)
                    {
                        rand = j;
                        if (wizardOfPlayer2Test [rand] != 0)
                        {
                            break;
                        }
                    }
                }
//				while(wizardOfPlayer2Test [rand] != 0) {
//					rand = Random.Range (0,atkArr.Length);
//				}
                atkArr [rand]  += aWitch.ATK;
                aWitch.cooldown = 0;
            }
        }

        //ATK ENEMY TO CLIENT DEVICE
        for (int i = 0; i < atkArr.Length; i++)
        {
            wizardOfPlayer2Test [i] -= atkArr [i];
            Debug.Log(wizardOfPlayer2Test [i]);

            if (wizardOfPlayer2Test [i] < 0)
            {
                atkArr [i] += wizardOfPlayer2Test [i];
                wizardOfPlayer2Test [i] = 0;
            }
        }

        //emit atkArr to socket.io
        JSONObject json     = new JSONObject(JSONObject.Type.OBJECT);
        JSONObject json_arr = new JSONObject(JSONObject.Type.ARRAY);

        json.AddField("atk_arr", json_arr);
        foreach (float i in atkArr)
        {
            json_arr.Add(i);
        }
        socketIO.Emit("ATK_TO_PLAYER", json);
    }
Esempio n. 4
0
    float skill_Ontime = 0.0f;         // 스킬이 생성되고 나서부터의 시간
    // Start is called before the first frame update
    void Start()
    {
        this.Witch = GameObject.Find("witch");
        this.transform.position = Witch.transform.position;
        WitchController player_direction = GameObject.Find("witch").GetComponent <WitchController>(); // witch에 부착된 WitchController 스크립트에서 witch의 방향을 호출한다.

        if (player_direction.dist == "Left")                                                          // Witch가 왼쪽으로 이동 중이면
        {
            Skill_Move           = Vector3.left;                                                      // 벡터 방향 왼쪽
            transform.localScale = new Vector3(1, 1, 1);                                              // 이미지 원본
        }
        else if (player_direction.dist == "Right")                                                    // Witch가 오른쪽으로 이동 중이면
        {
            Skill_Move           = Vector3.right;                                                     // 벡터 방향 오른쪽
            transform.localScale = new Vector3(-1, 1, 1);                                             // 이미지 좌우 반전
        }
    }
Esempio n. 5
0
//	void gameTimeScore (){
//		if (!isGameOver) {
//			gameCounter += Time.deltaTime;
//		}
//		if(gameCounter >= 1){
//			GameObject[] wizardArr = GameObject.FindGameObjectsWithTag ("Wizard");
//			score += 10*wizardArr.Length;
//			gameCounter = 0;
//		}
//	}

    void wizardRitualPhase()
    {
        wizardArr = GameObject.FindGameObjectsWithTag("Wizard");
        int   j = 1;
        float x = -6;
        float y = 0;

        foreach (GameObject i in wizardArr)
        {
//			if (!i.GetComponent<WitchController> ().isRitual) {
//				i.GetComponent<WitchController> ().gameObject.SetActive (false);
//			} else {
//				i.GetComponent<WitchController> ().curHR = 99;
//			}
            WitchController aWitch = i.GetComponent <WitchController> ();
            aWitch.isFreeze = true;
            aWitch.isRitual = true;
            aWitch.changeToHpBar();
//			i.GetComponentInChildren<Canvas> ().enabled = false;
//			GameObject[] prefers = GameObject.FindGameObjectsWithTag ("PreferElement");
//			foreach (GameObject p in prefers) {
//				p.GetComponent<Image> ().enabled = false;
//			}

            //position of wizard in ritual phase;
            if (j == wizardArr.Length && j % 2 != 0)
            {
                y = height * 0.1f;
            }
            else
            {
                y = height * 0.6f - ((height) / (3)) * (j % 2 + 1);
            }
            i.GetComponent <Transform>().position = new Vector3(x, y, 0.1f);
            j += 1;
            if (j % 2 != 0)
            {
                x += 3.5f;
            }
        }
        GameObject[] prefers = GameObject.FindGameObjectsWithTag("PreferElement");
        foreach (GameObject p in prefers)
        {
            p.GetComponent <Renderer> ().enabled = false;
        }
    }
Esempio n. 6
0
    //mock heal all
    void actionByWIS()
    {
        Debug.Log("wis");
        int heal = 0;

        float[] hpArr = new float[wizardArr.Length];
        int     temp  = 0;
        float   min   = 0;

        for (int i = 0; i < wizardArr.Length; i++)
        {
            WitchController aWitch = wizardArr[i].GetComponent <WitchController> ();
            if (aWitch.cooldown == aWitch.maxCooldown)
            {
                if (i == 0 || min > aWitch.curHR && aWitch.curHR != 0)
                {
                    min  = aWitch.curHR;
                    temp = i;
                }
                aWitch.cooldown = 0;
            }
            heal += aWitch.WIS;
        }

        WitchController w = wizardArr[temp].GetComponent <WitchController> ();

        Debug.Log("before" + w.curHR);
        w.curHR += heal;
        Debug.Log("after" + w.curHR);
        if (w.curHR > w.HP)
        {
            w.curHR = w.HP;
        }

        //emit healArr to socket.io
        JSONObject j = new JSONObject(JSONObject.Type.OBJECT);

        j.AddField("wizard_index", temp);
        j.AddField("heal_point", heal);
        socketIO.Emit("WIS_TO_PLAYER", j);
    }
Esempio n. 7
0
    void Awake()
    {
        instance   = this;
        allElement = new GameObject[] {
            bat_prefer,
            bird_prefer,
            cat_prefer,
            candle_prefer,
            hat_prefer,
            hook_prefer,
            pot_prefer,
            star_prefer,
            wand_prefer,
        };
        preferNumber = new int[3];

//		ATKNumber.text = ""+ATK;
//		HPNumber.text = ""+HP;
//		INTNumber.text = ""+INT;
//		WISNumber.text = "" + WIS;
//		AGINumber.text = "" + AGI;
    }
Esempio n. 8
0
    void actionByInt()
    {
        Debug.Log("int");
        float[] intArr = new float[wizardOfPlayer2Test.Length];
        foreach (GameObject i in wizardArr)
        {
            WitchController aWitch = i.GetComponent <WitchController> ();
            if (aWitch.cooldown == aWitch.maxCooldown)
            {
                for (int j = 0; j < intArr.Length; j++)
                {
                    intArr [j] += aWitch.INT;
                }
                aWitch.cooldown = 0;
            }
        }
        for (int i = 0; i < intArr.Length; i++)
        {
            wizardOfPlayer2Test [i] -= intArr [i];
            if (wizardOfPlayer2Test [i] < 0)
            {
                intArr [i] += wizardOfPlayer2Test [i];
                wizardOfPlayer2Test [i] = 0;
            }
        }

        //emit atkArr to socket.io
        JSONObject json_obj = new JSONObject(JSONObject.Type.OBJECT);
        JSONObject json_arr = new JSONObject(JSONObject.Type.ARRAY);

        json_obj.AddField("int_arr", json_arr);
        foreach (float i in intArr)
        {
            json_arr.Add(i);
        }
        socketIO.Emit("INT_TO_PLAYER", json_obj);
    }
Esempio n. 9
0
 void OnMouseDown()
 {
     instance = this;
 }
Esempio n. 10
0
    void Awake()
    {
        instance = this;
        allElement = new GameObject[] {
            bat_prefer,
            bird_prefer,
            cat_prefer,
            candle_prefer,
            hat_prefer,
            hook_prefer,
            pot_prefer,
            star_prefer,
            wand_prefer,
        };
        preferNumber = new int[3];

        //		ATKNumber.text = ""+ATK;
        //		HPNumber.text = ""+HP;
        //		INTNumber.text = ""+INT;
        //		WISNumber.text = "" + WIS;
        //		AGINumber.text = "" + AGI;
    }
Esempio n. 11
0
 void OnMouseDown()
 {
     instance = this;
 }