// Use this for initialization void Start () { GameControlObject = GameObject.Find("GameController"); gameController = (GameController)GameControlObject.GetComponent(typeof(GameController)); ObjectBall = GameObject.Find("ObjectBall"); ballController = (BallControll)ObjectBall.GetComponent(typeof(BallControll)); //BodySourceManager = GameObject.Find("BodyManager"); //RayColor = Color.white; // Create struct right arm //arm rightArm = new arm(); rightArm.frameCount = 0; rightArm.deactivated = false; //rightArm.Object = GameObject.Find("RightArm"); rightArm.runningPositionLocation = false; rightArm.handOnCooldown = false; rightArm.pointer= new Vector3(0,0,0); rightArm.Opointer = new Vector3(0, 0, 0); rightArm.listen2gestures = false; rightArm.rayColor = Color.red; // Create struct left arm //arm leftArm = new arm(); leftArm.frameCount = 0; leftArm.deactivated = false; //leftArm.Object = GameObject.Find("LeftArm"); leftArm.runningPositionLocation = false; leftArm.handOnCooldown = false; leftArm.listen2gestures = false; leftArm.pointer = new Vector3(0, 0, 0); leftArm.Opointer = new Vector3(0, 0, 0); leftArm.rayColor = Color.red; // Get camera Position Player = GameObject.Find("PlayerRef"); PlayerOriginalPosition = Player.transform.position; OriginalPositionRightHand = new Vector3(0, 0, 0); OriginalPositionLeftHand = new Vector3(0, 0, 0); //Camera.main.transform.position = PlayerOriginalPosition; //Camera.main.transform.position.x = Player.transform.position.x; if (gameController.leftie) { leftie = true; leftArm.mainArm = true; rightArm.mainArm = false; } else { leftie=false; rightArm.mainArm = true; leftArm.mainArm = false; } }
// Use this for initialization void Start() { MoveSpeed = 2f; ObjectBall = GameObject.Find("ObjectBall"); ballController = (BallControll)ObjectBall.GetComponent(typeof(BallControll)); GameControlObject = GameObject.Find("GameController"); gameController = (GameController)GameControlObject.GetComponent(typeof(GameController)); // Get the position of the respawning ball }
// Use this for initialization void Start () { audioS = gameObject.AddComponent<AudioSource>(); gameObject = GameObject.Find("GameController"); gameController = (GameController)gameObject.GetComponent(typeof(GameController)); ballObject = GameObject.Find("ObjectBall"); ballController = (BallControll)ballObject.GetComponent(typeof(BallControll)); audioS = gameObject.AddComponent<AudioSource>(); Resume(); GameMenuResult.SetActive(false); GameGoalScored.SetActive(false); lvl_timer = 120; lvlname = "Demo"; CountText.text = (lvl_timer).ToString(); CurrentTime = 0; //NameText = GameObject.Find("LvlName").GetComponent<Text>(); CountText = GameObject.Find("CountText").GetComponent<Text>(); //NameText.text = lvlname; CountText.text = lvl_timer.ToString(); }
private void SpawnBall() { player = Instantiate(ballPrefab, tSpot) as GameObject; ballControl = player.GetComponent <BallControll>(); }
// Start is called before the first frame update void Start() { strokeManager = GameObject.FindObjectOfType <BallControll>(); }
// Use this for initialization void Start () { // Init Scores score_player1 = 0; score_player2 = 0; body = "undef"; ObjectBall = GameObject.Find("ObjectBall"); ballController = (BallControll)ObjectBall.GetComponent(typeof(BallControll)); PreferencesObject = GameObject.Find("Preferences"); preferencesController = (Preferences)PreferencesObject.GetComponent(typeof(Preferences)); ObjectAI = GameObject.Find("Rival"); AIController = (AI)ObjectAI.GetComponent(typeof(AI)); RivalsOriginalPosition = ObjectAI.transform.position; /* Depending on the difficulty or the game mode, we set a different set of parameters */ //Get difficulty //difficulty = 1; difficulty = preferencesController.difficulty; leftie = preferencesController.leftie; switch (difficulty) { /* GAME MODE 1: Normal speed, rival does not reallocate after hitting */ case 0: print("Selected Easy Difficulty"); BallSpeed=5f; RivalReactDistance= 20f; RivalSpeed = 2f; RivalReposition = true; break; /* GAME MODE 1: Normal speed, rival does not reallocate after hitting */ case 1: print("Selected normal Difficulty"); BallSpeed = 10f; RivalReactDistance = 20f; RivalSpeed = 2f; RivalReposition = true; break; case 2: print("Selected Hard Difficulty"); BallSpeed = 10f; RivalReactDistance = 10f; RivalSpeed = 1f; RivalReposition = false; break; default: print("Default Game Mode"); BallSpeed = 10f; RivalReactDistance = 10f; RivalSpeed = 1f; RivalReposition = true; break; } }