public void SetTrapOver()
 {
     trapSystem.AddUsed(transform.position);
     trapSystem.GetNewestChild().SetOn(false, RecycleTrape);
     tool.enabled = false;
     craftFunc    = true;
 }
Beispiel #2
0
    public void OnBuildingTrape()
    {
        if (childProjectSystem.GetFreeNum() <= 0)
        {
            return;
        }
        Vector3 pos = new Vector3(transform.position.x, transform.position.y - 0.6f, transform.position.z);

        childProjectSystem.AddUsed(pos);
        childProjectSystem.GetNewestChild().SetOn(false, fakeCallBack);
    }
Beispiel #3
0
    public void SetTrapOver()
    {
        Vector3 pos = new Vector3(transform.position.x, transform.position.y - 0.6f, transform.position.z);

        childProjectSystem.AddUsed(pos);
        childProjectSystem.GetNewestChild().SetOn(true, RecycleTrape);
        Tool.enabled    = false;
        OnBuildTrapping = false;
        switchMove(true);
        craftSystem.SetFuncBusy(false);
    }
Beispiel #4
0
 public void SetEffect(Vector3 pos, float _size)
 {
     hitEffects.AddUsed(pos);
     hitEffects.GetNewestChild().SetOn(_size);
 }
Beispiel #5
0
    public void MakePoisonOver()
    {
        float angle = -20.0f;
        float dst   = 2.0f;
        //RaycastHit2D detect = Physics2D.Raycast(new Vector2(playerPos.x , playerPos.y), new Vector2(-1.0f,0.0f),4.0f);
        //RaycastHit2D detect2 = Physics2D.Raycast(new Vector2(playerPos.x, playerPos.y), new Vector2(1.0f, 0.0f), 4.0f);
        bool detectWall = (playerPos.y > -4.3f && playerPos.y < 2.6f && (playerPos.x <-11.3f || playerPos.x> 11.3f)) ? true : false;

        if (detectWall)
        {
            //float nearRight = ((playerPos.x - detect1.transform.position.x) > (detect2.transform.position.x - playerPos.x))
            //    ? -1.0f : 1.0f;
            if (Random.Range(0.0f, 1.0f) > 0.5f)
            {
                poisonOffset = new Vector3(0.0f, 1.0f, 0.0f);
            }
            else
            {
                poisonOffset = new Vector3(0.0f, -1.0f, 0.0f);
            }
        }
        else
        {
            if (Random.Range(0.0f, 1.0f) > 0.5f)
            {
                poisonOffset = new Vector3(1.0f, 0.0f, 0.0f);
            }
            else
            {
                poisonOffset = new Vector3(-1.0f, 0.0f, 0.0f);
            }
        }

        poisonAtksPos[0] = playerPos + new Vector3(0.0f, 0.5f, 0.0f);
        poisonAlerts.AddUsed(poisonAtksPos[0]);
        for (int i = 1; i < 4; i++)
        {
            poisonAtksPos[i] = poisonAtksPos[0] + (Quaternion.AngleAxis(angle, Vector3.forward) * poisonOffset * dst);
            dst += 1.0f;
            poisonAlerts.AddUsed(poisonAtksPos[i]);
            angle *= -1;
        }

        Vector3 tempSelfPos = Vector3.zero;

        if (Mathf.Abs(poisonOffset.y) > 0.5f)
        {
            if (poisonOffset.y > 0.0f)
            {
                tempSelfPos = new Vector3(poisonAtksPos[0].x - 1.0f, poisonAtksPos[0].y - 1.0f, transform.position.z);
            }
            else
            {
                tempSelfPos = new Vector3(poisonAtksPos[0].x + 1.0f, poisonAtksPos[0].y + 1.0f, transform.position.z);
            }
        }
        else
        {
            if (poisonOffset.x > 0.0f)
            {
                tempSelfPos = new Vector3(poisonAtksPos[0].x - 1.0f, poisonAtksPos[0].y + 1.0f, transform.position.z);
            }
            else
            {
                tempSelfPos = new Vector3(poisonAtksPos[0].x - Mathf.Sign(poisonOffset.x), poisonAtksPos[0].y + 1.0f, transform.position.z);
            }
        }
        transform.position   = tempSelfPos;
        transform.localScale = new Vector3(-Mathf.Sign(poisonOffset.x), 1.0f, 1.0f);
        levelHieght.SetSpecificHeight(-110.0f);
    }
Beispiel #6
0
    void ThunderAttack()
    {
        if (!b_attacking)
        {
            //rigBody.velocity = Vector2.zero;
            b_attacking = true;
            enemySystem.PlaySound(5, 1.0f);
        }
        inState_time += Time.deltaTime;
        if (subAniState == 1)
        {
            if (state_time < 0.1f)
            {
                state_time = 1.0f;

                //for (int i = 0; i < 3; i++) {
                //    float degree = Random.Range(0.0f, 350.0f);
                //    float dis = Random.Range(0.5f,3.0f);
                //    Vector3 range = dis * ( Quaternion.AngleAxis(degree, new Vector3(0,0,1)) * Vector3.up);
                //    thunderOffsetX = Mathf.Clamp(playerPos.x + range.x, -6.8f, 7.0f);
                //    thunderOffsetY = Mathf.Clamp(playerPos.y + range.y, -1.8f, 8.2f);
                //    //if (thunderOffsetX < -6.8f) thunderOffsetX = -6.8f;
                //    //else if(thunderOffsetX > 7.0f) thunderOffsetX = 7.0f;
                //    //if (thunderOffsetY < -1.8f) thunderOffsetY = -1.8f;
                //    //else if (thunderOffsetY > 8.2f) thunderOffsetY = 8.2f;
                //    Vector3 thunderPos = new Vector3(thunderOffsetX, thunderOffsetY, 0);
                //    thunders.AddUsed(thunderPos);
                //}
                //thunders.AddUsed(playerPos + new Vector3(0,-0.3f,0.0f));
                //打樹
                Vector3 firtreePos = pickItemSystem.SetThunderLoc();
                if (firtreePos.x > -50.0f)
                {
                    thunders.AddUsed(firtreePos);                       //故意設置超過-50即不著火
                }
                //thunderNum++;
            }

            if (thunderNum < 4)
            {
                if (inState_time > 1.2f)
                {
                    inState_time = 0.0f;
                    float degree          = Random.Range(0.0f, 350.0f);
                    int   thunderLimitNum = 0;
                    for (int i = 0; i < 5; i++)
                    {
                        //float disX = Mathf.Clamp(playerPos.x + Random.Range(3.5f, 5.5f), -13.4f, 0.32f);
                        //float disY = Mathf.Clamp(playerPos.x + Random.Range(2.0f, 4.0f), -3.0f, 6.8f);
                        //Vector3 thunderPos = new Vector3(disX, disY, 0);
                        //float dis = 3.0f; //Random.Range(0.5f, 3.0f);
                        Vector3 range = (Quaternion.AngleAxis(degree, new Vector3(0, 0, 1.0f)) * (2.5f * Vector3.up));

                        thunderOffsetX = playerPos.x + range.x;
                        thunderOffsetY = playerPos.y + range.y;
                        if (thunderOffsetX < -7.5f || thunderOffsetX > 10.3f ||
                            thunderOffsetY < -3.3f || thunderOffsetY > 9.2f)
                        {
                            i--;
                            degree += 20.0f;
                            thunderLimitNum++;
                            if (thunderLimitNum > 13)
                            {
                                break;
                            }
                            continue;
                        }
                        Vector3 thunderPos = new Vector3(thunderOffsetX, thunderOffsetY, 0);
                        thunders.AddUsed(thunderPos);
                        //enemySystem.PlaySound(6, 1.0f);
                        degree += 40.0f;
                    }
                    thunders.AddUsed(playerPos + new Vector3(0, -0.3f, 0.0f));
                    enemySystem.PlaySound(6, 1.0f);
                    thunderNum++;
                }
            }
            else
            {
                subAniState++;
                animator.SetBool("nextStep", true);
                state_time   = 0.0f;
                inState_time = 0.0f;
                //Debug.Log(thunderNum);
            }
        }
        else if (subAniState == 2)
        {
            if (state_time <= 0.1f)
            {
                inState_time = 0.0f;
                state_time   = 4.0f;
            }
            if (inState_time >= state_time)
            {
                //Debug.Log("thunder switch2");
                animator.SetBool("nextStep", true);
                subAniState++;
                inState_time = 0.0f;
                state_time   = 0.0f;
            }
        }
        else if (subAniState == 3)
        {
        }
    }
Beispiel #7
0
 public void OnThrowingPeel()
 {
     childProjectSystem.AddUsed(self_pos + new Vector3(0.0f, 1.0f, 0.0f));
 }
 public void OnWeaving()
 {
     childProjectSystem.AddUsed(self_pos);
 }