Пример #1
0
    // Use this for initialization
    void Start()
    {
        audio = GetComponent <AudioSource>();

        if (instance == null)
        {
            instance = this;
        }
        else if (instance == this)
        {
            Destroy(gameObject);
        }

        //var l = (GameObject)Resources.Load("pref/Сердце");        //работа с папкой Resourses
        // Instantiate(l,new Vector2(-5,2),Quaternion.identity);

        // тут определяем зону видимости в зависимости от разрешения экрана
        float f       = 1920 * ratio;
        float ortSize = f / 150f;

        Camera.main.orthographicSize = ortSize;

        hero = GetComponent <Rigidbody2D>();
        anim = GetComponent <Animator>();
    }
Пример #2
0
    //private int _axisX;
    //private int _axisY;

    // Use this for initialization
    void Start()
    {
        Main_Script     = Main_GameObject.GetComponent <Main>();
        hero_Script     = hero_object.GetComponent <heroScript>();
        actionPoint     = Main_Script.actionPoint - 1;
        _matrixPosition = new bool[actionPoint * 2, actionPoint *2];
        _lineYMax       = 1;
    }
	// Use this for initialization
	void Start () {
        hero = GameObject.Find("Hero");
        hs = hero.GetComponent<heroScript>();
        Debug.Log("EventManager: Hero and their script found.");
        selfinit = true;

        //powerUps = GameObject.FindGameObjectsWithTag("powerUp");
        //No collectibles yet
        //collectibles = GameObject.FindGameObjectsWithTag("collectibles");
	}
Пример #4
0
    // Use this for initialization
    void Start()
    {
        GameObject hero = GameObject.FindGameObjectWithTag("hero");

        hero_Script = hero.GetComponent <heroScript>();
        GameObject enemy = GameObject.FindGameObjectWithTag("enemy");

        _textAP.text = "" + actionPoint;

        button_Script = buttonManager_GameObject.GetComponent <buttonManager>();

        _numReverseTurn = 0;
        _numFreeze      = 0;
        onTrigger       = false;
        _isFixReverse   = false;
        _isReverse      = false;

        starImage.gameObject.SetActive(false);

        fixCircleReverse.gameObject.SetActive(false);

        fixCirclePause.gameObject.SetActive(false);
        freezeButton.interactable = false;

        if (ChooseFeature[0])
        {
            freezeButton.interactable = true;
        }
        if (ChooseFeature[1])
        {
            starImage.gameObject.SetActive(true);
            _textStar.text = "" + countStarWin;
        }
        if (ChooseFeature[2])
        {
            print("fixActionPointTurn" + fixActionPointTurn);
            _fixReversetext.text = "" + fixActionPointTurn;
            fixCircleReverse.gameObject.SetActive(true);
        }
        if (ChooseFeature[4])
        {
            _fixFreezetext.text = "" + fixNumFreeze;
            fixCirclePause.gameObject.SetActive(true);
        }

        endGameImageWin.gameObject.SetActive(false);
        endGameImageLose.gameObject.SetActive(false);
        //restartGame.gameObject.SetActive(false);
    }
Пример #5
0
    IEnumerator dashTransition(Vector2 direction)
    {
        float currentTime = 0.0f;

        canDash = false;
        charAnimator.SetBool("IsDash", true);
        dashParticles.Play();
        dashParticles.transform.localScale = transform.localScale;
        Vector2 oldPosition = transform.position;

        while (currentTime < 0.2f)
        {
            ownCollider.enabled = false;
            bigCollider.enabled = false;
            RaycastHit2D[] hits = new RaycastHit2D[100];

            ContactFilter2D filter = new ContactFilter2D();
            filter.useTriggers = false;


            int   count          = Physics2D.CircleCast(transform.position + (Vector3)hitOffset, hitRadius, direction, filter, hits, hitRadius + dashPower * Time.deltaTime);
            float distanceDashed = Vector2.Distance(oldPosition, transform.position);
            ownCollider.enabled = true;
            bigCollider.enabled = true;
            Debug.Log("hit something!");
            //Debug.Log(distanceDashed);
            if (count > 0)
            {
                for (int i = 0; i < 100; i++)
                {
                    heroScript other = hits[0].collider.transform.parent.GetComponentInParent <heroScript>();
                    if (other != null)
                    {
                        other.StartCoroutine(other.wasBumped(stunDuration, direction * distanceDashed));
                    }
                }
                StartCoroutine(DashCooldown());
                yield break; //returns
            }
            rb.AddForce(direction * dashPower, ForceMode2D.Impulse);
            currentTime += Time.deltaTime;
            yield return(new WaitForEndOfFrame());
        }
        StartCoroutine(DashCooldown());
    }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     Hero_Script     = hero_GameObject.GetComponent <heroScript>();
     Main_GameObject = GameObject.Find("Main");
     main_Script     = Main_GameObject.GetComponent <Main>();
 }