Example #1
0
    private void Start()
    {
        for (int i = 0; i < groundsList.Count; i++)
        {
            fallingGroundsRigidbody.Add(gameObject.transform.GetChild(i).GetComponent <Rigidbody>());
        }

        foreach (Rigidbody groundRigidbody in fallingGroundsRigidbody)
        {
            groundRigidbody.constraints = RigidbodyConstraints.FreezeAll;
        }

        foreach (GameObject groundPosition in groundsList)
        {
            fallingGroundsPositions.Add(groundPosition.transform.position);
        }

        foreach (GameObject groundRotation in groundsList)
        {
            fallingGroundsRotations.Add(groundRotation.transform.rotation);
        }

        playerRestartedPosition = false;
        gameBoundary            = FindObjectOfType <GameBoundary>();
    }
Example #2
0
    private IEnumerator ProcCheckGround()
    {
        bool _isPlayedSound = false;

        yield return(new WaitForFixedUpdate());

        MyUtility.CoroutineDelay delay = new MyUtility.CoroutineDelay(0.1f);

        float groundOffsetY = 0;

        if (m_refTmRoot != null)
        {
            groundOffsetY = m_refTmRoot.position.y;
        }
        while (true)
        {
            delay.Reset();
            if (m_Rigidbody.velocity.sqrMagnitude < 0.001f)
            {
                EventPullDeskDrawerHandler.AddObjectInsideDrawer(this);
                if (Pivot.position.y - groundOffsetY < 0.2f + ExtentsSize * 1.1f)
                {
                    if (GameBoundary.IsPointInBoundary(Pivot.position))
                    {
                        //m_fTargetEmissionMultiply = m_fEmissionMultiplyOnGround;
                        SetTextureMultiply(m_fEmissionMultiplyOnGround);
                    }
                    else
                    {
                        SetTextureMultiply(0);
                        //m_fTargetEmissionMultiply = 0f;
                    }

                    GameSound.Instance.Play(eSoundID_Common.ItemDrop, Pivot.position);
                    break;
                }
                else
                {
                    if (!_isPlayedSound)
                    {
                        _isPlayedSound = true;
                        GameSound.Instance.Play(eSoundID_Common.ItemDrop, Pivot.position);
                    }
                }
            }
            if (!delay.IsEnd)
            {
                yield return(null);
            }
        }
    }
Example #3
0
 void Start()
 {
     isFalling     = false;
     shiftRow      = 100;
     shiftColumn   = 100;
     boundary      = GameObject.Find("Boundary");
     tgObject      = boundary.transform.GetChild(0).gameObject;
     gb            = (GameBoundary)boundary.GetComponent <GameBoundary>();
     tg            = (TileGenerator)tgObject.GetComponent <TileGenerator>();
     destination   = new Vector2(0, 0);
     downMovement  = new Vector2(0, 0.1f);       // remember to subtract this
     startPosition = new Vector2(0, 0);
     copyObject    = null;
     movingObject  = null;
     headNum       = HEAD_MAX;   // default
 }
Example #4
0
    private void Awake()
    {
        GameBoundary.instance = this;

        this.RecalculateLine();
    }
 // Use this for initialization
 void Start()
 {
     rb2D = GetComponent<Rigidbody2D>();
     gameBoundary = FindObjectOfType<GameBoundary>();
 }