//在UI的开始按钮中调用
    //在UI的开始按钮中调用
    public void InitVelo()
    {
        if (anim == null)
        {
            anim = this.GetComponent <Animator>();
        }
        if (scriPropUI == null)
        {
            scriPropUI = GameObject.FindGameObjectWithTag("PropUI").GetComponent <PropUI>();
        }
        if (rigidHaze == null)
        {
            rigidHaze = this.GetComponent <Rigidbody2D>();
        }
        anim.SetBool("isBegin", true);
        StartCoroutine("Attack");
        Destroy(objectMark);
        rigidHaze = this.GetComponent <Rigidbody2D>();
        float city     = Application.loadedLevelName[0] - '0';
        float custPass = Application.loadedLevelName[2] - '0';

        RandomVeloMul(city, custPass);//随机NPC的速度
        defaVelocity       = new Vector2(CityHoriVelo(city, custPass), CityVertiVelo(city, custPass));
        rigidHaze.velocity = new Vector2(defaVelocity.x, 0);
        Debug.Log(defaVelocity + "46541561651651");
    }
	void Start () {
        GameObject temp = (GameObject)GameObject.FindGameObjectWithTag("Player");
        playerTrans = temp.GetComponent<Transform>();
        scriPlay = temp.GetComponent<PlayerControl>();
        GameObject objectPropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");
        propUI = objectPropUI.GetComponent<PropUI>();
       
	}
Ejemplo n.º 3
0
    void Start()
    {
        GameObject temp = (GameObject)GameObject.FindGameObjectWithTag("Player");

        playerTrans = temp.GetComponent <Transform>();
        scriPlay    = temp.GetComponent <PlayerControl>();
        GameObject objectPropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");

        propUI = objectPropUI.GetComponent <PropUI>();
    }
Ejemplo n.º 4
0
 public void Init(Vector3 posi)
 {
     this.transform.position = posi;
     Rigidbody2D rigid2D = this.GetComponent<Rigidbody2D>();
     rigid2D.velocity = new Vector2(15, 0);
     GameObject gamePropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");
     scriPropUI = gamePropUI.GetComponent<PropUI>();
     isInit = true;
     Transform transChild = transform.FindChild("Hotspot").GetComponent<Transform>();
     transChild.parent = null;
     Destroy(transChild.gameObject);
 }
Ejemplo n.º 5
0
    public void Init(Vector3 posi)
    {
        this.transform.position = posi;
        Rigidbody2D rigid2D = this.GetComponent <Rigidbody2D>();

        rigid2D.velocity = new Vector2(15, 0);
        GameObject gamePropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");

        scriPropUI = gamePropUI.GetComponent <PropUI>();
        isInit     = true;
        Transform transChild = transform.FindChild("Hotspot").GetComponent <Transform>();

        transChild.parent = null;
        Destroy(transChild.gameObject);
    }
 //在UI的开始按钮中调用
 //在UI的开始按钮中调用
 public void InitVelo()
 {
     if (anim == null)
         anim = this.GetComponent<Animator>();
     if (scriPropUI == null)
         scriPropUI = GameObject.FindGameObjectWithTag("PropUI").GetComponent<PropUI>();
     if (rigidHaze == null)
         rigidHaze = this.GetComponent<Rigidbody2D>();
     anim.SetBool("isBegin", true);
     StartCoroutine("Attack");
     Destroy(objectMark);
     rigidHaze = this.GetComponent<Rigidbody2D>();
     float city = Application.loadedLevelName[0] - '0';
     float custPass = Application.loadedLevelName[2] - '0';
     RandomVeloMul(city, custPass);//随机NPC的速度
     defaVelocity = new Vector2(CityHoriVelo(city, custPass), CityVertiVelo(city, custPass));
     rigidHaze.velocity = new Vector2(defaVelocity.x, 0);
     Debug.Log(defaVelocity + "46541561651651");
 }
Ejemplo n.º 7
0
    /****************************************
     * paraTransPlayer 用于确立绳子的起始位置
     * paraTransHaze   用于确立绳子的结束位置
     * 操作结果:设置绳子的起始与终止位置,设置绳子的宽度
     ****************************************/
    //函数在初始化绳子的时候被调用

    //巫焕哲修改
    //添加一个参数 Transform CamTra,用于传入摄像机

    public void InitRope(Transform paraTransPlayer, Transform paraTransHaze,Transform CamTra)
    {
        lineRender = this.GetComponent<LineRenderer>();//实例化的时候start函数执行出错,所以在这里获取脚本
        scriPropUI = GameObject.FindGameObjectWithTag("PropUI").GetComponent<PropUI>();
        transPlayer = paraTransPlayer;
        playerControl = paraTransPlayer.GetComponent<PlayerControl>();
        transNearestHaze = paraTransHaze;//设置NPC的为位置
        SetPosi();//设置绘制绳子时的起始于终点位置
        lineRender.SetWidth(widthBegin, widthEnd);
		isInit = true;

        //巫焕哲添加
        //
        float cameraMovDis = endPosi.x - transPlayer.position.x;
        GameObject.Instantiate(ropeEffect, transPlayer.position, Quaternion.identity);
        transPlayer.position = endPosi;

        //巫焕哲添加
        //用于把摄像机移动一段距离

        CamTra.position = new Vector3(CamTra.position.x + cameraMovDis, CamTra.position.y, CamTra.position.z);
        Debug.Log("PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP" + cameraMovDis);
    }
    /****************************************
    * paraTransPlayer 用于确立绳子的起始位置
    * paraTransHaze   用于确立绳子的结束位置
    * 操作结果:设置绳子的起始与终止位置,设置绳子的宽度
    ****************************************/
    //函数在初始化绳子的时候被调用

    //巫焕哲修改
    //添加一个参数 Transform CamTra,用于传入摄像机

    public void InitRope(Transform paraTransPlayer, Transform paraTransHaze, Transform CamTra)
    {
        lineRender       = this.GetComponent <LineRenderer>();//实例化的时候start函数执行出错,所以在这里获取脚本
        scriPropUI       = GameObject.FindGameObjectWithTag("PropUI").GetComponent <PropUI>();
        transPlayer      = paraTransPlayer;
        playerControl    = paraTransPlayer.GetComponent <PlayerControl>();
        transNearestHaze = paraTransHaze; //设置NPC的为位置
        SetPosi();                        //设置绘制绳子时的起始于终点位置
        lineRender.SetWidth(widthBegin, widthEnd);
        isInit = true;

        //巫焕哲添加
        //
        float cameraMovDis = endPosi.x - transPlayer.position.x;

        GameObject.Instantiate(ropeEffect, transPlayer.position, Quaternion.identity);
        transPlayer.position = endPosi;

        //巫焕哲添加
        //用于把摄像机移动一段距离

        CamTra.position = new Vector3(CamTra.position.x + cameraMovDis, CamTra.position.y, CamTra.position.z);
        Debug.Log("PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP" + cameraMovDis);
    }
	void Start () 
    {
        objectPropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");
        propUI = objectPropUI.GetComponent<PropUI>();
	}
Ejemplo n.º 10
0
    void Start()
    {
        GameObject objectPropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");

        propUI = objectPropUI.GetComponent <PropUI>();
    }
Ejemplo n.º 11
0
	void Start () {
        GameObject gamePropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");
        scriPropUI = gamePropUI.GetComponent<PropUI>();
	}
Ejemplo n.º 12
0
    void Start()
    {
        GameObject gamePropUI = (GameObject)GameObject.FindGameObjectWithTag("PropUI");

        scriPropUI = gamePropUI.GetComponent <PropUI>();
    }
 void Awake()
 {
     anim = this.GetComponent<Animator>();
     scriPropUI = GameObject.FindGameObjectWithTag("PropUI").GetComponent<PropUI>();
     rigidHaze = this.GetComponent<Rigidbody2D>();
 }
 void Awake()
 {
     anim       = this.GetComponent <Animator>();
     scriPropUI = GameObject.FindGameObjectWithTag("PropUI").GetComponent <PropUI>();
     rigidHaze  = this.GetComponent <Rigidbody2D>();
 }