コード例 #1
0
ファイル: LevelManager.cs プロジェクト: AtwoodDeng/Dandelion
	public WindAdv GetWind()
	{
		if ( wind != null ) 
			return wind;
		GameObject windObj = GameObject.FindWithTag( "Wind");

		if ( windObj != null )
		{
			wind = windObj.GetComponent<WindAdv>();
		}
		return wind;
	}
コード例 #2
0
    public WindAdv GetWind()
    {
        if (wind != null)
        {
            return(wind);
        }
        GameObject windObj = GameObject.FindWithTag("Wind");

        if (windObj != null)
        {
            wind = windObj.GetComponent <WindAdv>();
        }
        return(wind);
    }
コード例 #3
0
    void UpdateWindTest()
    {
        // update velocity
        velocity += windVelocity * WindVelSense * Time.deltaTime * 30f;
        velocity  = Vector2.ClampMagnitude(velocity, maxVel * (1f + windVelocity.magnitude / 2f));
        velocity *= 0.98f;

        rotateVel += Vector3.Cross(transform.up, windVelocity * WindRotateSense).z *Time.deltaTime * 30f;

        rotateVel  = Mathf.Clamp(rotateVel, maxRotVel, -maxRotVel);
        rotateVel *= 0.98f;

        // update position & rotation
        Vector3 pos = transform.localPosition;

        pos += Global.V2ToV3(velocity) * Time.deltaTime;

        if (wind == null)
        {
            wind = GetComponentInParent <WindAdv>();
        }
        if (wind != null)
        {
            if (pos.x > wind.GetSize().x / 2 + 0.1f)
            {
                pos.x -= wind.GetSize().x;
            }
            if (pos.x < -wind.GetSize().x / 2 - 0.1f)
            {
                pos.x += wind.GetSize().x;
            }
            if (pos.y > wind.GetSize().y / 2 + 0.1f)
            {
                pos.y -= wind.GetSize().y;
            }
            if (pos.y < -wind.GetSize().y / 2 - 0.1f)
            {
                pos.y += wind.GetSize().y;
            }
        }

        pos.z = Global.WIND_UI_Z;
        transform.localPosition = pos;
        model.transform.Rotate(rotateToward * rotateVel * Time.deltaTime);
    }
コード例 #4
0
    public void OnWindButton()
    {
        if (Time.time - windButtonTime < 2f)
        {
            return;
        }

        WindAdv wind = LogicManager.LevelManager.GetWind();

        if (wind.UIShowed)
        {
            wind.HideUI();
        }
        else
        {
            wind.ShowUI();
        }
        windButtonTime = Time.time;
    }
コード例 #5
0
ファイル: WindTest.cs プロジェクト: AtwoodDeng/Dandelion
	void UpdateWindTest()
	{
		
		// update velocity
		velocity += windVelocity * WindVelSense * Time.deltaTime * 30f ;
		velocity = Vector2.ClampMagnitude( velocity , maxVel * ( 1f + windVelocity.magnitude / 2f ) );
		velocity *= 0.98f;

		rotateVel += Vector3.Cross(transform.up, windVelocity * WindRotateSense ).z * Time.deltaTime * 30f;

		rotateVel = Mathf.Clamp(rotateVel, maxRotVel, -maxRotVel);
		rotateVel *= 0.98f;

		// update position & rotation
		Vector3 pos = transform.localPosition;
		pos += Global.V2ToV3( velocity ) * Time.deltaTime;

		if ( wind == null )
		{
			wind = GetComponentInParent<WindAdv>();
		}
		if ( wind != null )
		{
		if ( pos.x > wind.GetSize().x / 2 + 0.1f )
			pos.x -= wind.GetSize().x ;
		if ( pos.x < - wind.GetSize().x / 2 - 0.1f )
			pos.x += wind.GetSize().x ;
		if ( pos.y > wind.GetSize().y / 2 + 0.1f)
			pos.y -= wind.GetSize().y ;
		if ( pos.y < - wind.GetSize().y / 2 - 0.1f )
			pos.y += wind.GetSize().y ;
		}

		pos.z = Global.WIND_UI_Z;
		transform.localPosition = pos;
		model.transform.Rotate( rotateToward * rotateVel * Time.deltaTime );
	}
コード例 #6
0
    void OnDoubleTapBack(TapGesture g)
    {
        WindAdv wind = LogicManager.LevelManager.GetWind();

        wind.UISwitch();
    }