예제 #1
0
    void Start()
    {
        // get player object and script
        p  = GameObject.FindWithTag("Player");
        ph = p.GetComponent <pHealth>();


        // get enemy array
        //GameObject initial = GameObject.Find("init");
        ///InitScript intiscript = initial.GetComponent<InitScript>();
        //enemyArray = intiscript.enemies;


        mySpriteRenderer = GetComponent <SpriteRenderer>();

        accel = UnityEngine.Random.Range((accelStart * minSpeedPercent), (accelStart * maxSpeedPercent));

        // accessing the SpriteRenderer that is attached to the Gameobject
        spriteRenderer        = GetComponent <SpriteRenderer>();
        spriteRenderer.sprite = sprite1;

        // set inital anim
        walking  = true;
        punching = false;
    }
예제 #2
0
    // Start is called before the first frame update
    void Start()
    {
        GameObject initial    = GameObject.Find("init");
        InitScript intiscript = initial.GetComponent <InitScript>();

        enemyArray = intiscript.enemies;

        //ourUI = GameObject.Find("playerUI");
        //scoreText = ourUI.GetComponent<TextMeshProUGUI>();
        //st = ourUI.GetComponent<TextMeshPro>();

        p  = GameObject.Find("player");
        ph = p.GetComponent <pHealth>();
    }