// Start is called before the first frame update void Start() { GameObject tankObj = new GameObject("myTank"); CtrlTank ctrlTank = tankObj.AddComponent <CtrlTank>(); ctrlTank.Init("tankPrefab"); tankObj.AddComponent <CameraFollow>(); GameObject tankObj2 = new GameObject("myTank"); BaseTank baskTank = tankObj2.AddComponent <BaseTank>(); baskTank.Init("tankPrefab"); baskTank.transform.position = new Vector3(0, 10, 30); }
// Use this for initialization void Start() { //坦克 GameObject tankObj = new GameObject("myTank"); CtrlTank ctrlTank = tankObj.AddComponent <CtrlTank>(); ctrlTank.Init("Tank"); //相机 tankObj.AddComponent <CameraFollow>(); //被打的坦克 GameObject tankObj2 = new GameObject("enemyTank"); BaseTank baseTank = tankObj2.AddComponent <BaseTank>(); baseTank.Init("Tank"); baseTank.transform.position = new Vector3(5, 0, 0); }