예제 #1
0
 void Start()
 {
     rb            = GetComponent <Rigidbody2D>();
     playerSprite  = GetComponentInChildren <SpriteRenderer>();
     playerGravity = FindObjectOfType <PlayerGravity>();
     enemyScript   = FindObjectOfType <Enemy>();
 }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        change = false;
        GameObject anotherObject = GameObject.Find("cat");

        PG = anotherObject.GetComponent <PlayerGravity>();
    }
예제 #3
0
 private void Awake()
 {
     playerController = GetComponent <PlayerController>();
     gravityScript    = GetComponent <PlayerGravity>();
     rb   = GetComponent <Rigidbody>();
     anim = GetComponent <Animator>();
 }
예제 #4
0
 void Start()
 {
     rb = GetComponent <Rigidbody2D>();
     //playerSprite = GetComponentInChildren<SpriteRenderer>();
     playerGravity   = FindObjectOfType <PlayerGravity>();
     defaultRunSpeed = playerSpeed;
 }
예제 #5
0
    void Awake()
    {
        m_Rigidbody = GetComponent <Rigidbody>();
        pg          = GetComponent <PlayerGravity>();

        m_Rigidbody.constraints = RigidbodyConstraints.FreezeRotationX | RigidbodyConstraints.FreezeRotationY | RigidbodyConstraints.FreezeRotationZ;
    }
예제 #6
0
 // Use this for initialization
 void Start()
 {
     rigid     = GetComponent <Rigidbody> ();
     gravity   = GetComponent <PlayerGravity> ();
     ui        = GetComponent <UIControl> ();
     source    = GetComponent <AudioSource> ();
     gamestate = GameState.PLAYING;
 }
예제 #7
0
 // Use this for initialization
 void Start()
 {
     playerHiding = false;
     distaceFromWall = 0.0f;
     playerGravity = GetComponent<PlayerGravity> ();
     player = GetComponent<CharacterController> ();
     onStairs = false;
     playerHid = false;
 }
예제 #8
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.tag == "Player")
     {
         player = collision.GetComponent <PlayerGravity>();
         player.AddGravity(gravityImpact);
         gameObject.SetActive(false);
     }
 }
예제 #9
0
 private void Awake()
 {
     comboManager       = GetComponentInParent <ComboManager>();
     audioSource        = GetComponent <AudioSource>();
     gameOver           = GetComponent <GameOver>();
     death              = GetComponentInParent <Death>();
     horizontalMovement = GetComponent <HorizontalMovement>();
     stateManager       = GetComponentInParent <PlayerStateManager>();
     playerGravity      = GetComponent <PlayerGravity>();
 }
예제 #10
0
    void Awake()
    {
        instance = this;

        planet = GameObject.FindGameObjectWithTag("Planet").GetComponent <PlanetGravity>();
        rb     = GetComponent <Rigidbody> ();

        // Disable rigidbody gravity and rotation as this is simulated in GravityAttractor script
        rb.useGravity  = false;
        rb.constraints = RigidbodyConstraints.FreezeRotation;
    }
예제 #11
0
    void Start()
    {
        _camControl             = FindObjectOfType <CameraControl>();
        _inputHandler           = FindObjectOfType <InputHandler>();
        _playerManipulationArea = FindObjectOfType <PlayerManipulationArea>();

        _playerAim       = GetComponent <PlayerAim>();
        _playerGravity   = GetComponent <PlayerGravity>();
        _playerAnimation = GetComponentInChildren <PlayerAnimation>();

        ChangeSkillMode();
    }
예제 #12
0
 public PlayerController(PlayerParameter playerParameter, GameObject speedEffectObj = null)
 {
     parameter      = playerParameter;
     playerMover    = new PlayerMover(parameter.StartAccelSpeed);
     playerInput    = new PlayerInput();
     playerGravity  = new PlayerGravity();
     playerAnimator = new PlayerAnimator();
     gameObject     = PlayerObjectManager.Instance.PlayerObject;
     if (speedEffectObj != null)
     {
         speedEffectObject = speedEffectObj;
     }
 }
예제 #13
0
    void Awake()
    {
        running     = false;
        grounded    = false;
        jetPackFuel = jetPackFuelMax;
        rb          = GetComponent <Rigidbody2D>();
        //coinSoundRef = GetComponent<CoinSound>();
        inOrbit = false;

        playerGravity = planet.GetComponent <PlayerGravity>();

        anim          = GetComponent <Animator>();
        weaponManager = GetComponent <WeaponManager>();
        //groundCheckRadius = 1f;
    }
예제 #14
0
    // Start is called before  the first frame update
    void Start()
    {
        rigid2D    = GetComponent <Rigidbody2D>();
        starrender = gameObject.GetComponent <SpriteRenderer>();
        //particle = GameObject.Find("Particle System");
        //particle.SetActive(false);
        starrender.sprite = catsprite;
        mode         = true;//trueは人間 falseは星
        anim         = GetComponent <Animator>();
        audioManager = GetComponent <AudioManager>();

        currentStar = startingStar;
        breakblock  = GameObject.Find("BreakBlock");

        playerGravity = gameObject.GetComponent <PlayerGravity>();

        jumpCount = startJumpCount;
    }
예제 #15
0
 // Use this for initialization
 private void Start()
 {
     m_CharacterController = GetComponent <CharacterController>();
     m_Camera = Camera.main;
     m_OriginalCameraPosition = m_Camera.transform.localPosition;
     m_FovKick.Setup(m_Camera);
     m_HeadBob.Setup(m_Camera, m_StepInterval);
     m_StepCycle   = 0f;
     m_NextStep    = m_StepCycle / 2f;
     m_Jumping     = false;
     gameOver      = false;
     playerDied    = false;
     m_AudioSource = GetComponent <AudioSource>();
     mouseLook     = GetComponentInChildren <MouseLook>();
     //m_MouseLook.Init(transform , m_Camera.transform);
     g            = GetComponent <PlayerGravity>();
     oxygenScript = GetComponent <OxygenLevels>();
     numKeycards  = 0;
 }
예제 #16
0
    private void Start()
    {
        _anim          = GetComponent <Animator>();
        _rb            = GetComponentInParent <Rigidbody>();
        _playerGravity = GetComponentInParent <PlayerGravity>();
        _playerAim     = GetComponentInParent <PlayerAim>();
        _playerSkills  = GetComponentInParent <PlayerSkills>();
        _inputHandler  = FindObjectOfType <InputHandler>();

        // Layer index does not change so getting this once is enough.
        _aimLayer   = _anim.GetLayerIndex("Aim");
        _powerLayer = _anim.GetLayerIndex("Power");

        // get head
        Transform[] bones = GetComponentsInChildren <Transform>(includeInactive: true);
        foreach (Transform child in bones)
        {
            if (child.name.Contains("PAA"))
            {
                _head = child;
                continue;
            }
        }
    }
예제 #17
0
    public void Teleport(PlanetType _planetType)
    {
        TeleportScreen.SetActive(false);
        Time.timeScale = 1f;

        switch (_planetType)
        {
        case PlanetType.Grass:
            GrassBackground.SetActive(true);
            WaterBackground.SetActive(false);
            DesertBackground.SetActive(false);
            FireBackground.SetActive(false);

            GrassBits.SetActive(true);
            WaterBits.SetActive(false);
            DesertBits.SetActive(false);
            FireBits.SetActive(false);

            GrassPlanet.gameObject.tag  = "Planet";
            WaterPlanet.gameObject.tag  = "Untagged";
            DesertPlanet.gameObject.tag = "Untagged";
            FirePlanet.gameObject.tag   = "Untagged";

            //yield return new WaitForSeconds(0.5f);

            PlayerGravity.UpdatePlanetGravity();
            PlayerController360.planetGravity = GameObject.FindGameObjectWithTag("Planet").GetComponent <PlanetGravity>();

            player.GetComponent <Rigidbody>().velocity = player.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
            player.transform.position    = GrassPlayerSpawnPosition;
            player.transform.eulerAngles = GrassPlayerSpawnEulerAngles;
            break;

        case PlanetType.Water:
            GrassBackground.SetActive(false);
            WaterBackground.SetActive(true);
            DesertBackground.SetActive(false);
            FireBackground.SetActive(false);

            GrassBits.SetActive(false);
            WaterBits.SetActive(true);
            DesertBits.SetActive(false);
            FireBits.SetActive(false);

            GrassPlanet.gameObject.tag  = "Untagged";
            WaterPlanet.gameObject.tag  = "Planet";
            DesertPlanet.gameObject.tag = "Untagged";
            FirePlanet.gameObject.tag   = "Untagged";

            //yield return new WaitForSeconds(0.5f);

            PlayerGravity.UpdatePlanetGravity();
            PlayerController360.planetGravity = GameObject.FindGameObjectWithTag("Planet").GetComponent <PlanetGravity>();

            player.GetComponent <Rigidbody>().velocity = player.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
            player.transform.position    = WaterPlayerSpawnPosition;
            player.transform.eulerAngles = WaterPlayerSpawnEulerAngles;
            break;

        case PlanetType.Desert:
            GrassBackground.SetActive(false);
            WaterBackground.SetActive(false);
            DesertBackground.SetActive(true);
            FireBackground.SetActive(false);

            GrassBits.SetActive(false);
            WaterBits.SetActive(false);
            DesertBits.SetActive(true);
            FireBits.SetActive(false);

            GrassPlanet.gameObject.tag  = "Untagged";
            WaterPlanet.gameObject.tag  = "Untagged";
            DesertPlanet.gameObject.tag = "Planet";
            FirePlanet.gameObject.tag   = "Untagged";

            //yield return new WaitForSeconds(0.5f);

            PlayerGravity.UpdatePlanetGravity();
            PlayerController360.planetGravity = GameObject.FindGameObjectWithTag("Planet").GetComponent <PlanetGravity>();

            player.GetComponent <Rigidbody>().velocity = player.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
            player.transform.position    = DesertPlayerSpawnPosition;
            player.transform.eulerAngles = DesertPlayerSpawnEulerAngles;
            break;

        case PlanetType.Fire:
            GrassBackground.SetActive(false);
            WaterBackground.SetActive(false);
            DesertBackground.SetActive(false);
            FireBackground.SetActive(true);

            GrassBits.SetActive(false);
            WaterBits.SetActive(false);
            DesertBits.SetActive(false);
            FireBits.SetActive(true);

            GrassPlanet.gameObject.tag  = "Untagged";
            WaterPlanet.gameObject.tag  = "Untagged";
            DesertPlanet.gameObject.tag = "Untagged";
            FirePlanet.gameObject.tag   = "Planet";

            //yield return new WaitForSeconds(0.5f);

            PlayerGravity.UpdatePlanetGravity();
            PlayerController360.planetGravity = GameObject.FindGameObjectWithTag("Planet").GetComponent <PlanetGravity>();

            player.GetComponent <Rigidbody>().velocity = player.GetComponent <Rigidbody>().angularVelocity = Vector3.zero;
            player.transform.position    = FirePlayerSpawnPosition;
            player.transform.eulerAngles = FirePlayerSpawnEulerAngles;
            break;

        default: break;
        }
    }
예제 #18
0
 void Start()
 {
     playerGravity = FindObjectOfType <PlayerGravity>();
     countdown     = playerGravity.GravityTimer + .5f;
 }
 void Awake()
 {
     playerController = GetComponent <PlayerController>();
     gravityScript    = GetComponent <PlayerGravity>();
     anim             = GetComponent <Animator>();
 }
예제 #20
0
 private void Start()
 {
     objects   = new List <AirCurrentObj>();
     pGrav     = GameObject.Find("Player3").GetComponent <PlayerGravity>();
     pauseMenu = GameObject.Find("UI").GetComponent <PauseMenu>();
 }
예제 #21
0
    // Use this for initialization
    void Start()
    {
        player = GetComponent<CharacterController> ();
        gravity = GetComponent<PlayerGravity> ();
        playerMove = GetComponent<PlayerMove> ();

        timer = 0;
        timerRunning = false;
        knockback = Vector3.zero;
        addingKnockback = false;
        knowbackTimer = 0;
    }
예제 #22
0
 // Use this for initialization
 void Awake()
 {
     planet       = GameObject.FindGameObjectWithTag("Planet");
     localGravity = planet.GetComponent <PlayerGravity>();
 }
예제 #23
0
 // Start is called before the first frame update
 void Start()
 {
     CGravity = false;
     PG       = GetComponent <PlayerGravity>();
 }