예제 #1
0
    void Start()
    {
        if (EnemyDataManager.control.getChosenEnemies().Count <= enemyIndex)
        {
            gameObject.SetActive(false);
        }
        else
        {
            if (enemyData == null)
            {
                enemyData   = EnemyDataManager.control.getChosenEnemies() [enemyIndex];
                enemyType   = enemyData.code;
                useSparkles = enemyData.useSparkles;
                //animator.runtimeAnimatorController = enemyData.animator.runtimeAnimatorController;
                spriteSwap.sprites = enemyData.spritesToSwap;
                //gameObject.SetActive (false);

                deathAudio = enemyData.deathAudio;

                enemyData.PrepareSecondaryAction();

                if (backgroundObject == null)
                {
                    backgroundObject = (GameObject)Instantiate(enemyData.background, Vector3.zero, Quaternion.identity);
                }
            }
        }
        if (jointRbody2d == null)
        {
            jointRbody2d = GameObject.FindGameObjectWithTag(Tags.jointObject).GetComponent <Rigidbody2D> ();
        }
        joint.connectedBody   = jointRbody2d;
        joint.connectedAnchor = Vector2.zero;


        spriteSwap.SwapToSprite(0);
    }
예제 #2
0
 public void PlaySound(AudioNames name)
 {
     string filename = GetFileName(name);
     string clipname = "kidsounds/" + filename;
     audio.clip = Resources.Load<AudioClip>(clipname);
     audio.Play();
 }
예제 #3
0
 public static string GetFileName(AudioNames audioname)
 {
     int num = (int) audioname + 1;
     if (num >= 6) num++;
     return string.Format("{0:00}-", num) + audioname.ToString();
 }