상속: MonoBehaviour
예제 #1
0
    private void OnTriggerEnter(Collider coll)
    {
        //충돌한 Collider가 Camchange의 CAMCHANGE(Tag값)이면 카메라 전환
        if (coll.gameObject.tag == "AllGetOff" && startSet == false)
        {
            // 플레이어에 가해진 힘을 0으로 만든다. - > 차량 하차
            player.GetComponent <Rigidbody>().velocity = Vector3.zero;
            // 플레이어 스크립트 사용 (이동 때문)
            player.GetComponent <PlayerCtrl>().enabled = true;

            // 차량에 하차 할때 차량의 위치로 플레이어를 이동시킨다.
            player.transform.position = new Vector3(this.transform.position.x, 30.0f, this.transform.position.z);

            // 카메라 전환
            FollowCam followCam = GameObject.Find("Main Camera").GetComponent <FollowCam>();
            followCam.getOff = true;
            followCam.height = 35.0f;
            followCam.dist   = 25.0f;

            // 차량 하차 후 true로 F키 입력 시 재하차 불가능하게 만듬
            startSet = true;

            //bug.Log("차량 하차 -> 게임 시작");
        }

        if (coll.gameObject.tag == "EndPoint")
        {
            Destroy(gameObject);
        }
    }
    // Awake is called when the script instance is being loaded.
    void Awake()
    {
        PrintDebugMsg("Loaded.");

        S    = this;
        camZ = this.transform.position.z;
    }
예제 #3
0
    public void dontDestroyDungeonObject(Vector3 position, Quaternion rotation)      // 던전에서 파괴되지 말아야할 오브젝트 연결
    {
        if (CharacterInfoManager.instance.m_playerInfo.m_eCharacterType == CHARACTER_TYPE.AKAZA)
        {
            m_player = (GameObject)Instantiate(Resources.Load("Prefabs/AkazaBattle"), position, rotation);    // 플레이어를 생성
        }
        else if (CharacterInfoManager.instance.m_playerInfo.m_eCharacterType == CHARACTER_TYPE.UNITY)
        {
            m_player = (GameObject)Instantiate(Resources.Load("Prefabs/UnityChanBattle"), position, rotation); // 플레이어를 생성
        }
        m_player.name       = "Player";                                                                        // 플레이어 오브젝트의 이름은 Player
        m_objectPoolManager = GameObject.Find("ObjectPoolManager").gameObject;                                 // 오브젝트풀 매니저
        m_ingameUI          = GameObject.Find("InGameUI").GetComponent <UIPanel>();                            // IngameUI 게임오브젝트

        m_explainPanel             = GameObject.Find("ExplainPanel").GetComponent <UIPanel>();
        m_playerStateExplainLabel  = m_explainPanel.transform.Find("StateExplain").GetComponent <UILabel>();
        m_dungeonStateExplainLabel = m_explainPanel.transform.Find("DungeonStateExplain").GetComponent <UILabel>();
        m_deathWindow = m_ingameUI.transform.Find("DeathWindow").gameObject;
        m_ingameSubUI = GameObject.Find("InGameSubUI");

        m_dialogWindow    = m_ingameSubUI.transform.Find("DialogWindow").gameObject;            // NPC 대화창
        m_subDialogWindow = m_ingameSubUI.transform.Find("SubDialogWindow").gameObject;         // NPC 대화창
        m_winWindowPanel  = m_ingameSubUI.transform.Find("WinWindow").GetComponent <UIPanel>(); // 승리창
        m_mainLight       = GameObject.Find("Directional Light").gameObject;                    // 광원
        m_camera          = GameObject.Find("Camera").gameObject;                               // 카메라
        m_followCam       = m_camera.GetComponentInChildren <FollowCam>();

        DontDestroyOnLoad(m_ingameUI.gameObject);                            // 하나의 스테이도중에는 파괴되지 않도록 한다.
        DontDestroyOnLoad(m_player);
        DontDestroyOnLoad(m_objectPoolManager);
        DontDestroyOnLoad(m_mainLight);
        DontDestroyOnLoad(m_camera);
        DontDestroyOnLoad(m_ingameSubUI);
    }
예제 #4
0
 private void Start()
 {
     player = PlayerFSMManager.Instance;
     skill2 = player.GetComponent <PlayerSKILL2>();
     hit2   = player.GetComponent <PlayerHIT2>();
     cam    = player.followCam;
 }
예제 #5
0
    public override void OnStartLocalPlayer()
    {
        // The Local Player will be tinted blue
        GetComponent <SpriteRenderer>().color = Color.blue;

        //Assign this to the health bar.
        GameObject healthBar = GameObject.Find("Canvas/Health Bar Base/Health Bar Empty/Health Bar Full");
        HealthBar  bar       = healthBar.GetComponent <HealthBar>();

        bar.player = this; // 10/10 success gg.

        /*              // Assign this to the Cooldown timers.
         *            GameObject cdTimer = GameObject.Find("Canvas/Utility Belt/Tool Box/CD Box");
         *            CooldownBox cdBox = cdTimer.GetComponent<CooldownBox>();
         *            cdBox.leTool = leTool; // 4/10 success gg. Doesn't work because they aren't networked.
         */

        //        cdTimer = GameObject.Find("Canvas/Uitility Belt/Flare Box/CD Box (2)");
        //        cdBox = cdTimer.GetComponent<CooldownBox>();
        //        cdBox.leTool = flareGun;

        // Finally, tell the camera to follow the player.
        GameObject camera = GameObject.Find("Main Camera");
        FollowCam  fc     = camera.GetComponent <FollowCam>();

        fc.following = gameObject;
    }
예제 #6
0
    // Use this for initialization
    void Start()
    {
        //시작시 로딩하기
        Start_Timer = 0;
        Startnum0.SetActive(false); Startnum1.SetActive(false);
        Startnum2.SetActive(false); Startnum3.SetActive(false);
        //GameUI 스크립트 할당
        gameUI      = GameObject.Find("GameUI").GetComponent <GameUI>();
        trap_camera = GameObject.Find("TrapObject").GetComponent <TrapMgr>();
        gamecamera  = GameObject.Find("Main Camera").GetComponent <FollowCam>();
        //스크립트에 Transform 컴포넌트 할당
        tr       = GetComponent <Transform>();
        rigdbody = GetComponent <Rigidbody>();
        //자신의 하위에 있는 Animation 컴포넌트를 찾아와 변수에 할당
        _animation = GetComponentInChildren <Animation>();

        //Animation 컴포넌트의 애니메이션 클립을 지정하고 실행
        _animation.clip = anim.run;
        _animation.Play();

        //기본 소리 지정
        //source = GetComponent<AudioSource>();
        this.source = this.gameObject.AddComponent <AudioSource>();
        source.clip = run_sound;
        source.loop = true;
        source.Play();
        source.volume = 0;
    }
 private void Awake()
 {
     photonView = GetComponent <PhotonView>();
     motor      = GetComponent <PlayerMotor>();
     shooter    = GetComponent <Shooter>();
     followCam  = Camera.main.transform.GetComponent <FollowCam>();
 }
예제 #8
0
        protected override void OnLoad(EventArgs e)
        {
            VSync = Options.Vsync;
            Graphics.Init();
            // Has to be called after the Graphics setup if it's going to be preloading
            // textures and shaders and such...
            Resources.Init(Options);
            var map    = BuildTestLevel();
            var actCfg = Resources.TheResources.GetJson("player");
            //var actCfg = Resources.TheResources.GetJson("test");
            var player = SaveLoad.Load <Actor>(actCfg);

            //player.Body.AddGeom(new BoxGeom(new BBox(-5, -15, 5, 5)));
            View   = new ViewManager(Util.LogicalScreenWidth, Util.LogicalScreenWidth / Options.AspectRatio);
            Camera = new FollowCam(player, Util.LogicalScreenWidth, Util.LogicalScreenWidth / Options.AspectRatio);

            Gui = new GUI(Util.LogicalScreenWidth, Util.LogicalScreenWidth / Options.AspectRatio, new Vector2(-55, 70));
            SetupEvents();

            //var p_component = new ParticleComponent(40f, 5, 0, 0.025f);
            //player.AddComponent(p_component);
            //var colors = new Dictionary<double, Color4>();
            //colors.Add(5, new Color4(1f, 1f, 0f, 1f));
            //colors.Add(8, new Color4(0f, 0f, 0f, 0.0f));
            //p_component.setupEmitter(new PointEmitter(new Color4(1f, 0f, 0f, 1f), new Vector2d(1.25, 1), 2, 0.045, 10), new ColorFader(colors), _scaleWithTime: true);

            //var saveCfg = SaveLoad.Save(player);
            //Log.Message("" + saveCfg);
            World = new World(player, map, "TestZone", "TestRoom1");
            World.AddActor(Gui.GUIHash["FPS"].Actor);
            fpsTimer.Start();
        }
 void Awake()
 {
     if (FollowCam.instance == null)
     {
         FollowCam.instance = this;
     }
 }
    void Awake()
    {
        //initialisation
        Animator    = GetComponent <Animator>();
        Collider    = GetComponent <CapsuleCollider2D>();
        rb          = GetComponent <Rigidbody2D>();
        audioSource = GetComponent <AudioSource>();
        mySprite    = GetComponent <SpriteRenderer>();



        playerState = GameObject.Find("PlayerState").GetComponent <PlayerState>();
        Hero0       = this.transform.Find("Hero0").GetComponent <BaseHero>();
        Hero1       = this.transform.Find("Hero1").GetComponent <BaseHero>();
        Hero2       = this.transform.Find("Hero2").GetComponent <BaseHero>();
        Hero3       = this.transform.Find("Hero3").GetComponent <BaseHero>();


        attackHitbox         = GameObject.Find("AttackHitbox");
        attackHitBoxAnimator = attackHitbox.GetComponent <Animator>();
        attackHitboxCollider = attackHitbox.GetComponent <BoxCollider2D>();
        attackHitbox.GetComponent <AttackHitbox>().FindStuff(this.gameObject, this.gameObject.GetComponent <OverworldPlayerController>());
        attackHitbox.SetActive(false);
        followCamera        = GameObject.Find("Main Camera");
        cameraScript        = followCamera.GetComponent <FollowCam>();
        cameraScript.target = this.gameObject.GetComponent <Transform>();


        LevelCheck();
    }
예제 #11
0
    public void RemovePill(Collider pill)
    {
        remainingPills--;
        if (pill.tag == "powerUp")
        {
            powerUpEaten++;
            UpdateScore(LARGE_PILL_POINT);
            shadow.switchVulnerable();
            pokey.switchVulnerable();
            speedy.switchVulnerable();
            bashful.switchVulnerable();

            if (powerUpEaten == POWER_UPS)
            {
                pacMan.SuperMode = true;
                FollowCam follow = Camera.main.GetComponent <FollowCam>();
                follow.enabled = true;
                pacMan.superModeMusic();
            }
        }
        else
        {
            UpdateScore(SMALL_PILL_POINT);
        } if (remainingPills == 0)
        {
            if (level < MAX_LEVEL)
            {
                StartNewLevel();
            }
            else
            {
                Application.LoadLevel("endMenu");
            }
        }
    }
예제 #12
0
 void Start()
 {
     if (isLocalPlayer)
     {
         FollowCam cam = FindObjectOfType <FollowCam>();
         cam.target = transform;
     }
 }
예제 #13
0
    public void SetFocusToCurrOperator()
    {
        FollowCam cam = Camera.main.GetComponent <FollowCam>();
        Transform currOperatorTransform = players[currPlayerIdx].transform;

        cam.SetPosition(currOperatorTransform.position);
        cam.SetTarget(currOperatorTransform);
    }
    void Awake()
    {
        //god damn capital letters

        S = this;
        camZ = this.transform.position.z;
        originalPos = transform.position;
        cameraHeight = this.camera.orthographicSize;
    }
예제 #15
0
 // Start is called before the first frame update
 void Start()
 {
     heroPlayer = GameManager.player;
     heroCompo  = heroPlayer.GetComponent <AHeroes>();
     cam        = Camera.main.GetComponent <FollowCam>();
     spell_indicator.enabled        = false;
     spell_Second_indicator.enabled = false;
     spellsize_multiplier           = 1.0f;
 }
예제 #16
0
    void Awake()
    {
        instance = this;

        cam = GetComponent <Camera>();

        // Initially position the camera exactly over the poi - JB
        transform.position = poi.position + offset;
    }
예제 #17
0
    // derive and fill

    public virtual void Activate()
    {
        // TODO does this belong here?
        FollowCam followCam = Camera.main.GetComponent <FollowCam>();

        if (followCam != null)
        {
            followCam.FollowTarget = gameObject;
        }
    }
예제 #18
0
 void Awake()
 {
     player = GameObject.Find("Player");
     cam = Camera.main.GetComponent<FollowCam> ();
     if (player != null) {
         respawnSpot = player.transform.position;
         respawnRot = player.transform.rotation;
     } else {
         respawnSpot = Vector3.zero;
     }
 }
예제 #19
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(this);
     }
     DontDestroyOnLoad(this);
 }
예제 #20
0
    // Start is called before the first frame update
    void Start()
    {
        tr   = GetComponent <Transform>();
        anim = GetComponent <Animator>();

        playerName.text = photonView.Owner.NickName;

        if (photonView.IsMine)
        {
            followCam        = Camera.main.GetComponent <FollowCam>();
            followCam.target = tr;
        }
    }
예제 #21
0
    void Update()
    {
        if (dontStart == false)
        {
            // 서버에서 시작차량을 출발하라고 한 뒤 부터 F를 누를 수 있다.
            if (startSet == false)
            {
                player.transform.position = new Vector3(this.transform.position.x, 33.0f, this.transform.position.z);
                //------------------------------------------------------------------------------
                // 차량 이동 중 에도 지도를 볼 수 있다.
                // 빌드 되었을 경우 플레이어 컨트롤러가 안꺼지는 오류 때문에 주석처리.
                //if (Input.GetKeyDown(KeyCode.CapsLock))
                //{
                //    if (Player_Script.realView == false)
                //    {
                //        Player_Script.realMap.SetActive(true);
                //        Player_Script.realView = true;
                //    }
                //    else if (Player_Script.realView == true)
                //    {
                //        Player_Script.realMap.SetActive(false);
                //        Player_Script.realView = false;
                //    }
                //}

                //if (Player_Script.realView == true)
                //    Player_Script.playerPositionImage.localPosition = new Vector3(-gameObject.transform.position.z * 0.5f, gameObject.transform.position.x * 0.5f);
                //------------------------------------------------------------------------------

                // F키 입력 시
                if (Input.GetKeyDown(KeyCode.F))
                {
                    // 플레이어 스크립트 사용 (이동 때문)
                    Player_Script.enabled = true;

                    // 카메라 전환
                    FollowCam followCam = GameObject.Find("Main Camera").GetComponent <FollowCam>();
                    followCam.getOff = true;
                    followCam.height = 35.0f;
                    followCam.dist   = 25.0f;

                    // 차량에 하차 할때 차량의 위치로 플레이어를 이동시킨다.
                    player.transform.position = new Vector3(this.transform.position.x, 33.0f, this.transform.position.z);
                    // 차량 하차 후 true로 F키 입력 시 재하차 불가능하게 만듬
                    startSet = true;
                }
            }
        }
    }
예제 #22
0
    private void GUIChangeDistance()
    {
        FollowCam cam = FindObjectOfType <FollowCam>();

        if (cam == null)
        {
            return;
        }

        GUILayout.Label("Distance : " + Mathf.FloorToInt(cam.m_targetDist).ToString());

        cam.m_targetDist = GUILayout.HorizontalSlider(cam.m_targetDist,
                                                      0.1f,
                                                      10.0f);
    }
예제 #23
0
    void Start()
    {
        m_animator                 = GetComponent <Animator>();                                // 컴포넌트에서 애니메이터를 동기화
        m_weaponCollider           = GameObject.Find("Dragonblade").GetComponent <Collider>(); // 대검 오브젝트의 이름을 찾은 후 콜라이더 동기화
        m_cameraScript             = GameObject.Find("Main Camera").GetComponent <FollowCam>();
        m_baseSlashTrail           = m_weaponCollider.transform.Find("TrailEffect").GetComponent <MeleeWeaponTrail>();
        m_baseSlashTrail._lifeTime = 0.0f;

        // 모든 이펙트는 초기에 꺼둔다.
        m_rushEffect.Stop();
        m_leafAttackRangeEffect.Stop();
        m_swordWindChargeEffect.Stop();
        m_levelUpEffect.Stop();
        m_flashEffect.Stop();
    }
예제 #24
0
        void Start()
        {
            iMaxMagazine = T2.Stat.MAX_MAGAZINE;

            moveCtrl      = GetComponent <T2.MoveCtrl>();
            mgr           = GetComponent <T2.Manager>();
            trPlayerModel = GameObject.FindGameObjectWithTag(Tags.PlayerModel).transform;
            animator      = GetComponentInChildren <Animator>();

            cam         = Camera.main;
            followCam   = cam.GetComponent <FollowCam>();
            fOrizinDist = followCam.GetDist();
            fOrizinFOV  = cam.fieldOfView;
            fCamDist    = followCam.GetDist();

            bulletPool.CreatePool(oBulletPref, iMaxMagazine);
            flarePool.CreatePool(oFlarePref, iMaxMagazine * 2);

            muzzleFlash[0].enabled = false;
            muzzleFlash[1].enabled = false;
        }
예제 #25
0
        protected override bool OnDestroy(DestroyType type = null)
        {
            if (!base.isServerForObject)
            {
                return(false);
            }
            ATRCShrapnel shrap = new ATRCShrapnel();

            shrap.MakeNetEffect(this.position, false);
            List <Bullet> firedBullets = new List <Bullet>();

            for (int i = 0; i < 20; i++)
            {
                float dir = (float)i * 18f - 5f + Rando.Float(10f);
                shrap       = new ATRCShrapnel();
                shrap.range = 55f + Rando.Float(14f);
                Bullet bullet = new Bullet(base.x + (float)(Math.Cos((double)Maths.DegToRad(dir)) * 6.0), base.y - (float)(Math.Sin((double)Maths.DegToRad(dir)) * 6.0), shrap, dir, null, false, -1f, false, true);
                bullet.firedFrom = this;
                firedBullets.Add(bullet);
                Level.Add(bullet);
            }
            if (Network.isActive)
            {
                NMFireGun gunEvent = new NMFireGun(null, firedBullets, 0, false, 4, false);
                Send.Message(gunEvent, NetMessagePriority.ReliableOrdered, null);
                firedBullets.Clear();
            }
            Level.Remove(this);
            FollowCam cam = Level.current.camera as FollowCam;

            if (cam != null)
            {
                cam.Remove(this);
            }
            if (Recorder.currentRecording != null)
            {
                Recorder.currentRecording.LogBonus();
            }
            return(true);
        }
예제 #26
0
    void Update()
    {
        InputManager.HandleInput(this);
        GetComponent <SpriteRenderer>().sortingOrder = Mathf.RoundToInt(transform.position.y * 100f) * -1;
        killsText.text = "Kills: " + kills;

        if (dead)
        {
            camera.GetComponent <Camera>().orthographicSize = Mathf.Lerp(camera.GetComponent <Camera>().orthographicSize, 2f, Time.deltaTime);
        }

        // Debug screen shake
        if (Input.GetKeyDown("c"))
        {
            FollowCam.ScreenShake(0.1f, 4f, 0.2f, 5f);
        }

        HandleAiming();
        if (!aiming)
        {
            HandleMovement();
        }

        Vector2 newTravel = new Vector2(transform.position.x, transform.position.y) - prevPosition;

        travelSpeed = newTravel.magnitude;
        if (newTravel.magnitude > 0.01f)
        {
            travelDirection = newTravel.normalized;
            prevPosition    = transform.position;
        }

        HandleIntoxication();

        if (closestMushroom && (closestMushroom.transform.position - transform.position).magnitude > eatRadius)
        {
            HandleDisplaySign();
        }
    }
예제 #27
0
 void Awake()
 {
     S = this;
     camZ = this.transform.position.z;
 }
예제 #28
0
 void Awake()
 {
     cam = this;
 }
예제 #29
0
 void Awake()
 {
     S = this;
     camZ = transform.position.z;
     originalTarget = poi;
 }
예제 #30
0
    public bool __________; // the separator, as in Slingshot.cs

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Awake runs before Start
        S = this;  // S will be the camera to which this is attached
        camZ = this.transform.position.z; // camZ is this object's z coord
    }
예제 #31
0
	void Awake() {
		S = this;
	}