Beispiel #1
0
    public void SetPosRespawn(BallControlScript ball)
    {
        if (type == TypeRespawn.Auto)
        {
            //Vector3 posRespawn;
            //Vector3 DirectRespawn = (ball.transform.position - new Vector3(Target.x, ball.transform.position.y, Target.z)).normalized;
            //posRespawn = ball.SetPosRespawn(ball.transform.position, Target ,Axit);
            //posRespawn = new Vector3(posRespawn.x, ball.transform.position.y, posRespawn.z);
            //GamePlayCtrl.Ins.GetCurrLevel().PosContinue = posRespawn;

            Vector3         direct = (ball.transform.position - Target).normalized;
            float           angle  = 1000;
            ArrayPointSpawn Arr    = null;
            for (int i = 0; i < ArrayRespawn.Length; i++)
            {
                var a = Vector3.Angle(ArrayRespawn[i].Axit, direct);
                if (a < angle)
                {
                    angle = a;
                    Arr   = ArrayRespawn[i];
                }
            }

            GamePlayCtrl.Ins.GetCurrLevel().PosContinue = new Vector3(Arr.posRespawn.x, ball.transform.position.y, Arr.posRespawn.z);
        }
        else
        {
            Vector3 posRespawn = new Vector3(PosRespawn.x, ball.transform.position.y, PosRespawn.z);
            GamePlayCtrl.Ins.GetCurrLevel().PosContinue = posRespawn;
        }
    }
Beispiel #2
0
 public override void ActiveItemTriger(BallControlScript ball)
 {
     if (Send)
     {
         return;
     }
     SendToPort(TargetPort, ball);
 }
Beispiel #3
0
 public override void TriggerTrap(BallControlScript ball)
 {
     GameManager.Ins.OpenSingleWindown(TypeWindown.PopUpWin);
     ball.Die = true;
     ball.body.isKinematic = true;
     ball.body.velocity    = Vector3.zero;
     ball.AnimFallHoll.SetBool("Die", true);
     AudioCtrl.Ins.Play("Complete");
 }
Beispiel #4
0
    public override void TrapActive(BallControlScript ball)
    {
        Vector3 postion = ball.transform.position;

        ball.transform.position = Vector3.MoveTowards(new Vector3(ball.transform.position.x, ball.transform.position.y, ball.transform.position.z),
                                                      new Vector3(Target.x, ball.transform.position.y, Target.z), Time.deltaTime);
        if (Vector3.Distance(ball.transform.position, new Vector3(Target.x, ball.transform.position.y, Target.z)) == 0)
        {
        }
    }
Beispiel #5
0
 public void SetPosRespawn(BallControlScript ball)
 {
     if (ball.isAutoRespawn)
     {
         GamePlayCtrl.Ins.GetCurrLevel().PosContinue = ball.posRespawn;
     }
     else
     {
         PosRespawn = new Vector3(PosRespawn.x, ball.transform.position.y, PosRespawn.z);
         GamePlayCtrl.Ins.GetCurrLevel().PosContinue = PosRespawn;
     }
 }
Beispiel #6
0
 public override void ActiveItemTriger(BallControlScript ball)
 {
     if (ActiveKey)
     {
         return;
     }
     AudioCtrl.Ins.Play("Key");
     AnimItem.SetBool("Active", true);
     Debug.Log("ActiveKey");
     Lock.CountUnClockKey += 1;
     ActiveKey             = true;
 }
Beispiel #7
0
    private List <SpriteRenderer> hoopSpriteList; //the hoop's sprite glow

    void Start()
    {
        //get the ball controller
        ballController = FindObjectOfType <BallControlScript> ();

        //get all the sprites in the hoop
        hoopSpriteList = new List <SpriteRenderer>();
        hoopSpriteList.AddRange(gameObject.transform.parent.GetComponentsInChildren <SpriteRenderer> ());

        //turn them off by default
        SpriteOff();
    }
Beispiel #8
0
 public void SendToPort(Teleport Port, BallControlScript ball)
 {
     if (typeTepleport == TypeTeleport.Single)
     {
         Port.Send = true;
         ball.transform.position = new Vector3(Port.transform.position.x, ball.transform.position.y, Port.transform.position.z);
     }
     else
     {
         Port.Send               = true;
         Port.TargetPort         = this;
         ball.transform.position = new Vector3(Port.transform.position.x, ball.transform.position.y, Port.transform.position.z);
     }
 }
Beispiel #9
0
 public override void TriggerTrap(BallControlScript ball)
 {
     if (ball.isAutoRespawn)
     {
         Vector3 posRespawn = new Vector3(ball.posRespawn.x, ball.transform.position.y, ball.posRespawn.z);
         GamePlayCtrl.Ins.GetCurrLevel().PosContinue = posRespawn;
     }
     else
     {
         SetPosRespawn(ball);
     }
     ball.body.isKinematic = true;
     ball.body.velocity    = Vector3.zero;
     ball.AnimFallHoll.SetBool("Die", true);
 }
    //Game rules of croquet: Take it in turn to make a shot with either ball.
    //Getting a hoop gives you a bonus shot (Continuation)
    //Hitting another ball gives you one shot where you move the ball to
    //the ball you hit, (Roquet) then a bonus shot (Continuation)
    //Get both balls through the hoops in the right direction and then
    //hit the peg to win.

    ////////////////////////////////////////////////////////// AWAKE
    /// This is run when the game starts, and should be the first thing run in the entire scene
    void Awake()
    {
        //set up all the defaults
        currentState    = GameState.Start;
        ballBeenHit     = false;
        ballThroughHoop = false;
        currentTeam     = Team.Blue;

        ballController = gameObject.GetComponent <BallControlScript> ();

        //Get a list of hoops, and sort them in alphabetical order
        hoopScriptList = new List <HoopScript>();
        hoopScriptList.AddRange(GetComponentsInChildren <HoopScript> ());
        hoopScriptList.Sort(((x, y) => x.gameObject.transform.parent.name.CompareTo(
                                 y.gameObject.transform.parent.name)));
    }
Beispiel #11
0
    public void SetUp()
    {
        Items = transform.GetComponentsInChildren <Item>();
        Ball  = transform.GetComponentInChildren <BallControlScript>();
        Debug.Log(transform.name);
        PosInit = Ball.transform.position;
        var traps = transform.GetComponentsInChildren <FallHool>();

        foreach (var hool in traps)
        {
            hool.SetTarget();
        }
        var Ground = transform.GetComponentsInChildren <GroundHool>();

        foreach (var hool in Ground)
        {
            hool.SetTarget();
        }
    }
Beispiel #12
0
    public override void TriggerTrap(BallControlScript ball)
    {
        if (!ball.isAutoRespawn)
        {
            ball.body.isKinematic = true;
            ball.body.velocity    = Vector3.zero;
            Vector3 posRespawn = new Vector3(PosContinue.x, ball.transform.position.y, PosContinue.z);
            GamePlayCtrl.Ins.GetCurrLevel().PosContinue = posRespawn;
        }
        else
        {
            GamePlayCtrl.Ins.GetCurrLevel().PosContinue = ball.posRespawn;
        }
        ball.Die = true;
        Vector3 pos = ball.transform.localPosition;

        pos.y = 0.15f;
        ball.transform.localPosition = pos;
        ball.AnimFallHoll.SetBool("Die", true);
    }
Beispiel #13
0
 public void ActiveEffTrap(BallControlScript ball)
 {
     AddTrap(ball);
 }
Beispiel #14
0
 // Start is called before the first frame update
 void OnTriggerEnter2D(Collider2D col)
 {
     BallControlScript.OpenLocker();
 }
Beispiel #15
0
 public virtual void TriggerTrap(BallControlScript ball)
 {
 }
Beispiel #16
0
 public virtual void AddTrap(BallControlScript ball)
 {
     ball.AddOnActionDie(TriggerTrap, TrapActive, EndTrap, timeEnd);
 }
Beispiel #17
0
 public virtual void ActiveItemTriger(BallControlScript ball)
 {
 }
Beispiel #18
0
 public virtual void TrapActive(BallControlScript ball)
 {
 }
Beispiel #19
0
 // If ball touches Death holes collider
 // then isDead variable of BallControlScript is set to true
 void OnTriggerEnter2D(Collider2D col)
 {
     BallControlScript.setIsDeadTrue();
 }
Beispiel #20
0
 // Start is called before the first frame update
 public virtual void Kill_Ball(BallControlScript ball)
 {
 }
Beispiel #21
0
 public override void TriggerTrap(BallControlScript ball)
 {
     //GameManager.Ins.OpenWindown(TypeWindown.OverGame);
     //GameManager.Ins.isGameOver = true;
     //SetPosRespawn(ball);
 }
Beispiel #22
0
 // If ball touches Exit holes collider
 // then youWin variable of BallControlScript is set to true
 void OnTriggerEnter2D(Collider2D col)
 {
     BallControlScript.setYouWinToTrue();
 }
Beispiel #23
0
 ////////////////////////////////////////////////////////// START
 /// Setup the needed scripts
 void Start()
 {
     ballController = FindObjectOfType <BallControlScript> ();
     gameRules      = FindObjectOfType <GameRulesScript> ();
 }
    BallControlScript controlScript; //the controlscript giving the line instructions

    // Use this for initialization
    void Start()
    {
        line          = GetComponent <LineRenderer> ();
        controlScript = GetComponent <BallControlScript> ();
    }
Beispiel #25
0
 public override void Kill_Ball(BallControlScript ball)
 {
     CompleteGame();
 }
Beispiel #26
0
 void OnTriggerEnter2D()
 {
     BallControlScript.PickUpKey();
     Destroy(this.gameObject);
 }
Beispiel #27
0
 public override void TrapActive(BallControlScript ball)
 {
 }