Exemplo n.º 1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.GetComponent <Player_Controls>())
        {
            Player_Controls player = collision.GetComponent <Player_Controls>();
            switch (part)
            {
            case LadderPart.complete:
                player.canClimb = true;
                player.ladder   = this;
                break;

            case LadderPart.bottom:
                player.bottom_L = true;
                break;

            case LadderPart.top:
                player.top_L = true;
                break;

            default:
                break;
            }
        }
    }
Exemplo n.º 2
0
    private void Awake()
    {
        //Create an instance of Player_Controls and set it in the controls variable
        controls = new Player_Controls();

        controls.PlayerControls.Move.performed += ctx => movementinput = ctx.ReadValue <Vector2>(); //If the move input is performed then read the values
        controls.PlayerControls.Move.canceled  += ctx => movementinput = Vector2.zero;              //If the move input is canceled then set Vector2 variables to 0

        controls.PlayerControls.Rotation.performed += ctx => lookPos = ctx.ReadValue <Vector2>();   //If the rotation input is performed then read the values

        //Get Animator in children
        animator = GetComponentInChildren <Animator>();

        //Get the RigidBody component from this object and set it to the playerrb variable
        playerrb = this.GetComponent <Rigidbody>();

        //Set playerPlane to a new Plane
        playerPlane = new Plane(Vector3.up, transform.position);

        //Set the currentAmmo to ammoClip and ammoHeld to the ammoCapacity
        currentAmmo = ammoClip;
        ammoHeld    = ammoCapacity;

        //Get the GameManager and AudioManager components and set them to respective variables
        gameM  = gameManager.GetComponent <GameManager>();
        audioM = audioManager.GetComponent <AudioManager>();
    }
Exemplo n.º 3
0
 // Start is called before the first frame update
 void Start()
 {
     Player_Current_Health = Player_Start_Health;
     Original_Color        = GetComponent <SpriteRenderer>().color;
     My_Playercontrols     = GetComponent <Player_Controls>();
     My_Player_Rigidbody   = GetComponent <Rigidbody2D>();
     My_PlayerboxCollider  = GetComponent <BoxCollider2D>();
 }
 void Start()
 {
     currentHealth      = maxHealth;
     playerCombatScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Controls>();
     gameManagerObject  = GameObject.Find("GameManager");
     gameManagerScript  = gameManagerObject.GetComponent <GameManagement>();
     audio  = GetComponent <AudioSource>();
     isDead = false;
 }
Exemplo n.º 5
0
 void Start()
 {
     pl_controls = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Controls>();
     damageAmnt  = pl_controls.spellDamage;
     startLoc    = pl_controls.targetStart.position;
     endLoc      = pl_controls.targetEnd;
     lifeTime    = 0f;
     trailRen    = GetComponent <TrailRenderer>();
     audio       = GetComponent <AudioSource>();
 }
Exemplo n.º 6
0
 void Start()
 {
     currentHealth      = maxHealth;
     playerCombatScript = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Controls>();
     gameManagerObject  = GameObject.Find("GameManager");
     gameManagerScript  = gameManagerObject.GetComponent <GameManagement>();
     audio               = GetComponent <AudioSource>();
     healthMeter         = GameObject.Find("Boss Health");
     healthSlider        = healthMeter.GetComponent <Scrollbar>();
     healthSlider.value  = (currentHealth / maxHealth);
     bossTextHealth      = GameObject.Find("Boss Text").GetComponent <Text>();
     bossTextHealth.text = currentHealth.ToString();
     isDead              = false;
 }
 private void Awake()
 {
     m_Player_Controls = new Player_Controls();
     m_Player_Controls.Player.SetCallbacks(this);
 }
Exemplo n.º 8
0
 void Start()
 {
     player     = GameObject.FindGameObjectWithTag("Player");
     playerCont = player.GetComponent <Player_Controls>();
     audio      = GetComponent <AudioSource>();
 }
Exemplo n.º 9
0
    // SET BASIC PROBABILITY FOR EACH TARGET  ----------------------------------------------------------------------- awake ---------------------------------------------------------------
    private void Awake()
    {
        // initial spawn probability
        for (int i = 0; i < cannon_prefab.FoodList.Length; ++i)
        {
            cannon_prefab.FoodList[i].GetComponent <Food>().probability = match_quests[current_quest].targets_probability[i];
        }

        // hiding quest banners
        foreach (GameObject banner in QuestBanners) // at the start, every slot of the quest is deactivated
        {
            banner.SetActive(false);
        }

        match_over_text.SetActive(false);
        EndMenu.SetActive(false);
        p1win.SetActive(false);
        p2win.SetActive(false);

        StartCoroutine(MatchCountdownInitial());  // initial time for the start of the countdown

        // instantiate players
        if (/*account_setup_memory.activeInHierarchy &&*/ !match_initialized)
        {
            match_initialized = true;
            // get component della memory e prendi i vari asset

            // get the array, instantiate the i <- (memory) element of the array

            GameObject P1_prefab; // PLAYER 1

            P1_prefab = Instantiate(Players_prefab[Account_setup_memory.selected_character], P1_spawner.transform.position, Quaternion.identity);



            player_1 = P1_prefab.transform.GetChild(0).GetComponent <Player_Controls>(); // PLAYER 1 IS ASSIGNED
            player_1.special_attack_button_spawner = P1_attack_button_spawner;
            player_1.streak_text = P1_streak_box.transform.GetChild(0).GetComponent <Text>();

            for (int i = 0; i < P1_flags.Length; ++i)
            {
                player_1.Flags[i] = P1_flags[i];
            }

            GameObject P2_prefab; // PLAYER 2 - opponent is randomic every match

            P2_prefab = Instantiate(Opponents_prefab[Random.Range(0, Opponents_prefab.Length)], P2_spawner.transform.position, Quaternion.identity);



            player_2 = P2_prefab.transform.GetChild(0).GetComponent <IA_controller>(); // PLAYER 2 IS ASSIGNED
            player_2.special_attack_button_spawner = P2_attack_button_spawner;
            player_2.streak_text = P2_streak_box.transform.GetChild(0).GetComponent <Text>();

            for (int i = 0; i < P2_flags.Length; ++i)
            {
                player_2.Flags[i] = P2_flags[i];
            }

            // BACKGROUND
            Instantiate(Backgrounds_prefab[Account_setup_memory.selected_stage], background_spawner.transform.position, Quaternion.identity); // BACKGROUND IS CREATED
        }
    }
Exemplo n.º 10
0
 private void Awake()
 {
     pc = new Player_Controls();
 }
Exemplo n.º 11
0
    // Update is called once per frame

    private void Start()
    {
        lightControls  = GameObject.FindGameObjectWithTag("PlayerLight").GetComponent <Light_Control>();
        playerControls = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Controls>();
    }