Exemple #1
0
    public GameObject Shadow; //Cień

    void Start()
    {
        //Dołączenie do obiektu odpowiednich komponentów
        Player      = GameObject.Find("Player").GetComponent <Transform>();
        rgb2d       = gameObject.GetComponent <Rigidbody2D>();
        audioSource = gameObject.GetComponent <AudioSource>();
        cam         = GameObject.Find("Main Camera").GetComponent <Camera_Following>();

        if (audioClip != null)
        {
            audioSource.clip = audioClip;
            audioSource.Play();
        }

        if (shouldShakeCameraOnStart)
        {
            cam.ShakeCamera(ShakePow, ShakeDur);
        }

        if (gameObject.GetComponentInChildren <ParticleSystem>() != null)
        {
            particle       = gameObject.GetComponentInChildren <ParticleSystem>();
            spriteRenderer = gameObject.GetComponent <SpriteRenderer>();
        }

        if (Shadow != null)
        {
            Instantiate(Shadow, transform);
        }
    }
Exemple #2
0
    void Start()
    {
        player       = FindObjectOfType <Player_Controller> ();
        cam          = GameObject.Find("Main Camera").GetComponent <Camera_Following>();
        gm           = GameObject.FindGameObjectWithTag("GameMaster").GetComponent <Game_Master>();
        HasAMeeleDMG = false;
        rb2d         = gameObject.GetComponent <Rigidbody2D>();


        if (Knife)                                                                           //jeżeli to jest nóż z ekwipunku
        {
            dmg          = gm.Secon_Weapon_Slot.GetComponentInChildren <ElementEq>().attack; //pobranie wartości obrażeń z obiektu w ekwipunku
            dmg          = gm.PlayerStatsAttack * dmg * 0.1f + dmg;                          //mnożnik ataku
            HasAMeeleDMG = true;
        }
        else
        {
            for (int i = 0; i < DmgType.Length; i++)
            {
                if (DmgType[i] == global::DmgType.Meele)
                {
                    HasAMeeleDMG = true;
                }
            }
        }

        if (player.facingRight) //ustawienie skali obiektu
        {
            transform.localScale = new Vector3(1, 1, 1);
        }
        else
        {
            transform.localScale = new Vector3(-1, 1, 1);
            speed = -speed;
        }
    }