Esempio n. 1
0
    public override void updateEffect()
    {
        if (isEffecting)
        {
            return;
        }

        forward = this.thePlayer.transform.forward;

        if (!updatedArrow)
        {
            updatedArrow = ((GameObject)GameObject.Instantiate(Arrow2)).GetComponentInChildren <extraWeapon> ();
            updatedArrow.setPlayer(this.thePlayer);
        }
        else
        {
            updatedArrow.gameObject.SetActive(true);
        }

        Vector3 positionNew = thePlayer.transform.position + new Vector3(0, 0.8f * thePlayer.transform.localScale.y + 0.2f, forward.normalized.z * 0.1f);

        updatedArrow.transform.localScale *= thePlayer.transform.localScale.y;
        updatedArrow.transform.position    = positionNew;

        updatedArrow.transform.forward = thePlayer.transform.forward;
        //Destroy (updatedArrow, arrowLife);
        Invoke("makeUpdatedArrowOver", arrowLife);
    }
Esempio n. 2
0
    private void makeArrow()
    {
        //print ("气剑指");
        //没有控制者就不发
        if (this.thePlayer && isEffecting)
        {
            //CancelInvoke ();//不同脚本调用同样的效果的时候这句话就很关键了

            forward = this.thePlayer.transform.forward;
            //考虑到多种连发的情况,暂时还是不做弹矢的对象池子,后期优化吧
            if (!ArrowUsing)
            {
                ArrowUsing = (GameObject)GameObject.Instantiate(Arrow);
                theWeaponEffectController = ArrowUsing.GetComponentInChildren <extraWeapon> ();
                theWeaponEffectController.setPlayer(this.thePlayer);
            }

            ArrowUsing.transform.forward = thePlayer.transform.forward;

            float extraX = Camera.main.transform.rotation.eulerAngles.x;
            extraX = extraX > 180 ? extraX - 360 : extraX;
            extraX = Mathf.Clamp(extraX, -10f, 3f);
            //print ("theExtraX = "+ extraX);
            ArrowUsing.transform.Rotate(new Vector3(extraX, 0, 0), Space.Self);

            Vector3 positionNew = thePlayer.transform.position + new Vector3(0, 0.8f * thePlayer.transform.localScale.y + 0.2f, forward.normalized.z * 0.07f);
            ArrowUsing.transform.localScale *= thePlayer.transform.localScale.y;
            ArrowUsing.transform.position    = positionNew;

            //Destroy (ArrowUsing, arrowLife);
            ArrowUsing.SetActive(true);
            isEffecting = false;

            Invoke("effectDestoryExtra", timerForEffect);
        }
    }
Esempio n. 3
0
    public override void Init()
    {
        lifeTimerAll         = 5.5f;
        timerForEffect       = 0.2f;
        theEffectName        = "千方残光剑";
        theEffectInformation = "向前方锥形发射" + arrowCounts + "束特殊剑气\n攻击命中额外追加(" + hpup * 100 + "%+" + hpupTrueUseExtra + ")生命偷取\n每束剑气最多对三个目标造成伤害,持续" + arrowLife + "秒" +
                               "\n冷却时间为" + (lifeTimerAll - timerForEffect) + "秒,冷却中使用此技可释放普通剑气";
        makeStart();
        if (!Arrow)
        {
            Arrow = (GameObject)Resources.Load("effects/ziyingarrow2");
        }
        if (!Arrow2)
        {
            Arrow2 = (GameObject)Resources.Load("effects/ziyingarrow");
        }
        makeFlashList();

        //print ("气剑指");
        //没有控制者就不发
        if (this.thePlayer)
        {
            if (isEffecting)
            {
                GameObject theArrow;
                for (int i = 0; i < arrowCounts; i++)
                {
                    //四元数的方法在这里似乎不是很好用
                    //forward = Quaternion.AngleAxis((float)(45*i), new Vector3(0,1,0)) *this.thePlayer.transform.forward ;
                    //print ("forward = "+ forward);
                    if (theArrows.Count < i + 1 || theArrows [i] == null)
                    {
                        theArrow = (GameObject)GameObject.Instantiate(Arrow);
                        extraWeapon A = theArrow.GetComponentInChildren <extraWeapon> ();
                        A.setPlayer(this.thePlayer);
                        theArrows.Add(A);
                    }
                    else
                    {
                        theArrows [i].gameObject.SetActive(true);
                        theArrow = theArrows [i].gameObject;
                    }

                    Vector3 positionNew = thePlayer.transform.position + new Vector3(0, 0.8f * thePlayer.transform.localScale.y + 0.2f, forward.normalized.z * 0.07f);
                    theArrow.transform.localScale *= thePlayer.transform.localScale.y;
                    theArrow.transform.position    = positionNew;

                    theArrow.transform.forward = this.thePlayer.transform.forward;
                    theArrow.transform.Rotate(new Vector3(0, (float)(-angleForArrow * (arrowCounts / 2) + angleForArrow * i), 0));

                    if (arrowCounts % 2 == 0)
                    {
                        theArrow.transform.Rotate(new Vector3(0, (float)(angleForArrow / 2), 0));
                    }

                    theArrow.transform.forward = theArrow.transform.forward;
                    //Destroy (theArrow, arrowLife);
                    Destroy(this, lifeTimerAll);
                    Invoke("makeArrowOver", arrowLife);
                    Invoke("shutEffecting", arrowLife);
                }
            }
        }
    }