Пример #1
0
	public override void Init (Flower _flower, int index) {

		if ( isInited )
			return;
		isInited = true;

        base.Init(_flower, index);

        // find component
        if ( follow == null )
            follow = GetComponentInChildren<Petal3DWind>();

        myUpDiff = Global.GetRandomDirectionV3() * 0.1f;
       // chaosFunction = StartCoroutine(GenerateChaos(0.1f));

        petalModelRotateToward = Global.GetRandomDirectionV3();

        // the initial phase position of the petal
        petalModelLinkInit = Random.Range(0,Mathf.PI * 2f);
        // randomize some parameter
        petalModelRotateIntense *= Random.Range(0.5f, 2f);
        petalModelLinkIntense *= Random.Range(0.1f, 5f);
        petalModelLinkInterval *= Random.Range(0.5f, 2f);

        m_rigidbody = GetComponent<Rigidbody2D>();

        // the up force intense is different because of diff shape
        upForceIntense *= Random.Range(0.5f, 2f);

		if ( state == PetalState.Init )
		{
			SetColliderTrigger( false );
		}

     }
Пример #2
0
    public override void Init(Flower _flower, int index)
    {
        if (isInited)
        {
            return;
        }
        isInited = true;

        base.Init(_flower, index);

        // find component
        if (follow == null)
        {
            follow = GetComponentInChildren <Petal3DWind>();
        }

        myUpDiff = Global.GetRandomDirectionV3() * 0.1f;
        // chaosFunction = StartCoroutine(GenerateChaos(0.1f));

        petalModelRotateToward = Global.GetRandomDirectionV3();

        // the initial phase position of the petal
        petalModelLinkInit = Random.Range(0, Mathf.PI * 2f);
        // randomize some parameter
        petalModelRotateIntense *= Random.Range(0.5f, 2f);
        petalModelLinkIntense   *= Random.Range(0.1f, 5f);
        petalModelLinkInterval  *= Random.Range(0.5f, 2f);

        m_rigidbody = GetComponent <Rigidbody2D>();

        // the up force intense is different because of diff shape
        upForceIntense *= Random.Range(0.5f, 2f);

        if (state == PetalState.Init)
        {
            SetColliderTrigger(false);
        }
    }