// Use this for initialization
 void Start()
 {
     initScale            = transform.localScale;
     normal               = CalNormal();
     transform.localScale = scale * (initScale - Vector3.Dot(initScale, normal) * normal) + Vector3.Dot(initScale, normal) * normal;
     name = physicsManager.AddObject("plane", planeMass, normal);
     physicsManager.SetObject(name, normal);
     physicsManager.SetObject(name, bounciness, bounceCombineType);
 }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     initPos = transform.position;
     initVel = vel;
     started = false;
     name    = physicsManager.AddObject("ball", mass, Vector3.zero);
     physicsManager.SetObject(name, mass, vel);
     physicsManager.SetObject(name, bounciness, bounceCombineType);
     physicsManager.AddForce(name, "Earth", ForceType.GRAVITY, physicsManager.CalGravity(mass));
     StartCoroutine(UpdatePosition());
 }
Exemplo n.º 3
0
        public void DropItem(Vector2 position, int dropType, float amount)
        {
            var itemDropObj = m_itemDropPool.CheckOutReturnNull();

            if (itemDropObj == null)
            {
                return;
            }
            itemDropObj.ConvertDrop(dropType, amount);
            m_physicsManager.AddObject(itemDropObj);
            itemDropObj.Position          = position;
            itemDropObj.AccelerationY     = CDGMath.RandomFloat(-720f, -480f);
            itemDropObj.AccelerationX     = CDGMath.RandomFloat(-120f, 120f);
            itemDropObj.Visible           = true;
            itemDropObj.IsWeighted        = true;
            itemDropObj.IsCollidable      = true;
            itemDropObj.AnimationDelay    = 0.05f;
            itemDropObj.Opacity           = 1f;
            itemDropObj.CollectionCounter = 0.2f;
            SoundManager.Play3DSound(itemDropObj, Game.ScreenManager.Player, "CoinCollect1", "CoinCollect2",
                                     "CoinCollect3");
        }
 // Use this for initialization
 void Start()
 {
     initScale = transform.localScale;
     scaleX    = initScale.x;
     scaleZ    = initScale.z;
     normal    = CalNormal();
     //transform.localScale = scale * (initScale - Vector3.Dot(initScale, normal) * normal)+ Vector3.Dot(initScale, normal) * normal;
     transform.localScale = new Vector3(scaleX, initScale.y, scaleZ);
     name = physicsManager.AddObject("plane", planeMass, normal);
     physicsManager.SetObject(name, normal);
     physicsManager.SetObject(name, bounciness, bounceCombineType);
     physicsManager.SetObject(name, friction, frictionCombineType);
 }
Exemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        initPosY                = transform.localPosition.y;
        transform.localScale    = new Vector3(transform.localScale.x, scale * Mathf.Tan(angle), scale);
        transform.localPosition = new Vector3(transform.position.x, initPosY * transform.localScale.y, transform.position.z);
        angle = Mathf.Atan2(transform.localScale.y, transform.localScale.z);

        normal = CalNormal();
        name   = physicsManager.AddObject("bevel", bevelMass, normal);

        physicsManager.SetObject(name, normal);
        physicsManager.SetObject(name, bounciness, bounceCombineType);
    }
    // Use this for initialization
    void Start()
    {
        initScaleH = H.transform.localScale;
        initScaleL = L.transform.localScale;
        initScaleS = S.transform.localScale;



        height = initScaleH.y;
        length = initScaleL.y;

        //transform.localScale = new Vector3(transform.localScale.x, scale*Mathf.Tan(angle), scale);
        //transform.localPosition = new Vector3(transform.position.x, initPosY * transform.localScale.y, transform.position.z);
        //angle = Mathf.Atan2(transform.localScale.y,transform.localScale.z);

        normal = CalNormal();
        name   = physicsManager.AddObject("bevel", bevelMass, normal);

        physicsManager.SetObject(name, normal);
        physicsManager.SetObject(name, bounciness, bounceCombineType);
        physicsManager.SetObject(name, friction, frictionCombineType);
    }