Пример #1
0
    private void Start()
    {
        animator     = this.GetComponent <Animator>();
        audioManager = this.GetComponent <ObjAudioManager>();
        rotation     = (int)(this.transform.rotation.eulerAngles.z);
        switch (rotation)
        {
        case 0:
            jumpY = 27.5f;
            jumpX = 0;
            break;

        case 90:
            jumpY = 10;
            jumpX = -20;
            break;

        case 180:
            jumpY = -27.5f;
            jumpX = 0;
            break;

        default:
            jumpY = 10;
            jumpX = 20;
            break;
        }
    }
Пример #2
0
 // Start is called before the first frame update
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
     audioManager = this.GetComponent <ObjAudioManager>();
     anim         = this.GetComponent <Animator>();
     sr           = this.GetComponent <SpriteRenderer>();
     cc           = this.GetComponent <CircleCollider2D>();
     point        = this.GetComponentInChildren <Light>();
     cc.enabled   = true;
 }
Пример #3
0
 // OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
 override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
 {
     if (audioManager == null)
     {
         audioManager = animator.gameObject.GetComponent <ObjAudioManager>();
     }
     if (stateInfo.IsName("Player_Die"))
     {
         audioManager.PlayByName("Dead");
     }
 }
 void Start()
 {
     rb.gravityScale = fallGravity;
     hp          = maxHp;
     hpText.text = hp.ToString();
     regenTimer  = 0;
     maxHpTimer  = maxHpTime;
     playerAudio = GetComponent <ObjAudioManager>();
     line.OnPlayerEnter.AddListener(Suicide);
     SceneAudioManager.instance.OnGo.AddListener(StartUp);
     Camera.main.gameObject.GetComponent <CameraController>().End.AddListener(end);
     enabled = false;
 }
Пример #5
0
 void Start()
 {
     counter      = Resources.Load <Counter>("Scriptable Object/Counter");
     player       = GameObject.FindGameObjectWithTag("Player");
     control      = player.GetComponent <PlayerControl>();
     cc           = this.GetComponent <CircleCollider2D>();
     ps           = this.transform.Find("FollowParticle").GetComponent <ParticleSystem>();
     gain         = this.transform.Find("GainParticle").GetComponent <ParticleSystem>();
     sr           = this.transform.Find("Main").GetComponent <SpriteRenderer>();
     anim         = this.GetComponentInChildren <Animator>();
     cc.radius    = 1;
     initialPos   = this.transform.position;
     audioManager = this.GetComponent <ObjAudioManager>();
 }
Пример #6
0
    // Start is called before the first frame update
    void Start()
    {
        this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, -1);
        Pos              = this.transform.position;
        initial          = isActivate;
        player           = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerControl>();
        lr               = this.GetComponent <LineRenderer>();
        lr.useWorldSpace = true;
        rb               = this.GetComponent <Rigidbody2D>();
        rotation         = (int)(this.transform.rotation.eulerAngles.z);
        switch (rotation)
        {
        case 0:
            rayDir = Vector2.right;
            dir    = Vector2.up;
            break;

        case 90:
            rayDir = Vector2.up;
            dir    = Vector2.left;
            break;

        case 180:
            rayDir = Vector2.left;
            dir    = Vector2.down;
            break;

        default:
            rayDir = Vector2.down;
            dir    = Vector2.right;
            break;
        }
        rayPos    = Pos + new Vector3(0.3f * rayDir.x, 0.3f * rayDir.y, 0);
        blobPosA  = rayPos;
        blobPosB  = rayPos;
        BlobA     = Instantiate(blob, blobPosA, Quaternion.identity, this.transform);
        BlobB     = Instantiate(blob, blobPosB, Quaternion.identity, this.transform);
        dirRecord = dir;
        if (isMove)
        {
            hitDist = Mathf.Abs((MoveSpeed + 5f) / 20f);
        }
        audioManager = this.GetComponent <ObjAudioManager>();
        levelNum     = this.GetComponent <Interactable>().level;
        if (levelNum == player.currentLevel)
        {
            PlaySound(initial);
        }
    }
Пример #7
0
 void Start()
 {
     audioManager = this.GetComponent <ObjAudioManager>();
     if (handler != null)
     {
         handler.OnRetry += kill;
     }
     if (pos != null && pos.testMode == true)
     {
         this.transform.position = pos.spawnPos;
         spawnPos     = pos.spawnPos;
         currentLevel = pos.currentLevel;
     }
     else
     {
         spawnPos = this.transform.position;
     }
     rb              = this.GetComponent <Rigidbody2D>();
     animator        = this.GetComponent <Animator>();
     sr              = this.GetComponent <SpriteRenderer>();
     Normal          = sr.material;
     dashDirection   = new Vector2(0, 0);
     canJump         = false;
     canDash         = true;
     isDashing       = false;
     canControlJump  = true;
     canControlMove  = true;
     onWall          = false;
     backWall        = false;
     isTransitioning = false;
     rb.gravityScale = 2.75f;
     canCollect      = true;
     dashJump        = false;
     springJump      = false;
     canCheckWall    = true;
 }