Skip to content
Snippets Groups Projects
PlayerParentScript.cs 741 B
Newer Older
  • Learn to ignore specific revisions
  • clg544's avatar
    clg544 committed
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    
    public class PlayerParentScript : MonoBehaviour {
    
        [SerializeField]
        GameObject PlayerOne;
        [SerializeField]
        GameObject PlayerTwo;
    
        Transform myTansform;
        Transform playerOneTransform;
        Transform playerTwoTransform;
    
        // Use this for initialization
    
    clg544's avatar
    clg544 committed
        void Start () {
            playerOneTransform = PlayerOne.GetComponent<Transform>();
    
            playerTwoTransform = PlayerTwo.GetComponent<Transform>();
    
    clg544's avatar
    clg544 committed
        }
    	
    	// Update is called once per frame
    
    clg544's avatar
    clg544 committed
            /* Move to Players centre */
            this.transform.position = (playerOneTransform.position + playerTwoTransform.position) / 2;
    	}
    }