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; } }
public override void ActiveItemTriger(BallControlScript ball) { if (Send) { return; } SendToPort(TargetPort, ball); }
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"); }
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) { } }
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; } }
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; }
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(); }
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); } }
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))); }
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(); } }
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); }
public void ActiveEffTrap(BallControlScript ball) { AddTrap(ball); }
// Start is called before the first frame update void OnTriggerEnter2D(Collider2D col) { BallControlScript.OpenLocker(); }
public virtual void TriggerTrap(BallControlScript ball) { }
public virtual void AddTrap(BallControlScript ball) { ball.AddOnActionDie(TriggerTrap, TrapActive, EndTrap, timeEnd); }
public virtual void ActiveItemTriger(BallControlScript ball) { }
public virtual void TrapActive(BallControlScript ball) { }
// If ball touches Death holes collider // then isDead variable of BallControlScript is set to true void OnTriggerEnter2D(Collider2D col) { BallControlScript.setIsDeadTrue(); }
// Start is called before the first frame update public virtual void Kill_Ball(BallControlScript ball) { }
public override void TriggerTrap(BallControlScript ball) { //GameManager.Ins.OpenWindown(TypeWindown.OverGame); //GameManager.Ins.isGameOver = true; //SetPosRespawn(ball); }
// If ball touches Exit holes collider // then youWin variable of BallControlScript is set to true void OnTriggerEnter2D(Collider2D col) { BallControlScript.setYouWinToTrue(); }
////////////////////////////////////////////////////////// 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> (); }
public override void Kill_Ball(BallControlScript ball) { CompleteGame(); }
void OnTriggerEnter2D() { BallControlScript.PickUpKey(); Destroy(this.gameObject); }
public override void TrapActive(BallControlScript ball) { }