Ejemplo n.º 1
0
    public void OnLanguageChange()
    {
        if (isTranslatable)
        {
            text = translatingText;
        }

        gameObject.GetComponent <TextMesh> ().font = ResourcesController.Load("Fonts/TextFont" + Settings.language) as Font;
    }
Ejemplo n.º 2
0
    public LightningController()
    {
        boltPrefab = ResourcesController.Load("Prefabs/Bolt") as GameObject;
        linePrefab = ResourcesController.Load("Prefabs/Line") as GameObject;

        activeBoltsObj   = new List <GameObject> ();
        inactiveBoltsObj = new List <GameObject> ();
        attacks          = new List <ToAttack> ();
    }
    public static GameObject CreateBlock()
    {
        tempGameObject = PullController.GetObject("Block");

        if (tempGameObject == null)
        {
            tempGameObject = GameObject.Instantiate(ResourcesController.Load("Prefabs/Block")) as GameObject;
        }
        tempGameObject.name = "Block" + GetId("Block");
        AddToHistory(tempGameObject, DestroyBlock);
        return(tempGameObject);
    }
    public static GameObject CreateAudio()
    {
        tempGameObject = PullController.GetObject("AudioUndestroyable");

        if (tempGameObject == null)
        {
            tempGameObject = GameObject.Instantiate(ResourcesController.Load("Prefabs/Audio")) as GameObject;
        }

        tempGameObject.name = "Audio" + GetId("AudioUndestroyable");
        return(tempGameObject);
    }
    public static GameObject CreateCoolEffect()
    {
        tempGameObject = PullController.GetObject("CoolEffect");

        if (tempGameObject == null)
        {
            tempGameObject = GameObject.Instantiate(ResourcesController.Load("Prefabs/CoolLetterEffect")) as GameObject;
        }

        tempGameObject.name = "CoolEffect" + GetId("CoolEffect");
        AddToHistory(tempGameObject, DestroyCoolEffect);
        return(tempGameObject);
    }
    public static GameObject CreateText()
    {
        tempGameObject = PullController.GetObject("TextUndestroyable");

        if (tempGameObject == null)
        {
            tempGameObject = GameObject.Instantiate(ResourcesController.Load("Prefabs/GUI/TextMeshObject")) as GameObject;
        }

        tempGameObject.name = "Text" + GetId("TextUndestroyable");
        AddToHistory(tempGameObject, DestroyText);
        return(tempGameObject);
    }
    public static GameObject CreateImage()
    {
        tempGameObject = PullController.GetObject("GUIImageUndestroyable");

        if (tempGameObject == null)
        {
            tempGameObject = GameObject.Instantiate(ResourcesController.Load("Prefabs/GUI/GUIObject")) as GameObject;
        }

        tempGameObject.name = "GUIImage" + GetId("GUIImageUndestroyable");
        AddToHistory(tempGameObject, DestroyImage);
        return(tempGameObject);
    }
Ejemplo n.º 8
0
    public HealthBar()
    {
        healthBarRed   = GamePullController.CreateImage();
        healthBarGreen = GamePullController.CreateImage();

        healthBarRed.GetComponent <Renderer> ().material.mainTexture   = ResourcesController.Load("Textures/HealthBars/HealthBarRed") as Texture;
        healthBarGreen.GetComponent <Renderer> ().material.mainTexture = ResourcesController.Load("Textures/HealthBars/HealthBarGreen") as Texture;

        healthBarRed.transform.localScale   = new Vector3(size.x, size.y, 1);
        healthBarGreen.transform.localScale = new Vector3(size.x, size.y, 1);

        health = 1;
    }
Ejemplo n.º 9
0
    public GameObject CreateAudio(string name, bool isLoop = false, bool isMusic = false)
    {
        var audio = GamePullController.CreateAudio();

        audio.GetComponent <AudioSource> ().clip = ResourcesController.Load("Audio/" + name) as AudioClip;
        audio.GetComponent <AudioSource> ().loop = isLoop;
        audio.GetComponent <AudioSource> ().Play();

        (isMusic?musics:sounds).Add(audio);

        audio.GetComponent <AudioSource> ().mute = (isMusic && !Settings.music) || (!isMusic && !Settings.sounds);

        if (isMusic)
        {
            audio.GetComponent <AudioSource> ().volume = 0;
        }

        return(audio);
    }
Ejemplo n.º 10
0
    protected Unit(TeamColor _color, int _road)
    {
        gameObject      = GamePullController.CreateImage();
        gameObject.name = "Unit";

        shadow = GamePullController.CreateImage();
        shadow.GetComponent <Renderer> ().material.mainTexture = ResourcesController.Load("Textures/Shadow") as Texture;
        healthBar = new HealthBar();

        GameController.unitsDictionary.Add(gameObject, this);

        objectAnimation = new ObjectAnimation(gameObject);

        color = _color;

        roadIndex = 0;
        var     count = (color == TeamColor.Red?GameController.RoadRed.Count:GameController.RoadBlue.Count);
        Vector3 _targetPosition;

        if (color == TeamColor.Red)
        {
            if (_road == -1)
            {
                do
                {
                    roadNumber = Random.Range(0, count);
                } while (GameController.RoadRed[roadNumber].Count == 0);
            }
            else
            {
                roadNumber = _road;
            }


            _targetPosition = GameController.RoadRed[roadNumber][roadIndex];
        }
        else
        {
            if (_road == -1)
            {
                do
                {
                    roadNumber = Random.Range(0, count);
                } while (GameController.RoadBlue[roadNumber].Count == 0);
            }
            else
            {
                roadNumber = _road;
            }

            _targetPosition = new Vector3();
            try {
                _targetPosition = GameController.RoadBlue[roadNumber][roadIndex];
            } catch (System.Exception) {
                Debug.LogError(roadNumber + " " + roadIndex + "; " + GameController.RoadBlue.Count + " ");
            }
        }

        layer          = _targetPosition.z;
        targetPosition = GetTruePosition(_targetPosition);
        mapPosition    = targetPosition;
        isKilling      = false;
    }