Inheritance: MonoBehaviour
Example #1
0
    void Start()
    {
        player = FirstPersonCamera.player;

        hint1.SetActive(false);
        hint2.SetActive(false);
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        inputProvider = GetComponent <CharacterInputProvider>();

        playerCamera      = GetComponent <FirstPersonCamera>();
        characterMovement = GetComponent <CharacterMovement>();
    }
        public override void Respawn()
        {
            SetModel("models/citizen/citizen.vmdl");

            //
            // Use WalkController for movement (you can make your own PlayerController for 100% control)
            //
            Controller = new WalkController();

            //
            // Use StandardPlayerAnimator  (you can make your own PlayerAnimator for 100% control)
            //
            Animator = new StandardPlayerAnimator();

            //
            // Use FirstPersonCamera (you can make your own Camera for 100% control)
            //
            Camera = new FirstPersonCamera();

            EnableAllCollisions       = true;
            EnableDrawing             = true;
            EnableHideInFirstPerson   = true;
            EnableShadowInFirstPerson = true;

            base.Respawn();
        }
Example #4
0
    private void Start()
    {
        if (!player)
        {
            player = FirstPersonCamera.player;
        }
        zoomIn = GetComponent <PlayableDirector>();

        if (!padParent || !player || !zoomIn)    // 에러 방지. 뭐라도 하나라도 없으면...
        {
            tag = "Untagged";
            Destroy(GetComponent <Collider>());
            Destroy(GetComponent <QuickOutline>());
            Destroy(this, 1f);
            return;
        }

        // 타임라인에 MainCamera 직접 바인딩. Why? > 에디터에서 드래그앤드랍 해도 다른 Scene이라서 로딩시에 missing.
        UnityEngine.Timeline.TimelineAsset timeline = zoomIn.playableAsset as UnityEngine.Timeline.TimelineAsset;
        zoomIn.SetGenericBinding(timeline.GetOutputTrack(3), Camera.main.gameObject);
        timelineDuration = timeline.duration;

        cam         = GameObject.FindWithTag("MainCamera").GetComponent <Camera>();
        rigid       = GetComponent <Rigidbody>();
        beforePoint = Vector3.zero;
        midPoint    = cam.pixelRect.max / 2f; // 화면의 중앙 픽셀 위치.

        Handle.enabled = false;
    }
        /// <summary>
        /// Called every tick, clientside and serverside.
        /// </summary>
        public override void Simulate(Client cl)
        {
            base.Simulate(cl);

            if (Input.Pressed(InputButton.View))
            {
                if (Camera is not FirstPersonCamera)
                {
                    Camera = new FirstPersonCamera();
                }
                else
                {
                    Camera = new ThirdPersonCamera();
                }
            }

            //
            // Shoot a ball when Mouse1 is pressed.
            //
            if (IsServer && Input.Pressed(InputButton.Attack1) && PlayerHasPotato)
            {
                var potato = new BallEntity();
                potato.Position = EyePos + EyeRot.Forward * 50;
                potato.Velocity = EyeRot.Forward * 1000;
                PlayerHasPotato = false;                 // We threw the potato, so we don't have it anymore.
            }
        }
Example #6
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            input = new InputHandler(this);
            this.Components.Add(input);
            fps = new FPS(this);
            this.Components.Add(fps);
            console = new GameConsole(this);
            this.Components.Add(console);
            camera = new FirstPersonCamera(this);
            this.Services.AddService(typeof(ICamera), camera);
            this.Components.Add(camera);

            baron = new Baron(this);
            this.Components.Add(baron);

            mesh           = new Mesh(this);
            mesh.Pitch     = 55;
            mesh.Location  = new Vector3(0, 20.0f, -50.0f);
            mesh.Direction = new Vector3(1, 0, 0);
            mesh.Rotation  = new Vector3(10, 0, 0);
            mesh.Scale     = 10.0f;
            this.Components.Add(mesh);

            monkeyShots = new MonkeyShots(this);
            this.Components.Add(monkeyShots);
        }
Example #7
0
    // public List<float> angles {get { return _angles;} set { _angles = value; }}

    public void OnStart()
    {
        player          = Common.GetStealthPlayer();
        playerCamScript = GetScript <FirstPersonCamera>(Common.GetStealthPlayerCamera());

        mSound = gameObject.RequireComponent <CSound>();
        //mSound.Stop("Turret_Rotate.vente");
        //mSound.Stop("Turret_Targetting.vente");
        // mSound.Volume(0.3f);
        //mSound.AddSound("Turret_LaserShot.vente");

        angleList = new List <float>();
        angleList.Add(Angle1);
        angleList.Add(Angle2);
        // Start with the turret at the first angle
        currAngleIndex = 0;
        gameObject.transform.rotation.Angles.y = angleList[currAngleIndex];
        currentState = 1;
        startAngle   = gameObject.transform.rotation.Angles.y;

        angleArcOfFire    = MathHelper.ToRadians(35.0f); // half angle
        cosAngleArcOfFire = (float)Math.Cos((double)angleArcOfFire);

        timerToStayOnGuard = TIME_TO_ON_GUARD;
        timerToRotate      = TIME_TO_ROTATE;
    }
Example #8
0
 // Start is called before the first frame update
 void Start()
 {
     tag               = "Player";
     health            = GetComponent <Health>();
     firstPersonCamera = GetComponent <FirstPersonCamera>();
     weaponMechanic    = GetComponentInChildren <Weapon>();
 }
Example #9
0
    void Start()
    {
        endingBook_script = GameObject.FindObjectOfType <RewardBook_Open>();

        fpCam_Script  = Camera.main.GetComponent <FirstPersonCamera>();
        player_script = GameObject.FindObjectOfType <Player_HJ>();

        eB_colider.enabled        = true;
        endingBook_script.enabled = true;

        endingCtrller_script = GameObject.FindObjectOfType <ActionController_Ending>();

        //라이트
        //_lightOn_script = GameObject.FindObjectOfType<LightOn_3stage>();

        //string[] res = UnityStats.screenRes.Split('x');
        //Debug.Log(int.Parse(res[0]) + " " + int.Parse(res[1]));
        //Vector3 halfScreen;

        // 외곽선
        OutlineController = GameObject.FindObjectOfType <DrawOutline_HJ>();

        //장애물,벽
        obstacleReader_script = GameObject.FindObjectOfType <ObstacleReader>();
        _obstacle_layer       = (1 << LayerMask.NameToLayer("Item")) + (1 << LayerMask.NameToLayer("Obstacle"));

        // 쪽지 매니저
        notemager = FindObjectOfType <NoteManger>(); //-> 해당 스크립트는 쪽지 매니저 검사 안해도 댐
    }
Example #10
0
    [SerializeField] private ForTimelineScript scripts; // 타임라인용 스크립트 클래스.

    private void Start()
    {
        if (GameObject.Find("CCTVs"))
        {
            cameras = GameObject.Find("CCTVs").transform.GetComponentsInChildren <Camera>(true);
        }

        Coll           = GetComponent <CapsuleCollider>();
        Coll.isTrigger = true;

        currentIdx = 0;              // 기본값 0.
        maxIdx     = cameras.Length; // 배열의 길이.
        IsGaming   = false;
        IsCleared  = false;
        player     = FirstPersonCamera.player;

        if (cameras.Length != 0)
        {
            Camera cam = cameras[0];
            if (cam.transform.parent.parent.name == "Tree_with_CCTV")
            {
                cam.transform.parent.parent.gameObject.SetActive(true);
            }
            else if (cam.transform.parent.name == "Tree_with_CCTV")
            {
                cam.transform.parent.gameObject.SetActive(true);
            }
            cam.targetTexture = currentRT;  // 기본값 지정.
        }
    }
Example #11
0
    // Update is called once per frame
    void Update()
    {
        if (obstacleComplete)
        {
            promptAlpha = 0;
            canEngage   = false;

            Destroy(GetComponent <ParticleSystem>());
        }

        // Start obstacle dialogue upon interacting with obstacle
        if (Input.GetButtonUp("Interact") && canEngage)
        {
            // Lock camera rotation
            FirstPersonCamera cameraScript = GameObject.Find("Main Camera").GetComponent <FirstPersonCamera>();
            cameraScript.lockRotation = true;

            // Stop velocity of player
            Rigidbody playerBody = GameObject.Find("Player").GetComponent <Rigidbody>();
            playerBody.velocity = Vector3.zero;

            // Lock player movement
            Player playerScript = GameObject.Find("Player").GetComponent <Player>();
            playerScript.lockMovement = true;

            // Prevewnt engagement loop
            canEngage = false;

            // Remove prompt
            promptAlpha = 0;

            // Start Dialogue when player sits in chair
            GetComponent <ObstacleDialogue>().startDialogue();
        }
    }
Example #12
0
    protected override void Tick()
    {
        base.Tick();

        if (Input.Pressed(InputButton.Slot1))
        {
            Inventory.SetActiveSlot(0, true);
        }
        if (Input.Pressed(InputButton.Slot2))
        {
            Inventory.SetActiveSlot(1, true);
        }
        if (Input.Pressed(InputButton.Slot3))
        {
            Inventory.SetActiveSlot(2, true);
        }
        if (Input.Pressed(InputButton.Slot4))
        {
            Inventory.SetActiveSlot(3, true);
        }
        if (Input.Pressed(InputButton.Slot5))
        {
            Inventory.SetActiveSlot(4, true);
        }
        if (Input.Pressed(InputButton.Slot6))
        {
            Inventory.SetActiveSlot(5, true);
        }

        if (Input.MouseWheel != 0)
        {
            Inventory.SwitchActiveSlot(Input.MouseWheel, true);
        }

        if (LifeState != LifeState.Alive)
        {
            return;
        }

        if (Input.Pressed(InputButton.View))
        {
            if (Camera is ThirdPersonCamera)
            {
                Camera = new FirstPersonCamera();
            }
            else
            {
                Camera = new ThirdPersonCamera();
            }
        }

        if (Input.Pressed(InputButton.Drop))
        {
            var dropped = Inventory.DropActive();
            if (dropped != null)
            {
                timeSinceDropped = 0;
            }
        }
    }
Example #13
0
 private void Start()
 {
     if (GameObject.FindWithTag("Player"))
     {
         player = FirstPersonCamera.player;
     }
 }
Example #14
0
    // public List<float> angles {get { return _angles;} set { _angles = value; }}
    public void OnStart()
    {
        player = Common.GetStealthPlayer();
        playerCamScript = GetScript<FirstPersonCamera>(Common.GetStealthPlayerCamera());

        mSound = gameObject.RequireComponent<CSound>();
        //mSound.Stop("Turret_Rotate.vente");
        //mSound.Stop("Turret_Targetting.vente");
        // mSound.Volume(0.3f);
        //mSound.AddSound("Turret_LaserShot.vente");

        angleList = new List<float>();
        angleList.Add(Angle1);
        angleList.Add(Angle2);
        // Start with the turret at the first angle
        currAngleIndex = 0;
        gameObject.transform.rotation.Angles.y = angleList[currAngleIndex];
        currentState = 1;
        startAngle = gameObject.transform.rotation.Angles.y;

        angleArcOfFire = MathHelper.ToRadians(35.0f); // half angle
        cosAngleArcOfFire = (float)Math.Cos((double)angleArcOfFire);

        timerToStayOnGuard = TIME_TO_ON_GUARD;
        timerToRotate = TIME_TO_ROTATE;
    }
Example #15
0
        public override void Respawn()
        {
            SetModel("models/citizen/citizen.vmdl");

            Controller = Team == Team.Spectator ? new SpectatorController() : Team == Team.Seeker ? new SeekerController() : new WalkController();
            Animator   = new StandardPlayerAnimator();
            Camera     = new FirstPersonCamera();

            EnableAllCollisions       = Team != Team.Spectator;
            EnableDrawing             = Team != Team.Spectator;
            EnableHideInFirstPerson   = true;
            EnableShadowInFirstPerson = true;

            Health    = 100;
            LifeState = LifeState.Alive;

            Inventory.DeleteContents();
            if (Team == Team.Seeker)
            {
                Inventory.Add(new Shotgun());
                Inventory.Add(new SMG());
                Inventory.Add(new Pistol(), true);
            }

            Dress();
            ClearAmmo();

            GiveAmmo(AmmoType.Buckshot, 20);
            GiveAmmo(AmmoType.SMG, 200);

            base.Respawn();
        }
 public SimpleRenderer(GraphicsDevice graphicsDevice, FirstPersonCamera camera, World world, Player player)
 {
     _graphicsDevice = graphicsDevice;
     _camera         = camera;
     _world          = world;
     _player         = player;
 }
Example #17
0
    public override void Simulate(Client cl)
    {
        //if ( cl.NetworkIdent == 1 )
        //	return;

        base.Simulate(cl);

        //
        // Input requested a weapon switch
        //
        if (Input.ActiveChild != null)
        {
            ActiveChild = Input.ActiveChild;
        }

        if (LifeState != LifeState.Alive)
        {
            return;
        }

        TickPlayerUse();

        if (Input.Pressed(InputButton.View))
        {
            if (Camera is ThirdPersonCamera)
            {
                Camera = new FirstPersonCamera();
            }
            else
            {
                Camera = new ThirdPersonCamera();
            }
        }

        if (Input.Pressed(InputButton.Drop))
        {
            var dropped = Inventory.DropActive();
            if (dropped != null)
            {
                if (dropped.PhysicsGroup != null)
                {
                    dropped.PhysicsGroup.Velocity = Velocity + (EyeRot.Forward + EyeRot.Up) * 300;
                }

                timeSinceDropped = 0;
                SwitchToBestWeapon();
            }
        }

        SimulateActiveChild(cl, ActiveChild);

        //
        // If the current weapon is out of ammo and we last fired it over half a second ago
        // lets try to switch to a better wepaon
        //
        if (ActiveChild is BaseDmWeapon weapon && !weapon.IsUsable() && weapon.TimeSincePrimaryAttack > 0.5f && weapon.TimeSinceSecondaryAttack > 0.5f)
        {
            SwitchToBestWeapon();
        }
    }
Example #18
0
 // Use this for initialization
 private void Awake()
 {
     cController = GetComponent <CameraController>();
     firstP      = GetComponent <FirstPerson>();
     thirdP      = GetComponent <FirstPersonCamera>();
     cam         = GetComponent <Camera>();
 }
    // Start is called before the first frame update
    void Start()
    {
        tag    = "Player";
        health = GetComponent <Health>();
        health.EventTakeDamage   += OnTakeDamage;
        health.EventReciveHealth += OnReciveHealth;
        health.EventDeath        += OnDeath;

        firstPersonCamera = GetComponent <FirstPersonCamera>();
        normalAttack      = GetComponentInChildren <Weapon>();
        movement          = GetComponent <Movement>();
        jump      = GetComponent <PlayerJump>();
        command   = GetComponent <PlayerCommand>();
        skillTree = GetComponent <SkillTree>();

        drone = FindObjectOfType <DroneAi>();

        virusData = GetComponent <PlayerVirusData>();

        PlayerVirusData.OnResourceChanged += PlayerVirusData_OnResourceChanged;

        UpdateHealthText();
        ResourceText.text = virusData.ToString();
        flashBaseColor    = flashImage.color;
    }
Example #20
0
    // Start is called before the first frame update


    // Update is called once per frame
    // 특정 조건을 만족하면  뜨는데 그걸 바꿔서.. (에휴 히믇ㄹ다
    // 만약 게임 오버가 되면 패널이 뜹니다.
    // 그리고 몇초 딜레이 뒤
    // 두개의 하얀 패널이 움직이더니 쾅! 조금 세심히 움직이는걸로? - 아냐 이건 그냥 빠르게 쾅하는게 나을듯 그냥 코드로....
    // 그리고 She's gone 패널의 투명도를 조절해서! 헤헤! 이러면 금방 끝이군!


    void Start()
    {
        //플레이어 move
        _animator        = PlayerObj.GetComponent <Animator>();
        playerController = GameObject.FindObjectOfType <Player_HJ>();
        Side_Controller  = GameObject.FindObjectOfType <FirstPersonCamera>();
    }
Example #21
0
    public override void Respawn()
    {
        SetModel("models/citizen/citizen.vmdl");

        Controller = new WalkController();
        Animator   = new StandardPlayerAnimator();
        Camera     = new FirstPersonCamera();

        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;

        Dress();
        ClearAmmo();

        SupressPickupNotices = true;

        Inventory.Add(new Pistol(), true);
        //Inventory.Add( new Shotgun() );
        //Inventory.Add( new SMG() );
        //Inventory.Add( new Crossbow() );

        GiveAmmo(AmmoType.Pistol, 100);
        GiveAmmo(AmmoType.Buckshot, 8);
        GiveAmmo(AmmoType.Crossbow, 4);

        SupressPickupNotices = false;
        Health = 100;

        base.Respawn();
    }
        protected override void Initialize()
        {
            base.Initialize();

            FpsCounter.Enable(this);
            var message = new DebugMessageBuilder(Corner.TopRight, Color.Black);

            Add(message);

            Add(new GridAxis(RenderContext, true));

            _camera = new FirstPersonCamera(RenderContext.GraphicsDevice, Vector3.Zero, FirstPersonCamera.FirstPersonMode.Person);

            var player = new Player(_camera);

            GenerateMaze(player);
            Add(player);

            var chunkManager = GetComponents <ChunkManager>().First();
            // for first maze, place player at the starting cell

            const int playerHeight = 2;
            // position the player in the center of the starting cell
            var start  = chunkManager.GetStartCell().GetBoundingBox();
            var center = (start.Min + start.Max) / 2f;
            var s      = new Vector3(center.X, playerHeight, center.Z);

            _camera.SetPosition(s);

            UpdateDetails();
        }
Example #23
0
        //private PosionGas gas;
        //private Colorful colorful;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            input = new InputHandler(this, true);
            Components.Add(input);

            camera = new FirstPersonCamera(this);
            Components.Add(camera);

            fps = new FPS(this, false, true);
            Components.Add(fps);

            skybox = new Skybox(this);
            Components.Add(skybox);

            //rain = new Rain(this);
            //Components.Add(rain);

            //bubbles = new Bubbles(this);
            //Components.Add(bubbles);

            //laserShield = new LaserShield(this);
            //Components.Add(laserShield);

            laserScanner = new LaserScanner(this);
            Components.Add(laserScanner);

            //gas = new PosionGas(this);
            //Components.Add(gas);

            //colorful = new Colorful(this);
            //Components.Add(colorful);
        }
    void Start()
    {
        mainCamera = Camera.main;
        fpCamera   = GetComponent <Camera>();

        _animator = playerModeling.GetComponent <Animator>();

        mainListener = mainCamera.GetComponent <AudioListener>();
        fpListener   = GetComponent <AudioListener>();

        actionController   = Camera.main.GetComponent <ActionController_02_VER2>();
        mainCamMove_script = Camera.main.GetComponent <FirstPersonCamera>();

        puzzleEnter_script = Camera.main.GetComponent <FramePuzzle_Enter>();
        fpController       = GameObject.FindObjectOfType <FramePuzzle_Controller>();

        playerController = GameObject.FindObjectOfType <Player_HJ>();

        //초기화
        //mainListener.enabled = true;
        //fpListener.enabled = false;

        //게임매니저
        gameMgr_script = GameObject.FindObjectOfType <GameMgr>();
    }
Example #25
0
 private void Start()
 {
     isAlive            = true;
     fpsController      = GetComponent <FirstPersonController>();
     firstPersonCamera  = GetComponent <FirstPersonCamera>();
     playerUIController = GetComponent <PlayerUIController>();
 }
Example #26
0
    public override void Respawn()
    {
        SetModel("models/citizen/citizen.vmdl");

        Controller = new WalkController();
        Animator   = new StandardPlayerAnimator();
        Camera     = new FirstPersonCamera();

        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;

        Inventory.Add(new Gun(), true);
        Inventory.Add(new Tool());
        Inventory.Add(new PhysGun());
        Inventory.Add(new GravGun());
        //Inventory.Add( new BoxShooter() );
        //Inventory.Add( new Welder() );
        //Inventory.Add( new Thruster() );
        //Inventory.Add( new Wheel() );
        //Inventory.Add( new Balloon() );
        //Inventory.Add( new Remover() );
        //Inventory.Add( new Drone() );

        base.Respawn();
    }
Example #27
0
        protected override void Initialize()
        {
            player = new Player(this, new Vector3(0, 2, 0));
            player.Initialize();

            // New camera code
            camera = new FirstPersonCamera(graphics.GraphicsDevice,
                                           new ViewMatrixSettings(new Vector3(0, 5, 0), Vector3.Up, Vector3.Forward));

            IsMouseVisible = true;
            Mouse.SetPosition(Window.ClientBounds.Width / 2, Window.ClientBounds.Height / 2);

            terrain = new Terrain();

            Random random = new Random();

            for (int x = -20; x < 20; x++)
            {
                for (int z = -20; z < 20; z++)
                {
                    terrain.AddBlockAt(new IntPoint3D(x, -1, z), GraphicsDevice);

                    if (random.Next(3) == 0)
                    {
                        terrain.AddBlockAt(new IntPoint3D(x, 0, z), GraphicsDevice);
                    }
                }
            }

            base.Initialize();
        }
Example #28
0
    void Start()
    {
        animator = GetComponent <Animator>();

        //start_cuckooAni();

        cameraShake_script = Camera.main.GetComponent <CameraShake>();
        fpCam_Script       = Camera.main.GetComponent <FirstPersonCamera>();

        //0
        //public UnityStandardAssets.CinematicEffects.MotionBlurEditor motionBlur_script;
        //UnityStandardAssets.CinematicEffects.MotionBlurEditor motionBlur = Camera.main.GetComponent<MotionBlur>();
        //1
        //motionBlur_script = GetComponent<MotionBlur>();
        //GUI.enabled;
        //2
        //if (boolValue == false)
        //{
        //    base.OnInspectorGUI();
        //    return;
        //}

        doorAni_script = GameObject.FindObjectOfType <DoorAni_cuckoo>();

        player_script = GameObject.FindObjectOfType <Player_HJ>();

        cpManager_script = GameObject.FindObjectOfType <ClockPuzzle_Manager>();

        //AniNameHash = animator.StringToHash(EventEndAnimationName);

        journeyLength = Vector3.Distance(startTransform.position, endTransform.position);
    }
Example #29
0
    public override void Respawn()
    {
        if (grenadePooler == null)
        {
            grenadePooler = new ModelEntityPooler <BalloonGrenadeEntity>(2);
        }

        //var rand = Rand.Int( 1 );
        //if ( rand == 0 )
        //{
        SetModel("models/citizen/citizen.vmdl");
        //} else
        //{
        //	Log.Info("Clown");
        //	SetModel( "models/citizen_clown/citizen.vmdl" );
        //}
        Controller                = new WalkControllerBP();
        Animator                  = new StandardPlayerAnimator();
        Camera                    = new FirstPersonCamera();
        EnableAllCollisions       = true;
        EnableDrawing             = true;
        EnableHideInFirstPerson   = true;
        EnableShadowInFirstPerson = true;
        Dress();
        SupressPickupNotices = true;
        if (Inventory.Count() == 0)
        {
            Inventory.Add(new Crossbow(), false);
            Inventory.Add(new BalloonGrenade(), true);
        }
        SupressPickupNotices = false;
        Health = 100;

        base.Respawn();
    }
Example #30
0
    void Start()
    {
        mainCamera   = Camera.main;
        CellarCamera = GetComponent <Camera>();

        mainListener   = mainCamera.GetComponent <AudioListener>();
        CellarListener = GetComponent <AudioListener>();

        //초기화
        mainListener.enabled   = true;
        CellarListener.enabled = false;

        Fade_script      = FindObjectOfType <FadeManager>();
        actionController = mainCamera.GetComponent <ActionController_02_VER2>();

        //플레이어 move
        playerController = GameObject.FindObjectOfType <Player_HJ>();
        Side_Controller  = GameObject.FindObjectOfType <FirstPersonCamera>();
        _animator        = playerModeling.GetComponent <Animator>();

        // - 지하실문 스크립트, 문 외곽선을 위해
        cellar_script = GameObject.FindObjectOfType <CellarDoorCollider>();

        //게임매니저
        gameMgr_script = GameObject.FindObjectOfType <GameMgr>();
    }
Example #31
0
 private void OnEnable()
 {
     if (!player)
     {
         player = FirstPersonCamera.player;
     }
 }
Example #32
0
 public Player(World world)
     : base(new CapsuleShape(0.9f, 0.4f))
 {
     this.world = world;
     this.camera = new FirstPersonCamera(this)
     {
         EyeHeight = 0.6f
     };
     this.Material = new Material()
     {
         StaticFriction = 0.05f,
         KineticFriction = 0.3f,
         Restitution = 0.0f
     };
     this.AllowDeactivation = false;
 }
Example #33
0
 public Vehicle()
 {
     CameraDefinition defaultCameraDefinition = new CameraDefinition()
     {
         Distance = 10,
         FPV = true,
         Offset = Vector3.Zero,
         ViewAngle = Vector2.One,
         Style = DrawingStyle.Normal
     };
     FirstPersonCamera = new FirstPersonCamera(defaultCameraDefinition);
     ThirdPersonCamera = new ThirdPersonCamera(defaultCameraDefinition);
     CameraList = new Camera[0];
     CurrentCamera = 1;
     VehicleMesh = new MeshReference();
 }
    public void OnStart()
    {
        if (gameObject.transform.GetParent() != null)
        {
            gameObject.transform.SetParent(null);
        }

        speedX = 0;
        speedZ = 0;
        currSpeed = speedNormal;
        speedWhenJumped = 0.0f;

        canJump = true;

        // playerBox is actually my own gameObject
        playerBox = gameObject; // GameObject.GetGameObjectByName("PlayerBoxCollider");
        playerBoxMesh = playerBox.RequireComponent<CMeshRenderer>();
        playerBoxMesh.setEnabled(false);
        playerCamera = Common.GetStealthPlayerCamera();
        playerCamScript = GetScript<FirstPersonCamera>(playerCamera);
        player = Common.GetStealthPlayerMesh();
        anim = player.RequireComponent<CAnimationController>();
        anim.mIsPlaying = true;

        playerPhysics = gameObject.RequireComponent<CPhysics>();
        playerPhysics.mColliderType = 1;

        idle = new State(smc, State_Idle_Enter, State_Idle_Update, State_Idle_Exit);
        move = new State(smc, State_Move_Enter, State_Move_Update, State_Move_Exit);
        jump = new State(smc, State_Jump_Enter, State_Jump_Update, State_Jump_Exit);
        crouch = new State(smc, State_Crouch_Enter, State_Crouch_Update, State_Crouch_Exit);

        sprinting = new State(smc, State_Sprinting_Enter, State_Sprinting_Update, State_Sprinting_Exit, 0.5f);
        sprinting.NextState = sprinting;
        notsprinting = new State(smc, State_NotSprinting_Enter, State_NotSprinting_Update, State_NotSprinting_Exit);

        smc.SetState(idle);
        sprint_smc.SetState(notsprinting);

        footstepID = GetSoundComponent().GetUniqueEvent("P1_FOOTSTEPS.vente", 0);
    }
Example #35
0
    public static void Reset()
    {
        isPaused = false;
        isOptions = false;

        pauseScreen = null;
        pauseScreenScript = null;
        stealth_player = null;
        stealthPlayerScript = null;
        stealthPlayerMesh = null;
        stealthPlayerCamera = null;
        stealthPlayerCamScript = null;
        stealthPlayerMouse = null;
        surveillancePlayerCam = null;
        surveillancePlayerStaticCameraCam = null;
        cameraCamScript = null;
        surveillancePlayerMouse = null;
        surveillancePlayerConsoleScreen = null;
        consoleScreenScript = null;
        surveillancePlayerConsoleText = null;
        surveillancePlayerConsoleCam = null;
        surveillancePlayerConsoleBlinkingLight = null;
        stealthPlayerFadeScreen = null;
        stickCam = null;
        stickCamInMap = null;
        stickCamInMapArea = null;
        stickyCamScript = null;
        camInMapSelector = null;
        noiseStatic = null;
        rcCar = null;
        rcCarCam = null;
        rcCarCamInMap = null;
        rcCarJoystick = null;

        camInMap = null;
        camInMapArea = null;
        camInWorld = null;

        cameraScreen = null;
        mapScreen = null;

        pauseOptionsScreen = null;
        fullscreenX = null;
        muteX = null;
        volumeFont = null;
    }
 /*
   ▒██████▒▒████████▒████████
   ██▒▒▒▒▒▒▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒
   ▒██████▒▒████████▒▒▒▒██▒▒▒
   ▒▒▒▒▒▒██▒██▒▒▒▒▒▒▒▒▒▒██▒▒▒
   ▒██████▒▒████████▒▒▒▒██▒▒▒
  */
 private void SetDefaultValue()
 {
     ResetCameraFieldOfView();
     Map = UnityEngine.GameObject.Find("_Map").GetComponent<Map>();
     fpc = GetComponent<FirstPersonCamera>();
 }
Example #37
0
 public static FirstPersonCamera GetStealthPlayerCameraScript()
 {
     if (stealthPlayerCamScript == null)
         stealthPlayerCamScript = MochaScript.GetScript<FirstPersonCamera>(GetStealthPlayerCamera());
     return stealthPlayerCamScript;
 }