Example #1
0
    void Start()
    {
        Error();

        node      = GetComponent <tileMap> ();
        score     = GetComponent <scoreManager> ();
        audioSoul = GetComponent <AudioSource> ();

        if (!audioSoul)
        {
            Debug.LogError("audioSoul (AudioSource) is null (spawnSoul)");
        }
        if (!node)
        {
            Debug.LogError("node (tileMap) is null (spawnSoul)");
        }
        if (!score)
        {
            Debug.LogError("score (scoreManager) is null (spawnSoul)");
        }

        if (redSoul)
        {
            InvokeRepeating("SpawnRedSoul", startRedSpawn, spawnRedRepeat);
        }

        isExplorePath = (PlayerPrefs.GetInt("isExplore") == 0) ? false : true;
        isRedSoul     = false;
        isYellowSoul  = false;
        rotateCamera  = 0f;
        isShake       = false;
    }
Example #2
0
    void Start()
    {
        Error();
        if (map)
        {
            node  = map.GetComponent <tileMap> ();
            score = map.GetComponent <scoreManager> ();

            if (!score)
            {
                Debug.LogError("score (map) is null (enemyController)");
            }
            else
            {
                InvokeRepeating("ChangeSpeed", durationSpeed, durationSpeed);
            }
            if (!node)
            {
                Debug.LogError("score (map) is null (enemyController)");
            }
            else
            {
                ChangeNode();
            }
        }

        anim = GetComponent <Animator> ();
        if (!anim)
        {
            Debug.LogError("anim is null (enemyController)");
        }
    }
Example #3
0
 // Use this for initialization
 void Start()
 {
     MapCurrentX = MapNextX =  MapCurrentY = MapNextY = 0; //initiallize tile map positions
     pos = transform.position; //next x,y,z positions on inspector
     tr = transform; ////current x,y,z positions on inspector
     previusAxis = axis;
     previusDirection = direction;
     map = GetComponent<tileMap> (); //get component for tile map reading
 }
Example #4
0
    void Start()
    {
        map = GetComponent<tileMap> ();

        for (var x=0; x<17; x++)
        {
            for (var y=0; y<21; y++) {
                if (map.tiles[x,y]==0){
                    Instantiate (Resources.Load ("blTile"), new Vector3 (x, y, 0), Quaternion.identity);
                }
                else{
                    Instantiate (Resources.Load ("tile"), new Vector3 (x, y, 0), Quaternion.identity);
                }
            }
        }
    }
    void OnEnable()
    {
        map           = target as tileMap;
        Tools.current = Tool.View;

        if (map.tiles == null)
        {
            var tilesGO = new GameObject("Tiles");
            tilesGO.transform.SetParent(map.transform);
            tilesGO.transform.position = Vector3.zero;

            map.tiles = tilesGO;
        }

        if (map.texture2D != null)
        {
            UpdateCalculations();
            newBrush();
        }
    }
Example #6
0
    void Start()
    {
        Error();
        if (map)
        {
            node   = map.GetComponent <tileMap> ();
            score  = map.GetComponent <scoreManager> ();
            spawn  = map.GetComponent <spawnSoul> ();
            status = map.GetComponent <gameOver> ();

            if (!score)
            {
                Debug.LogError("score (map) is null (heroController)");
            }
            if (!status)
            {
                Debug.LogError("status (map) is null (heroController)");
            }
            if (!spawn)
            {
                Debug.LogError("spawn (map) is null (heroController)");
            }
            if (!node)
            {
                Debug.LogError("node (map) is null (heroController)");
            }
            else
            {
                ChangeNode();
            }
        }

        if (teleport)
        {
            isTeleport  = true;
            imgTeleport = teleport.GetComponent <Image> ();
            btnTeleport = teleport.GetComponent <Button> ();

            if (!imgTeleport)
            {
                Debug.LogError("imgTeleport (teleport) is null (heroController)");
            }
            else
            {
                imgTeleport.fillAmount = 0f;
            }
            if (!btnTeleport)
            {
                Debug.LogError("btnTeleport (teleport) is null (heroController)");
            }
            else
            {
                btnTeleport.interactable = false;
            }
        }

        if (explore)
        {
            if (score.isExplore == 1)
            {
                Destroy(explore);
            }
            else
            {
                imgExplore = explore.GetComponent <Image> ();
                if (!imgExplore)
                {
                    Debug.LogError("imgExplore (explore) is null (heroController)");
                }
                else
                {
                    imgExplore.fillAmount = 1f;
                }
            }
        }

        if (scoreDisplay)
        {
            scoreDisplay.text = "0";
        }

        anim        = GetComponent <Animator> ();
        audioSource = GetComponent <AudioSource> ();
        if (!anim)
        {
            Debug.LogError("anim (Animator) is null (heroController)");
        }
        if (!audioSource)
        {
            Debug.LogError("audioSource (AudioSource) is null (heroController)");
        }

        isMove      = false;
        world.x     = Screen.width / 2;
        world.y     = Screen.height / 2;
        speed       = speedStart;
        rotate      = transform.eulerAngles.z;
        maxOpenPath = node.nodeOpen.Count;

        if (rotate == 0f)
        {
            direct = Vector2.up;
        }
        else if (rotate == 90f)
        {
            direct = Vector2.left;
        }
        else if (rotate == 180f)
        {
            direct = Vector2.down;
        }
        else if (rotate == 270f)
        {
            direct = Vector2.right;
        }

        InvokeRepeating("TeleportReload", 0, 1f);
    }