Exemplo n.º 1
0
    public void SpawnPlayer(Vector3 pos)
    {
        playerVampire = new Vampire(2f, pos);

        //Based on hierarchy

        GameObject v_go = new GameObject();

        v_go.name = "Player";         //FIXME
        v_go.transform.position = playerVampire.Position;

        v_go.transform.SetParent(this.transform, true);

        SpriteRenderer v_go_sr = v_go.AddComponent <SpriteRenderer> ();

        v_go_sr.sprite           = Resources.LoadAll <Sprite>("Sprites/spriteSheet1")[20];//FIXME
        v_go_sr.sortingLayerName = "Creatures";

        v_go_sr.material = Resources.Load <Material> ("Materials/Lit2DMat");

        playerVampire.AssignMoveCallback((vampire) => { ChangeVampirePosition(vampire, v_go); });

        GetComponent <CameraControllerVampireMode> ().Begin(this.playerVampire);
    }
 //Must execute after VampireController
 public void Begin(Vampire target)
 {
     this.target = target;
     offset      = new Vector3(0.5f, 0.5f, -10f);
     target.AssignMoveCallback((vampire) => { MoveCameraToTarget(vampire); });
 }