コード例 #1
0
    void Awake()
    {
        lastMessage = new Message_Respawn(networkUID, new Vector3D(), new Quaternion(), false);

        health = GetComponent <Health>();
        actor  = GetComponent <Actor>();

        if (health == null)
        {
            Debug.LogError("health was null on player " + gameObject.name);
        }
        else
        {
            health.OnDeath.AddListener(Death);
        }

        detacher = GetComponentInChildren <TempPilotDetacher>();
        //gears = GetComponentsInChildren<GearAnimator>();
        //shifter = GetComponentInChildren<FloatingOriginShifter>();
        ejection = GetComponentInChildren <EjectionSeat>();
        ejection.OnEject.AddListener(Eject);
        detacher.OnDetachPilot.AddListener(Eject);
        //ejectorSeatPos = ejection.transform.localPosition;
        //ejectorSeatRot = ejection.transform.localRotation;

        //target = detacher.cameraRig.transform.parent;
        //ejectorParent = ejection.gameObject.transform.parent;
        //if (ejection.canopyObject != null) {
        //    canopyParent = ejection.canopyObject.transform.parent;
        //    canopyPos = ejection.canopyObject.transform.localPosition;
        //    canopyRot = ejection.canopyObject.transform.localRotation;
        //}

        effects = GetComponentsInChildren <EngineEffects>();
    }
コード例 #2
0
        public override void Run()
        {
            GameObject currentVehicle = VTOLAPI.instance.GetPlayersVehicleGameObject();

            EjectionSeat seat = currentVehicle.GetComponentInChildren <EjectionSeat>();

            Traverse.Create(seat).Field("seatObject").SetValue(seat.gameObject);
            Traverse.Create(seat).Method("FixedUpdateDelayedCanopyJett").GetValue();
        }
コード例 #3
0
        public static string getEjectionState(GameObject vehicle)
        {
            string ejectionState;

            try
            {
                EjectionSeat ejection = vehicle.GetComponentInChildren <EjectionSeat>();
                ejectionState = ejection.ejected.ToString();
            }
            catch (Exception)
            {
                ejectionState = "Unavailable";
            }

            return(ejectionState);
        }
コード例 #4
0
        public override _Car ManufactureCar(CarModels carModel, List <CarExtras> carExtras)
        {
            _Car car = null;

            if (carModel == CarModels.ModelS)
            {
                car = new ModelS();
            }
            else if (carModel == CarModels.Roadster)
            {
                car = new Roadster();
            }

            //Notice that the Cybertruck is missing here, so we cant manufacture it!
            if (car == null)
            {
                Debug.Log("Sorry but this factory cant manufacture this model :(");

                return(car);
            }


            //Add the extras
            foreach (CarExtras carExtra in carExtras)
            {
                if (carExtra == CarExtras.DracoThruster)
                {
                    car = new DracoThruster(car, 1);
                }
                else if (carExtra == CarExtras.EjectionSeat)
                {
                    car = new EjectionSeat(car, 1);
                }
                else
                {
                    Debug.Log("Sorry but this factory cant add this car extra :(");
                }
            }

            return(car);
        }