Exemplo n.º 1
0
    public override void UsingItem( )
    {
        switch (conchState)
        {
        //set mermaid man position and active it
        //change conch state to FLY
        case CONCH_STATE.INIT:
            Vector3 initPos = camera.ViewportToWorldPoint(new Vector3(1.0f, Random.Range(0.0f, 1.0f), camera.nearClipPlane));
            mermaidMan.SetPos(initPos);
            mermaidMan.gameObject.SetActive(true);
            conchState = CONCH_STATE.FLY;
            break;

        //keep tracking mermaid man position if out of viewport deactivate it
        case CONCH_STATE.FLY:
            if (camera.WorldToViewportPoint(mermaidMan.Position).x <= -0.5f)
            {
                mermaidMan.gameObject.SetActive(false);
                mermaidMan.Init();
                BeforeEndState();
            }
            break;
        }
    }
Exemplo n.º 2
0
 //reset conch state to init and init the conch
 protected override void BeforeEndState( )
 {
     conchState = CONCH_STATE.INIT;
     InitUnuse( );
 }
Exemplo n.º 3
0
 //get props from gameManager
 protected override void Start( )
 {
     props      = GameManager.instance.attribution.allItemProps [(int)EItem.CONCH];
     conchState = CONCH_STATE.INIT;
     mermaidMan.gameObject.SetActive(false);
 }