Beispiel #1
0
 public void CheckSeat()
 {
     if(this.transform.childCount <=0){
         Active = false;
         passenger = null;
     }
 }
    private void getInThePlane()
    {
        Airplane plane = (Airplane)GameObject.FindObjectOfType(typeof(Airplane));

        SpawnAI();

        if (plane != null)
        {
            GameObject[] allPlayer = GameObject.FindGameObjectsWithTag("Player");
            PlayersAliveMax = allPlayer.Length;
            for (int i = 0; i < allPlayer.Length; i++)
            {
                Vehicle planev = plane.GetComponent <Vehicle>();
                if (planev != null)
                {
                    int             openseat = planev.FindOpenSeatID();
                    CharacterDriver driver   = allPlayer[i].GetComponent <CharacterDriver>();
                    if (driver != null)
                    {
                        planev.GetInTheVehicle(driver, openseat);
                    }
                }
            }
        }
    }
    GameObject targetGameObject; // The GameObject that this editor uses

    #endregion Fields

    #region Methods

    void OnEnable()
    {
        this.editorSkin = (GUISkin)(Resources.LoadAssetAtPath("Assets/Editor/EditorGUISkin.guiskin", typeof(GUISkin)));

        this.scriptOfOurType = (CharacterDriver)target;
        this.targetGameObject = (GameObject)this.scriptOfOurType.gameObject;
    }
Beispiel #4
0
    void OnEnable()
    {
        this.editorSkin = (GUISkin)(Resources.LoadAssetAtPath("Assets/Editor/EditorGUISkin.guiskin", typeof(GUISkin)));

        this.scriptOfOurType  = (CharacterDriver)target;
        this.targetGameObject = (GameObject)this.scriptOfOurType.gameObject;
    }
Beispiel #5
0
        public FunctionExecuter()
        {
            this.player = GameObject.FindGameObjectWithTag("Player");

            this.gamemanager = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameManager>();

            this.driver = player.GetComponent <CharacterDriver>();

            functionmap.Add("playerpos", (Func <List <ParserTypes.FArg>, object>)playerpos);
            functionmap.Add("currentmap", (Func <List <ParserTypes.FArg>, object>)currentmap);

            functionmap.Add("setplayerpos", (Func <List <ParserTypes.FArg>, object>)setplayerpos);
            functionmap.Add("~setplayerpos", (Func <List <ParserTypes.FArg>, object>)setplayerpos_rel);

            functionmap.Add("vector3", (Func <List <ParserTypes.FArg>, object>)vectorthree);


            functionmap.Add("setmap", (Func <List <ParserTypes.FArg>, object>)setmap);
            functionmap.Add("debug", (Func <List <ParserTypes.FArg>, object>)debug);

            functionmap.Add("initquest", (Func <List <ParserTypes.FArg>, object>)initquest);

            functionmap.Add("setvar", (Func <List <ParserTypes.FArg>, object>)setvar);
            functionmap.Add("getvar", (Func <List <ParserTypes.FArg>, object>)getvar);

            functionmap.Add("applystatuseffects", (Func <List <ParserTypes.FArg>, object>)applystatuseffects);

            functionmap.Add("getplayerhealth", (Func <List <ParserTypes.FArg>, object>)getplayerhealth);

            functionmap.Add("additems", (Func <List <ParserTypes.FArg>, object>)additems);

            functionmap.Add("getitems", (Func <List <ParserTypes.FArg>, object>)getitems);
            functionmap.Add("getitemschema", (Func <List <ParserTypes.FArg>, object>)getitemschema);
        }
Beispiel #6
0
 private void Start()
 {
     _player                 = GetComponent <Player>();
     _characterDriver        = GetComponent <CharacterDriver>();
     _interactionHandler     = GetComponent <InteractionHandler>();
     _playerControllerPrefix = GetPlayerPrefix(GameControls.Instance.GetPlayerController(_player.Number));
 }
Beispiel #7
0
 // Use this for initialization
 void Start()
 {
     _characterDriver   = GetComponent <CharacterDriver>();
     _goTowardsTarget   = true;
     _inPlay            = true;
     transform.position = _startingPosition;
     _tray = GetComponentInChildren <DrinkPlacement>();
 }
Beispiel #8
0
 public void CheckSeat()
 {
     if (this.transform.childCount <= 0)
     {
         Active    = false;
         passenger = null;
     }
 }
Beispiel #9
0
 public void GetInTheVehicle(CharacterDriver driver, int seatID)
 {
     if (driver && seatID != -1 && seatID >= 0 && seatID < Seats.Length)
     {
         driver.CurrentVehicle     = this;
         Seats[seatID].PassengerID = driver.character.UserID;
         Seats[seatID].passenger   = driver;
     }
 }
Beispiel #10
0
 public void GetOutTheVehicle(CharacterDriver driver)
 {
     for (int i = 0; i < Seats.Length; i++)
     {
         if (Seats[i].PassengerID == driver.character.UserID)
         {
             Seats[i].PassengerID = "none";
             return;
         }
     }
 }
Beispiel #11
0
 public void GetOutTheVehicle(CharacterDriver driver)
 {
     Debug.Log("Get out this car " + driver.netId.ToString());
     for (int i = 0; i < Seats.Length; i++)
     {
         if (Seats[i].PassengerID == driver.netId.Value)
         {
             Seats[i].PassengerID = -1;
             return;
         }
     }
 }
    // Update is called once per frame
    void Update()
    {
        if (dialogue != lastDialogue)
        {
            leftSide  = dialogue.leftPlayers[0];
            rightSide = dialogue.rightPlayers[0];

            currentDialogue         = 0;
            dialogue.sprite.enabled = false;
        }
        if (leftSide != null && rightSide != null)
        {
            rightSide.transform.position = transform.position + direction.normalized * initialDistance;


            leftSide.transform.position = transform.position - direction.normalized * initialDistance;
        }
        if (dialogue != null)
        {
            blur.enabled        = true;
            transform.position += (startPosition - transform.position) * snapSpeed * Time.deltaTime;
            if (dialogue.dialogueBoxes[currentDialogue].active == false)
            {
                dialogue.dialogueBoxes[currentDialogue].SetActive(true);
                leftSide.GetComponent <Animator>().SetBool("Talking", dialogue.leftSideTalking[currentDialogue]);
                rightSide.GetComponent <Animator>().SetBool("Talking", !dialogue.leftSideTalking[currentDialogue]);
            }
            if (dialogue.texts[currentDialogue].GetComponent <TextTyper>().done)
            {
                leftSide.GetComponent <Animator>().SetBool("Talking", false);
                rightSide.GetComponent <Animator>().SetBool("Talking", false);
            }
            if (dialogue.texts[currentDialogue].GetComponent <TextTyper>().done&& (Input.GetAxis(continueAxis) > .8f))
            {
                dialogue.dialogueBoxes[currentDialogue].SetActive(false);
                currentDialogue++;
            }
            if (currentDialogue == dialogue.texts.Length)
            {
                CharacterDriver cd = dialogue.goAfterDone as CharacterDriver;
                cd.go    = true;
                dialogue = null;
            }
        }
        else
        {
            blur.enabled = false;

            transform.position += ((startPosition + endPositionOffset) - transform.position) * snapSpeed * Time.deltaTime;
        }

        lastDialogue = dialogue;
    }
Beispiel #13
0
 public void CleanSeat()
 {
     CharacterDriver[] pasengers = (CharacterDriver[])this.transform.GetComponentsInChildren<CharacterDriver> ();
     for (int i=0; i<pasengers.Length; i++) {
         if (pasengers [i]) {
             pasengers [i].transform.parent = null;
         }
     }
     Active = false;
     passenger = null;
     Debug.Log(" Clean Seat! "+SeatID);
 }
Beispiel #14
0
 public void GetOut(CharacterDriver driver)
 {
     if (driver) {
         Active = false;
         driver.transform.parent = null;
         driver.character.controller.enabled = true;
         driver.DrivingSeat = null;
         passenger = null;
         if(VehicleRoot!=null)
             VehicleRoot.UpdateSeat (driver, this, false);
     }
 }
Beispiel #15
0
 public void GetIn(CharacterDriver driver)
 {
     if (driver) {
         Active = true;
         driver.transform.position = this.transform.position;
         driver.transform.parent = this.transform;
         driver.character.controller.enabled = false;
         driver.DrivingSeat = this;
         driver.LastSeat = SeatID;
         passenger = driver;
         if(VehicleRoot!=null)
             VehicleRoot.UpdateSeat (driver, this, true);
     }
 }
Beispiel #16
0
 public void OnSeat(CharacterDriver driver, bool sit)
 {
     if (driver) {
         if (sit) {
             Active = true;
             passenger = driver;
             driver.character.controller.enabled = false;
             driver.DrivingSeat = this;
         } else {
             driver.transform.parent = null;
             driver.character.controller.enabled = true;
             driver.DrivingSeat = null;
             passenger = null;
         }
     }
 }
Beispiel #17
0
    void Start()
    {
        character  = gameObject.GetComponent <CharacterSystem>();
        Driver     = gameObject.GetComponent <CharacterDriver>();
        SkyDrive   = gameObject.GetComponent <CharacterSkyDriving>();
        PlayerView = gameObject.GetComponent <PlayerView>();

        motor = GetComponent <CharacterMotor>();
        if (GetComponent <Rigidbody>())
        {
            GetComponent <Rigidbody>().freezeRotation = true;
        }

        originalRotation = transform.localRotation;
        if (PlayerView)
        {
            fovTemp   = PlayerView.FPSCamera.MainCamera.fieldOfView;
            fovTarget = fovTemp;
        }
    }
Beispiel #18
0
    public void CleanSeat()
    {
        CharacterDriver[] pasengers = (CharacterDriver[])this.transform.GetComponentsInChildren <CharacterDriver>();
        for (int i = 0; i < pasengers.Length; i++)
        {
            if (pasengers[i])
            {
                if (pasengers[i].transform.parent != null)
                {
                    pasengers[i].NoVehicle();
                }

                pasengers[i].transform.parent = null;
                pasengers[i].DrivingSeat      = null;
                pasengers[i] = null;
            }
        }
        if (passenger)
        {
            passenger.NoVehicle();
            passenger = null;
        }
    }
Beispiel #19
0
    void UpdatePassengerOnSeats()
    {
        hasDriver = false;
        for (int i = 0; i < Seats.Length; i++)
        {
            if (Seats[i].PassengerID != "none")
            {
                // Searching for a player with passenger id to snap them into a vehicle.
                GameObject obj = findPlayerByID(Seats[i].PassengerID);
                if (obj)
                {
                    CharacterDriver driver = obj.GetComponent <CharacterDriver>();

                    if (driver)
                    {
                        driver.NeedParachute = NeedParachute;

                        FPSController fps = driver.GetComponent <FPSController>();
                        if (fps)
                        {
                            fps.FixedRotation();
                        }

                        if (Seats[i].ForceView != PlayerViewType.None)
                        {
                            PlayerView view = driver.GetComponent <PlayerView>();
                            if (view)
                            {
                                view.View          = Seats[i].ForceView;
                                view.OrbitDistance = Seats[i].ViewDistance;
                            }
                        }
                        if (Seats[i].FixRotation)
                        {
                            driver.transform.rotation = Seats[i].transform.rotation;
                        }
                        driver.character.Motor.grounded     = false;
                        driver.transform.position           = Seats[i].transform.position;
                        driver.transform.parent             = Seats[i].transform;
                        driver.CurrentVehicle               = this;
                        driver.character.controller.enabled = false;
                        driver.DrivingSeat = Seats[i];
                        hasDriver          = true;
                        if (driver.character.IsAlive == false)
                        {
                            Seats[i].PassengerID = "none";
                        }
                    }
                }
            }
            else
            {
                Seats[i].CleanSeat();
            }
        }

        if (isServer)
        {
            GenSeatsData();
        }
    }
Beispiel #20
0
 public void UpdateSeat(CharacterDriver driver, Seat seat, bool sit)
 {
     driver.OnVehicle (VehicleID, seat.SeatID, sit);
 }
Beispiel #21
0
 // Use this for initialization
 void Start()
 {
     _cd = GetComponent <CharacterDriver>();
 }
Beispiel #22
0
    void UpdatePassengerOnSeats()
    {
        hasDriver = false;
        for (int i = 0; i < Seats.Length; i++)
        {
            if (Seats[i].PassengerID != -1)
            {
                //搜索具有乘客ID的玩家将其捕捉到车辆中。
                NetworkInstanceId passengerid = new NetworkInstanceId((uint)Seats[i].PassengerID);
                GameObject        obj         = ClientScene.FindLocalObject(passengerid);
                if (obj)
                {
                    CharacterDriver driver = obj.GetComponent <CharacterDriver>();

                    if (driver)
                    {
                        driver.NeedParachute = NeedParachute;

                        FPSController fps = driver.GetComponent <FPSController>();
                        if (fps)
                        {
                            fps.FixedRotation();
                        }

                        if (Seats[i].ForceView != PlayerViewType.None)
                        {
                            PlayerView view = driver.GetComponent <PlayerView>();
                            if (view)
                            {
                                view.View          = Seats[i].ForceView;
                                view.OrbitDistance = Seats[i].ViewDistance;
                            }
                        }
                        if (Seats[i].FixRotation)
                        {
                            driver.transform.rotation = Seats[i].transform.rotation;
                        }
                        driver.character.Motor.grounded     = false;
                        driver.transform.position           = Seats[i].transform.position;
                        driver.transform.parent             = Seats[i].transform;
                        driver.CurrentVehicle               = this;
                        driver.character.controller.enabled = false;
                        driver.DrivingSeat = Seats[i];
                        hasDriver          = true;
                        if (driver.character.IsAlive == false)
                        {
                            Seats[i].PassengerID = -1;
                        }
                    }
                }
            }
            else
            {
                Seats[i].CleanSeat();
            }
        }

        if (isServer)
        {
            GenSeatsData();
        }
    }
 private void Start()
 {
     driver = gameObject.GetComponent <CharacterDriver>();
     weapon = childProjectile.GetComponent <damage>();
     left   = Random.value >= .5;
 }
 // Use this for initialization
 void Start()
 {
     _currInteractor  = GetComponent <PunchInteractor>();
     _stateManager    = GetComponent <StateManager>();
     _characterDriver = GetComponent <CharacterDriver>();
 }
 void Start()
 {
     FPSmotor = GetComponent<FPSController> ();
     Driver = GetComponent<CharacterDriver>();
     Application.targetFrameRate = 60;
 }
 void OnEnable()
 {
     // Get the character controller
     cc = GetComponent <CharacterDriver>();
 }