// Use this for initialization
 void Start()
 {
     BgElements = new GameObject[3] {
         ShowPaddle, ShowBall, Net
     };
     BallTr             = Ball.GetComponent <Transform>();
     ShowBallRb         = ShowBall.GetComponent <Rigidbody>();
     ShowBallStartPos   = ShowBall.GetComponent <Transform>().position;
     fRacketRb          = RacketOne.GetComponent <Rigidbody>();
     sRacketRb          = RacketTwo.GetComponent <Rigidbody>();
     fRacket            = RacketOne.GetComponent <Transform>();
     sRacket            = RacketTwo.GetComponent <Transform>();
     GreenTableMaterial = Resources.Load("Materials/Table1", typeof(Material)) as Material;
     BlueTableMaterial  = Resources.Load("Materials/Table2", typeof(Material)) as Material;
     PrepareBackground();
     ComputerRacketSpeed = 0.16f;
 }
 public void PrepareBackground()
 {
     Ball.SetActive(false);
     Wall.SetActive(false);
     RacketOne.SetActive(false);
     RacketTwo.SetActive(false);
     Player1Trigger.SetActive(false);
     Player2Trigger.SetActive(false);
     for (int i = 0; i < BgElements.Length; i++)
     {
         BgElements[i].SetActive(true);
     }
     ShowBallRb.velocity = new Vector3(0, 0, 0);
     ShowBall.GetComponent <Transform>().position = ShowBallStartPos;
     ShowBallRb.AddForce(transform.right * 120);
     ShowBallRb.AddForce(transform.up * 40);
 }
Exemple #3
0
        public void Save(XElement e)
        {
            XElement elemGameSetting = new XElement("GameSetting");

            e.Add(elemGameSetting);

            XElement   elem  = new XElement("OurTeamOffensive");
            XAttribute attri = new XAttribute("Value", OurTeamOffensive.ToString());

            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("Scaling");
            attri = new XAttribute("Value", Scaling.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            // 11-09-2010 Scott
            elem  = new XElement("ScalingAnimation");
            attri = new XAttribute("Value", ScalingAnimation.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            // 10-08-2010 Scott
            elem  = new XElement("OffensiveMainField");
            attri = new XAttribute("Value", OffensiveMainField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("OffensiveSubField");
            attri = new XAttribute("Value", OffensiveSubField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("DefensiveMainField");
            attri = new XAttribute("Value", DefensiveMainField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("DefensiveSubField");
            attri = new XAttribute("Value", DefensiveSubField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            // 10-26-2011 Scott
            elem  = new XElement("KickMainField");
            attri = new XAttribute("Value", KickMainField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("KickSubField");
            attri = new XAttribute("Value", KickSubField.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);
            // end

            elem  = new XElement("UserFolder");
            attri = new XAttribute("Value", UserFolder);
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("UserType");
            attri = new XAttribute("Value", UserType.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ProductType");
            attri = new XAttribute("Value", ProductType.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlaygroundType");
            attri = new XAttribute("Value", PlaygroundType.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("CurrentTheme");
            attri = new XAttribute("Value", CurrentTheme);
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("GridLine");
            attri = new XAttribute("Value", GridLine.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("SnapValue");
            attri = new XAttribute("Value", SnapValue.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("SnapToGrid");
            attri = new XAttribute("Value", SnapToGrid.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ShowBall");
            attri = new XAttribute("Value", ShowBall.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("BallSize");
            attri = new XAttribute("Value", BallSize.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("Landscape");
            attri = new XAttribute("Value", Landscape.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ShowPlayground");
            attri = new XAttribute("Value", ShowPlayground.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("EnableColor");
            attri = new XAttribute("Value", EnableColor.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("EnableSymbolColor");
            attri = new XAttribute("Value", EnableSymbolColor.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("EnableTitle");
            attri = new XAttribute("Value", EnableTitle.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerAngle");
            attri = new XAttribute("Value", PlayerAngle.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerAppearance");
            attri = new XAttribute("Value", PlayerAppearance.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerDash");
            attri = new XAttribute("Value", PlayerDash.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerSzie");
            attri = new XAttribute("Value", PlayerSize.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerTextVisibility");
            attri = new XAttribute("Value", PlayerTextVisibility.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("PlayerThickness");
            attri = new XAttribute("Value", PlayerThickness.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ImageShowPlayground");
            attri = new XAttribute("Value", ImageShowPlayground.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ImageEnableColor");
            attri = new XAttribute("Value", ImageEnableColor.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);

            elem  = new XElement("ImageEnableSymbolColor");
            attri = new XAttribute("Value", ImageEnableSymbolColor.ToString());
            elem.Add(attri);
            elemGameSetting.Add(elem);
        }