Example #1
0
    private void Update()
    {
        if (_doing)
        {
            _time += Time.deltaTime;


            if (_time > 1.5f)
            {
                top.SetActive(true);

                _time = 0;
                GameObject newChar = (GameObject)Instantiate(CharPrefarb);
                chars.Add(newChar);
                if (_firstChar)
                {
                    _choosenOne = newChar.GetComponent <CharScript>();
                    _firstChar  = false;
                }
            }
        }

        // Debug.LogWarning(_cam.transform.position);

        //Debug.LogWarning((float)Screen.width / Screen.height);

        //280, 480
        _cam.transform.position = _initPos - new Vector3(Mathf.Lerp(0, 150, 1 - Mathf.Clamp01((float)Screen.width / Screen.height - 1.0f)), 0, 0);
        //_cam.transform.position = _initPos - new Vector3(Mathf.Lerp(0, , Screen.width * 0.4f), 0, 0);

        var pos = Logo.transform.position;

        Logo.transform.position = new Vector3(_cam.transform.position.x, pos.y, pos.z);
    }
Example #2
0
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     SetCameraX();
 }
Example #3
0
 private void OnMouseUp()
 {
     if (current != null && current.alive)
     {
         Vector3 pos = Input.mousePosition;
         createAt(pos);
         last    = null;
         current = null;
     }
 }
    public void SpawnChar(string charName, string spriteName, Vector3 location)
    {
        GameObject charInstance = Instantiate(Resources.Load <GameObject>("Art/Characters/" + charName), location, Quaternion.identity);

        CharList.Add(charInstance);
        if (CharList[CharList.Count - 1].GetComponent <CharScript>() != null)
        {
            CharList[CharList.Count - 1].GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Art/Characters/Expressions/" + spriteName);
            CharScript CharScriptInstance = CharList[CharList.Count - 1].GetComponent <CharScript>();
            CharScriptInstance.SetIndex(CharList.Count - 1);
        }
    }
Example #5
0
 public void addNewChoosenOne(GameObject n)
 {
     _choosenOne = n.GetComponent <CharScript>();
 }