Пример #1
0
    // Use this for initialization
    public void Start()
    {
        source         = GetComponent <AudioSource>();
        shellCount     = 0;
        rb             = GetComponent <Rigidbody2D>();
        shellList      = GameObject.FindGameObjectWithTag("ShellData").GetComponent <ShellList>();
        spriteRenderer = GetComponentInChildren <SpriteRenderer>();
        velocity       = new Vector3(0, 0, 0);
        timing         = timer;
        stacker        = GetComponent <ShellStack>();
        int shellType = -1;
        int worth     = startingShells;

        for (int i = 0; i < worth; i++)
        {
            int addType = (shellType == -1) ? (int)Random.Range(0, shellList.shellSprite.Length) : shellType;
            if (shellCount == 0)
            {
                spriteRenderer.sprite = shellList.playerShellSprite[addType];
                mySpriteId            = addType;
            }
            else
            {
                stacker.addShell(addType);
            }
            shellCount++;
        }
    }
Пример #2
0
 // Use this for initialization
 void Start()
 {
     player        = GameObject.FindGameObjectWithTag("Player");
     movement      = GameObject.FindGameObjectWithTag("Player").GetComponent <Player_Movement>();
     shellRemover  = GameObject.FindGameObjectWithTag("Player").GetComponent <ShellStack>();
     timing        = 0;
     forceConstant = 200;
 }