示例#1
0
    public void Move(float x, float y)
    {
        clicked = true;

        ray.transform.localPosition = new Vector2(x * 2, y * 2);

        Vector2      hitVector = new Vector2(x * 2, y * 2);
        RaycastHit2D hit       = Physics2D.Raycast(ray.transform.position, hitVector);

        if (hit.collider.tag == "NotChecked" || hit.collider.tag == "Teleport" || hit.collider.tag == "Cleaner")
        {
            if (clicked)
            {
                tr.position = new Vector3(tr.position.x + x, tr.position.y + y, 0);
            }
            if (hit.collider.tag == "Teleport")
            {
                TeleportScript.TeleportPlayer();
            }
            if (hit.collider.tag == "Cleaner")
            {
                LeftNotCheckedTiles.CleanAllChildren();
            }
            LeftNotCheckedTiles.CheckAllChildren();
        }
        StartCoroutine("Czas");
    }
    // disables or enables the player based on entered bool
    void DisablePlayer(bool pSetDisable)
    {
        /** Tell teleport script you are in a keypad before the script is called to be disabled */
        if (!_teleportScript)
        {
            _teleportScript = _player.GetComponent <TeleportScript>();
        }
        _teleportScript.isInKeypad = pSetDisable;

        foreach (MonoBehaviour script in _player.GetComponents <MonoBehaviour>())
        {
            script.enabled = !pSetDisable;
        }

        _characterBehaviour        = _player.GetComponent <CharacterBehaviour>();
        _characterControllerScheme = _player.GetComponent <CharacterControllerScheme>();

        if (pSetDisable)
        {
            _characterBehaviour.SetPhysicsColider(false);
            _characterControllerScheme.StopMovement();
        }
        if (!pSetDisable)
        {
            _characterBehaviour.SetPhysicsColider(true);
        }
    }
示例#3
0
 void Start()
 {
     targetScript    = targetTeleport.GetComponent <TeleportScript>();
     targetTransform = targetTeleport.transform.GetChild(0);
     playerTransform = GameObject.FindGameObjectWithTag("Player").transform.GetChild(0);
     play            = playerTransform.GetComponent <PlayerScript>();
 }
示例#4
0
    void Start()
    {
        allowMovement  = true;
        spriteRenderer = transform.GetComponentInChildren <SpriteRenderer>();
        plAnimation    = transform.GetComponentInChildren <Animator>();

        glitchParticles = transform.FindChild("GlitchParticles").GetComponent <ParticleSystem>();
        jumpParticles   = transform.FindChild("JumpParticles").GetComponent <ParticleSystem>();
        dustParticles   = transform.FindChild("DustParticles").GetComponent <ParticleSystem>();

        teleport = transform.FindChild("Powers/Teleport").GetComponent <TeleportScript>();
        slowFPS  = transform.FindChild("Powers/SlowFPS").GetComponent <SlowFPS>();

        state = player_state.IN_GROUND;
    }
示例#5
0
    protected void SpawnTeleportOut()
    {
        GameObject tmp = GameObject.FindGameObjectWithTag("Generator");

        if (tmp != null)
        {
            GenerateIsland gen = tmp.GetComponent <GenerateIsland>();
            Debug.Log("added a way out");
            GameObject     tele = Instantiate(Resources.Load <GameObject>("Teleporter"));
            TeleportScript tp   = tele.GetComponent <TeleportScript>();
            tp.exitingFight         = true;
            tp.TargetX              = gen.GetPlayerStart().x;
            tp.TargetY              = gen.GetPlayerStart().y;
            tp.TargetZ              = gen.GetPlayerStart().z;
            tele.transform.position = arenaStart + ((arenaEnd - arenaStart) / 2);
        }
    }
示例#6
0
    void OnTriggerExit2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Hide"))
        {
            canHide = false;
        }

        if (other.gameObject.CompareTag("Transition"))
        {
            teleport    = null;
            canTeleport = false;
        }

        if (other.gameObject.CompareTag("NoiseArea"))
        {
            if (soundManager.IsPlaying("Dripping"))
            {
                soundManager.StopSound("Dripping");
            }
        }
    }
示例#7
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Hide"))
        {
            canHide = true;
        }

        if (other.gameObject.CompareTag("Transition"))
        {
            teleport    = other.gameObject.GetComponent <TeleportScript>();
            canTeleport = true;
        }

        if (other.gameObject.CompareTag("NoiseArea"))
        {
            if (!soundManager.IsPlaying("Dripping"))
            {
                soundManager.PlayLooped("Dripping");
            }
        }
    }
示例#8
0
    // Use this for initialization
    void Start()
    {
        dm             = GameObject.Find("DungeonMaster").GetComponent <DungeonMaster> ();
        teleport       = GameObject.FindGameObjectWithTag("nextLevel").GetComponent <TeleportScript>();
        interactText   = GameObject.Find("InteractionText").GetComponent <Text>();
        deathUI        = GameObject.Find("DeathUI");
        target         = GameObject.Find("Target").GetComponent <Text> ();
        cursor         = GameObject.Find("Cursor").GetComponent <Image> ();
        potionCount    = GameObject.Find("PotionCount").GetComponent <Text> ();
        dayCounter     = GameObject.Find("DayCounter").transform.Find("DAY").GetComponent <Text> ();
        dayCounterAnim = GameObject.Find("DayCounter").GetComponent <Animator> ();
        waveCount      = GameObject.Find("Spawner_Final").GetComponent <Spawner_Final> ();
        stamina [0]    = GameObject.Find("MainPanel").transform.Find("STAMINA").transform.Find("SbBar").GetComponent <Image> ();
        stamina [1]    = GameObject.Find("MainPanel").transform.Find("STAMINA").transform.Find("SbFull").GetComponent <Image> ();
        stamina [2]    = GameObject.Find("MainPanel").transform.Find("STAMINA").transform.Find("Sb23").GetComponent <Image> ();
        stamina [3]    = GameObject.Find("MainPanel").transform.Find("STAMINA").transform.Find("Sb13").GetComponent <Image> ();

        activeWeapon[0] = GameObject.Find("AttackPanel").transform.Find("SwordActive").GetComponent <Image> ();     //Sword Active
        activeWeapon[1] = GameObject.Find("AttackPanel").transform.Find("BowActive").GetComponent <Image> ();       //Bow Active

        currentInputIcons[0] = GameObject.Find("AttackPanel").transform.Find("LeftClick").GetComponent <Image> ();  //Left Click
        currentInputIcons[1] = GameObject.Find("AttackPanel").transform.Find("RightClick").GetComponent <Image> (); //Right Click
        currentInputIcons[2] = GameObject.Find("AttackPanel").transform.Find("R1").GetComponent <Image> ();         //R1
        currentInputIcons[3] = GameObject.Find("AttackPanel").transform.Find("R2").GetComponent <Image> ();         //R2

        attackIcons[0] = GameObject.Find("AttackPanel").transform.Find("SwordAtk").GetComponent <Image> ();         //Sword Atk
        attackIcons[1] = GameObject.Find("AttackPanel").transform.Find("SwordSpec").GetComponent <Image> ();        //Sword Special
        attackIcons[2] = GameObject.Find("AttackPanel").transform.Find("BowAtk").GetComponent <Image> ();           //Bow Atk
        attackIcons[3] = GameObject.Find("AttackPanel").transform.Find("BowSpec").GetComponent <Image> ();          //Bow Special

        specialCD      = GameObject.Find("AttackPanel").transform.Find("SpecialCD").GetComponent <Text>();
        swordSpecialCD = attackIcons [1].color;
        bowSpecialCD   = attackIcons [3].color;
        specialCD.text = "";

        c = healthOverlay.color;

        deathUI.SetActive(false);
    }
示例#9
0
 private void Start()
 {
     oneTimeEntrence = true;
     teleportScript  = GameObject.Find("Teleport").GetComponent <TeleportScript>();
     teleport2Script = GameObject.Find("Teleport2").GetComponent <TeleportScript>();
 }
示例#10
0
    void Start()
    {
        allowMovement = true;
        spriteRenderer = transform.GetComponentInChildren<SpriteRenderer>();
        plAnimation = transform.GetComponentInChildren<Animator>();

        glitchParticles = transform.FindChild("GlitchParticles").GetComponent<ParticleSystem>();
        jumpParticles = transform.FindChild("JumpParticles").GetComponent<ParticleSystem>();
        dustParticles = transform.FindChild("DustParticles").GetComponent<ParticleSystem>();

        teleport = transform.FindChild("Powers/Teleport").GetComponent<TeleportScript>();
        slowFPS = transform.FindChild("Powers/SlowFPS").GetComponent<SlowFPS>();

        state = player_state.IN_GROUND;
    }