/// <summary>
    /// 撞人后触发
    /// </summary>
    void OnCollisionEnter(Collision collision)
    {
        if (GlobalData.GetInstance().gameMode == GameMode.OnlineMode)
        {
            return;
        }

        bike bikeScript = collision.transform.GetComponent <bike>();

        if (bikeScript != null && !bikeScript.GetIsAiNPC())
        {
            isFallState = true;
            Invoke("resetIsFallState", 1.0f);

            Vector3 v = transform.InverseTransformPoint(collision.transform.position);
            if (v.x > 0)
            {
                //Debug.Log("you");
                animator.SetBool("zuoshuai", true);
            }
            else if (v.x < 0)
            {
                //Debug.Log("zuo");
                animator.SetBool("youshuai", true);
            }

            BoxCollider boxCol = GetComponent <BoxCollider>();
            boxCol.isTrigger = true;

            zhuangmutouTrigger.transform.parent = null;
            zhuangmutouTrigger.GetComponent <Rigidbody>().isKinematic = false;
            zhuangmutouTrigger.GetComponent <BoxCollider>().isTrigger = false;
        }
    }
Exemple #2
0
    public void setBikePlayer(GameObject bikePlayer)
    {
        if (bikePlayer != null)       // && mBikePlayer == null)
        {
            if (mBikePlayer != null && mBikePlayer.name == bikePlayer.name)
            {
                return;
            }
            //Debug.Log("set camera aim to " + bikePlayer.name);

            Map.Player  = bikePlayer;
            mBikePlayer = bikePlayer;

            bikeScript = mBikePlayer.GetComponent <bike>();
            if (bikeScript == null)
            {
                Debug.LogWarning("BikeCamera::Start -> bikeScript is null!");
            }
            else
            {
                smoothPer = 1f;
                //isClone = true;
                mAimPoint      = bikeScript.mAimPoint;
                mCamPoint_back = bikeScript.mCamPoint_back;
                //mCamPoint_forward = bikeScript.mCamPoint_forward;
                mCamPoint_left = bikeScript.mCamPoint_left;
                //mCamPoint_right = bikeScript.mCamPoint_right;
                //mCamPoint_piaoYi = bikeScript.mCamPoint_piaoYi;
                backPointParent = mCamPoint_back.parent;
                backLocalPos    = mCamPoint_back.localPosition;
                //Debug.Log("setBikePlayer -> init, backLocalPos " + backLocalPos);
            }
        }
    }
 // Use this for initialization
 void Awake()
 {
     BikeGameCtrl.SetPlayerLedCheTou(false, LedCheTou);
     BikeNetScript = GetComponent <bikeNetUnity>();
     BikeScript    = GetComponent <bike>();
     PlayerAni     = GetComponent <Animator>();
     PlayRootAni();
 }
//	void OnCollisionStay (Collision collision)
//	{
//		//Debug.Log("OnCollisionStay -> collision " + collision.gameObject.name);
//		if(GlobalData.GetInstance().gameMode == GameMode.SoloMode)
//		{
//			bike bikeScript = collision.gameObject.GetComponent<bike>();
//			if(bikeScript != null)
//			{
//				bikeScript.setParticleState( true );
//			}
//		}
//		else
//		{
//			bikeNetUnity bikeScript = collision.gameObject.GetComponent<bikeNetUnity>();
//			if(bikeScript != null)
//			{
//				bikeScript.setParticleState( true );
//			}
//		}
//	}

    void OnCollisionExit(Collision collision)
    {
        //Debug.Log("OnCollisionExit -> collision " + collision.gameObject.name);
        if (GlobalData.GetInstance().gameMode == GameMode.SoloMode)
        {
            bike bikeScript = collision.gameObject.GetComponent <bike>();
            if (bikeScript != null)
            {
                bikeScript.setParticleState(false);
            }
        }
        else
        {
            bikeNetUnity bikeScript = collision.gameObject.GetComponent <bikeNetUnity>();
            if (bikeScript != null)
            {
                bikeScript.setParticleState(false);
            }
        }
    }
Exemple #5
0
    public static void Main()
    {
        bike bikeObject = new bike();

        bikeObject.setWheelCount();
        bikeObject.SetYear();
        bikeObject.body = "White";
        Console.WriteLine(bikeObject.body + " " + bikeObject.Year + " vehicle has " + bikeObject.WheelCount + " wheels.");

        car carObject = new car();

        carObject.setWheelCount();
        carObject.SetYear();
        carObject.body = "black";
        Console.WriteLine(carObject.body + " " + carObject.Year + " vehicle has " + carObject.WheelCount + " wheels.");

        //Sealed class instantiation.
        color sealedObject = new color {
            body = "White"
        };

        Console.WriteLine(sealedObject.body);
    }
Exemple #6
0
        static void Main(string[] args)
        {
            car lamborghini = new car();

            lamborghini.color         = "red";
            lamborghini.enginetype    = "petrol 6 litres";
            lamborghini.seatsquantity = 2;

            bike BMW = new bike();

            BMW.color         = "white";
            BMW.enginetype    = "petrol 3 litres biturbo ";
            BMW.seatsquantity = 1;
            BMW.wheelquantity = 2;

            train train = new train();

            train.color         = "black";
            train.color         = "diesel 8 litres";
            train.seatsquantity = 300;
            train.wheelquantity = 20;

            airplane boing = new airplane();

            boing.color         = "white";
            boing.enginetype    = "10 litres diesel";
            boing.seatsquantity = 100;
            boing.wheelquantity = 3;

            Ship Titanic = new Ship();

            Titanic.color         = "white";
            Titanic.enginetype    = "turbo diesel 6 litres";
            Titanic.seatsquantity = 100;
            Titanic.wheelquantity = 0;
        }