Exemplo n.º 1
0
    // Start is called before the first frame update
    void Start()
    {
        npcDropdown = GetComponent <Dropdown>();

        fp = Camera.main.GetComponent <followPlayer>();

        NPCs = GameObject.FindGameObjectsWithTag("NPC");

        npcName = new List <string>();

        foreach (GameObject gb in NPCs)
        {
            npcName.Add(gb.name);
        }

        npcDropdown.ClearOptions();

        npcDropdown.AddOptions(npcName);

        fp.target = GameObject.Find(npcName[0]).transform;

        npcDropdown.onValueChanged.AddListener(delegate {
            DropdownValueChanged(npcDropdown);
        });
    }
Exemplo n.º 2
0
    //Main Functions
    void Start()
    {
        //gameStarted = false;
        maxHeight = 0;
        //get height
        camFollow = camCenterHeight.GetComponent <followPlayer>();

        //set audio source
        //audio = GetComponent<AudioSource> ();

        //ground object
        GameObject ground = GameObject.Find("Ground");

        floorWidth = ground.transform.localScale.x * 10f;

        //player object
        playerDim = gameObject.transform.localScale;

        //camera object
        turnCamScript = camera.GetComponent <turnCamera>();       //to track height

        //start player location
        gameObject.transform.position = new Vector3(0.0F, gameObject.transform.localScale.y / 2f, 0.0F);        //start position
        endPos = gameObject.transform.position;
    }
Exemplo n.º 3
0
    void Die()
    {
        followPlayer follow = GetComponentInParent <followPlayer>();

        if (follow != null)
        {
            fallingBones.Play();
            follow.Stop();
            leftArm.SetBool("stopped", true);
            rightArm.SetBool("stopped", true);
            leftLeg.SetBool("stopped", true);
            rightLeg.SetBool("stopped", true);
            body.SetBool("stopped", true);
            head.SetBool("stopped", true);
            Destroy(gameObject, 2f);
        }
        else
        {
            Ghost ghost = GetComponentInParent <Ghost>();
            ghost.Stop();
            GhostBod.SetBool("dead", true);
            GhostLeftArm.SetBool("dead", true);
            GhostRightArm.SetBool("dead", true);

            Destroy(gameObject, 0.75f);
        }
    }
    public override void OnInspectorGUI()
    {
        followPlayer followPlayerScript = (followPlayer)target;

        followPlayerScript.offset = EditorGUILayout.Vector3Field("offset", followPlayerScript.offset);
        EditorGUILayout.LabelField("Following Player", followPlayerScript.isFollowing.ToString());
        DrawDefaultInspector();
    }
 public saveInformation(followPlayer camera, playerController controller, playerInventory inventory, interactionController interaction) //handing it the two scripts that will contain information
 {
     male     = camera.isMale;
     position = new float[] { controller.gameObject.transform.position.x, controller.gameObject.transform.position.y, controller.gameObject.transform.position.z };
     seeds    = inventory.seedArray;
     produce  = inventory.produceArray;
     money    = inventory.money;
     town     = interaction.inTown;
 }
Exemplo n.º 6
0
    public override void OnStartLocalPlayer()
    {
        GetComponent <VisualPlayer>().isLocal             = true;
        GetComponent <MyPlayerController>().isLocalPlayer = true;

        followPlayer cam = Camera.main.GetComponent <followPlayer>();

        cam._player        = transform;
        transform.position = cam._mainMap._startPos.position;
    }
    public static void savePlayer(followPlayer camera, playerController controller, playerInventory inventory, interactionController interaction)
    {
        BinaryFormatter formatter   = new BinaryFormatter();
        string          path        = Application.persistentDataPath + "/player.info";                 //creating path and filename, extension doesn't matter, persistent path is universal across OS
        FileStream      stream      = new FileStream(path, FileMode.Create);                           //creates file at path given
        saveInformation information = new saveInformation(camera, controller, inventory, interaction); //creating the save information

        formatter.Serialize(stream, information);                                                      //turning information into binary
        stream.Close();
    }
Exemplo n.º 8
0
 // Use this for initialization
 void Start()
 {
     camFollow = camCenterHeight.GetComponent <followPlayer>();
     resetGame();
 }
Exemplo n.º 9
0
 // Use this for initialization
 void Start()
 {
     player       = GameObject.FindGameObjectWithTag("MainCamera");
     cameraScript = player.GetComponent <followPlayer>();
     flag         = false;
 }