public void InitPath(iTweenPath path) { m_Path = path; m_PathNodes = m_Path.nodes.ToArray(); m_PathLength = iTween.PathLength(m_PathNodes); m_Distance = 0; }
public void Awake() { Path = GetComponent<iTweenPath>(); _fsm = Camera.main.GetComponent<PlayMakerFSM>(); _main = GameObject.Find("Main").GetComponent<Main>(); _grids = GameObject.Find("Grids").GetComponent<GridManager>(); }
// Use this for initialization void Start() { #if UNITY_EDITOR if (attachedObject == null) { throw new MissingReferenceException("Game object '" + this.name + "' is missing variable 'attachedObject'."); } #endif _gameObject = ObjectPoolingManager.Instance.GetObject(attachedObject.name); if (movingPlatformType == MovingPlatformType.StartsWhenPlayerLands) { IAttachableObject attachableObject = _gameObject.GetComponent <IAttachableObject>(); if (attachableObject != null) { attachableObject.Attached += attachableObject_Attached; } else { GameManager.instance.player.OnGroundedPlatformChanged += player_OnGroundedPlatformChanged; } } _iTweenPath = GetComponent <iTweenPath>(); _gameObject.transform.position = _iTweenPath.GetFirstNodeInWorldSpace(); _gameObject.SetActive(true); if (movingPlatformType == MovingPlatformType.MovesAlways) { StartMove(); } }
/// <param name="obj :运动的对象" ></param> /// <param name="path :对象运动的路径"></param> /// <param name="iTime:对象运动的时间"></param> /// /// <param name="delay_Time:对象运动前等待的时间"></param> void Obj_itween(GameObject obj, iTweenPath path, float iTime, float delay_Time) { EnemyNum--; obj.transform.position = (Vector3)iTweenPath.GetPath(path.pathName).GetValue(0); iTween.MoveTo(obj, iTween.Hash("path", iTweenPath.GetPath(path.pathName), "time", iTime, "delay", delay_Time, "orienttopath", true, "looktime", 1f, "easetype", iTween.EaseType.easeInOutCubic, "looptype", iTween.LoopType.none, "oncomplete", "StopMove", "oncompletetarget", gameObject)); }
void Obj_itween(GameObject obj, iTweenPath path, float iTime) { obj.transform.position = (Vector3)iTweenPath.GetPath(path.pathName).GetValue(0); iTween.MoveTo(obj, iTween.Hash("path", iTweenPath.GetPath(path.pathName), "time", iTime, "orienttopath", true, "looktime", 1f, "easetype", iTween.EaseType.easeInOutCubic, "looptype", iTween.LoopType.none)); }
// Update is called once per frame void Update () { Camera.main.transform.Translate(Input.GetAxis("CamGuy X") * speed * Time.deltaTime, Input.GetAxis("CamGuy Y") * speed * Time.deltaTime * -1, 0); //Debug.Log(Input.GetAxis("Fire1")); //right trigger pressed if (Input.GetAxis("CamGuy Projectile") == -1 && !shotFired) { iTweenPath pathe = arc.GetComponent<iTweenPath>(); pathe.nodes.Clear(); pathe.nodes.Add(new Vector3(crosshair.transform.position.x, crosshair.transform.position.y, 0f)); pathe.nodes.Add(new Vector3(crosshair.transform.position.x, -10f, projectileDistance)); GameObject p1 = Instantiate(projectile); p1.transform.parent = Camera.main.transform; shotFired = true; } //compensate for dead zone //if(Math.Abs(Input.GetAxis("Fire1")) < 0.015) //{ // shotFired = false; //} }
// Stupid way of doing things! private void findPaths() { var paths = gameObject.GetComponentsInChildren <iTweenPath>(); foreach (var item in paths) { var txt = item.pathName.ToLower(); if (txt.EndsWith("camera")) { cameraPosition = item; } if (txt.EndsWith("target")) { cameraTarget = item; } } if (cameraPosition == null) { Debug.LogError("no cameraPosition"); } if (cameraTarget == null) { Debug.LogError("no cameraTarget"); } }
private void StartClosestPath() { iTweenPath closestPath = null; float closestDistance = Mathf.Infinity; foreach (iTweenPath path in actorPaths) { if (path.nodeCount > 0) { Vector3 start = path.nodes[0]; Vector3 diff = start - actor.position; float distance = diff.sqrMagnitude; if (distance < closestDistance) { //found closer path closestPath = path; closestDistance = distance; } } } if (closestPath != null) { //found closest path actorTween.Values["path"] = closestPath.pathName; actorTween.Play(); } }
// Use this for initialization void Awake() { //_stats.ResetStats(); path = GetComponent<iTweenPath>(); }
// Use this for initialization void Start() { fire_time = 0; enemyPath = this.gameObject.GetComponent<iTweenPath>(); isenemyFire = false; isManFire = false; Inst_tank(); }
// Use this for initialization void Start() { fire_time = 0; enemyPath = this.gameObject.GetComponent <iTweenPath>(); isenemyFire = false; isManFire = false; Inst_tank(); }
public void Start() { _iTweenPath = PathController.GetComponent <iTweenPath>(); _pathControllerComponent = PathController.GetComponent <PathControllerComponent>(); waypoints = _iTweenPath.nodes.ToArray(); transform.position = waypoints[0]; }
private void Start() { path = gameObject.GetComponent<iTweenPath>(); allCarsObj = Resources.LoadAll<CarMove>("Cars"); if (destroyOnCompleteWaypoint == true) { Invoke("CarGenerate", 1f); } }
public void Set() { iTweenPath path = GetComponent <iTweenPath>(); path.nodes.Clear(); foreach (Transform node in paths) { path.nodes.Add(node.position); } }
void GetNodes() { pathNodes = new List <Vector3>(); if (!path) { path = GetComponent <iTweenPath>(); } for (int i = 0; i < path.nodeCount; i++) { pathNodes.Add(path.nodes[i]); } }
void Start() { if (this.gameObject.GetComponent <iTweenPath>().enabled) { iTweenPath itween = this.gameObject.GetComponent <iTweenPath>(); iTween.MoveTo(this.gameObject, iTween.Hash("path", iTweenPath.GetPath(itween.pathName), "time", movetime, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.loop)); } }
void OnEnable(){ //i like bold handle labels since I'm getting old: style.fontStyle = FontStyle.Bold; style.normal.textColor = Color.white; _target = (iTweenPath)target; //lock in a default path name: if(!_target.initialized){ _target.initialized = true; _target.pathName = "New Path " + ++count; _target.initialName = _target.pathName; } }
public override void Awake() { base.Awake(); path = GetComponent <iTweenPath> (); umbaParent = new GameObject("UmbaParent").transform; umbaParent.SetParent(this.transform); OnObjectStartElectrified += TestStart; OnObjectUpdateElectrified += TestUpdate; OnObjectStopElectrified += TestStop; CreateUmba(); }
void Start() { lastLocation = transform.position; if (pathName.Equals("")) { iTweenPath ipath = (iTweenPath)gameObject.GetComponent(typeof(iTweenPath)); path = ipath.nodes.ToArray(); } else { path = iTweenPath.GetPath(pathName); } }
void Obj_itween(GameObject obj, iTweenPath path, float iTime, float delay_Time) { ImageTouch.SetActive(false); fireGun.isFireGun = false; uifire.SetActive(false); // yield return new WaitForSeconds(delay_Time); transform.GetComponent <Camera>().enabled = true; Camera.main.GetComponent <Camera>().enabled = false; obj.transform.position = (Vector3)iTweenPath.GetPath(path.pathName).GetValue(0); iTween.MoveTo(obj, iTween.Hash("path", iTweenPath.GetPath(path.pathName), "time", iTime, "delay", delay_Time, "orienttopath", true, "looktime", 1f, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.none, "oncomplete", "StopMove", "oncompletetarget", gameObject)); GameObject.Find("First96A/ZTZ96A_FirstCam/Tank_paotai").transform.localEulerAngles = new Vector3(0, 0, 0); }
private void Start() { theRB = GetComponent <Rigidbody2D>(); paths = GetComponents <iTweenPath>(); for (int i = 0; i < paths.Length; i++) { if (paths[i].pathName == "Path1") { firstPath = paths[i]; } } }
void OnEnable() { style.fontStyle = FontStyle.Bold; style.normal.textColor = Color.white; _target = (iTweenPath)target; // lock in a default path name: if (!_target.initialized) { _target.initialized = true; _target.pathName = "New Path " + ++count; _target.initialName = _target.pathName; } }
// Use this for initialization void init() { isActive = false; outofplay = false; waveNum = -1; //gets available paths GameObject go = (GameObject)GameObject.FindGameObjectWithTag("WaveGen"); WE = (WaveEmitter)go.GetComponent ("WaveEmitter"); //pths = (RPathGen)go.GetComponent("RPathGen"); PM = (PathManager)go.GetComponent ("PathManager"); PM.init (); go = (GameObject)GameObject.FindGameObjectWithTag ("MainCamera"); cam1 = (Camera)go.GetComponent ("Camera"); //add iTween component and get ref gameObject.AddComponent("iTweenPath"); path = (iTweenPath)gameObject.GetComponent("iTweenPath"); }
public void MoveBack() { if (_currentPath == null) return; iTween.MoveTo(Camera.main.gameObject, iTween.Hash( "path", iTweenPath.GetPathReversed(_currentPath.pathName), "time", Time, "orientToPath", false, "delay", .4, "easeType", "easeInOutSine", "onComplete", "MoveComplete", "onCompleteTarget", gameObject, "lookTime", 0.1f, "lookahead", 0.1f)); _currentGrid.Box.enabled = true; _currentPath = null; }
bool SetPathPosition_from_ITweenPath(string PathName) { if (cp_ITweenPath == null) { cp_ITweenPath = GetComponent <iTweenPath>(); // このObject内の ITween path スクリプトコンポーネントのインスタンスを取得 if (cp_ITweenPath == null) { Debug.Log("[NO SCRIPT] No there script 'ITween Path' on this object"); return(false); } } // GetPath()はStatic宣言されているので直呼び出し NodeData = iTweenPath.GetPath(PathName); // Visual Path Editor のパス名を指定してパスデータを取得する。 if (NodeData == null) { Debug.Log("[NOT FOUND/null] path name '" + PathName + "'"); return(false); } return(true); }
void Start() { path = this.gameObject.GetComponent("iTweenPath") as iTweenPath; position = iTweenPath.GetPath("MainPath"); nodes[0] = position[0]; int atual = 0; for( int i = 0; i < amount; i++ ){ if( Vector3.Distance(nodes[atual],iTween.PointOnPath(position,(float)i/amount)) > distance ){ nodes.Add( iTween.PointOnPath(position,(float)i/amount) ); atual++; } } nodes.Add(position[position.Length-1]); path.nodes = nodes; //path.nodes.Clear(); path.nodeCount = nodes.Count; //path.nodes.AddRange(nodes.ToArray()); //this.enabled = false; }
private void DriftLeftAndRight(bool isFriendlySide) { Card card = !isFriendlySide ? this.enemyActualUI.held.card : this.friendlyActualUI.held.card; if (this.CanAnimateHeldCard(card)) { Vector3[] vectorArray; if (isFriendlySide) { iTweenPath path; if (!iTweenPath.paths.TryGetValue(iTweenPath.FixupPathName("driftPath1_friendly"), out path)) { Transform transform = Board.Get().FindBone("OpponentCardPlayingSpot"); Transform transform2 = Board.Get().FindBone("FriendlyCardPlayingSpot"); Vector3 vector = transform2.position - transform.position; iTweenPath path2 = iTweenPath.paths[iTweenPath.FixupPathName("driftPath1")]; path = transform2.gameObject.AddComponent <iTweenPath>(); path.pathVisible = true; path.pathName = "driftPath1_friendly"; path.pathColor = path2.pathColor; path.nodes = new List <Vector3>(path2.nodes); for (int i = 0; i < path.nodes.Count; i++) { path.nodes[i] = path2.nodes[i] + vector; } path.enabled = false; path.enabled = true; } vectorArray = path.nodes.ToArray(); } else { vectorArray = iTweenPath.GetPath("driftPath1"); } object[] args = new object[] { "name", "RemoteActionHandler", "path", vectorArray, "time", 10f, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.pingPong }; Hashtable hashtable = iTween.Hash(args); iTween.MoveTo(card.gameObject, hashtable); } }
public static Vector3[] rawPath(iTweenPath path, bool global) { if (path == null) { Debug.LogError("wtf, path is null"); return(null); } if (global == true) { Vector3[] ret = new Vector3[path.nodes.Count]; for (int i = 0; i < path.nodes.Count; i++) { ret[i] = path.gameObject.transform.TransformPoint(path.nodes[i]); } return(ret); } else { return(path.nodes.ToArray()); } }
void Update() { if (!_cam) { return; } //if( visibility >= 0 ) { if (anim == null) { path = GetComponent <iTweenPath>(); if (path == null) { Debug.LogError("No path"); } anim = iTweenPath.rawPath(path, false); } if (anim != null && anim.Length > 0) { float f = Mathf.Clamp01(visibility); foreach (var slide in slides) { slide.transform.localPosition = iTween.PointOnPath(anim, easeOutQuart(0.0f, 1.0f, f)); f *= f; } } } var ray = _cam.ViewportPointToRay(new Vector3(_offset_x, _offset_y)); var p = ray.GetPoint(Mathf.Lerp(_cam.nearClipPlane, _cam.farClipPlane, _distance)); transform.position = p; }
void Start() { path = this.gameObject.GetComponent("iTweenPath") as iTweenPath; position = iTweenPath.GetPath("iTweenPath"); nodes[0] = position[0]; int atual = 0; for (int i = 0; i < amount; i++) { if (Vector3.Distance(nodes[atual], iTween.PointOnPath(position, (float)i / amount)) > distance) { nodes.Add(iTween.PointOnPath(position, (float)i / amount)); atual++; } } nodes.Add(position[position.Length - 1]); path.nodes = nodes; //path.nodes.Clear(); path.nodeCount = nodes.Count; //path.nodes.AddRange(nodes.ToArray()); //this.enabled = false; }
void Start() { path = this.gameObject.GetComponent("iTweenPath") as iTweenPath; position = iTweenPath.GetPath(path.pathName); //ws nodes position to ls nodes[0] = position[0] - path.transform.position; int atual = 0; for (int i = 0; i < amount; i++) { // if (Vector3.Distance(nodes[atual], iTween.PointOnPath(position, (float)i / amount)) > distance) { //ws nodes position to ls nodes.Add(iTween.PointOnPath(position, (float)i / amount) - path.transform.position); atual++; } } nodes.Add(position[position.Length - 1] - path.transform.position); //ls nodes path.nodes = nodes; path.nodeCount = nodes.Count; }
public void MoveToGrid(Vector2 dest) { _currentGrid = _grids.Grids[(int)dest.x, (int)dest.y].GetComponent<Grid>(); var x = (_currentGrid.ToneGrid[0, 0].transform.position.x + _currentGrid.ToneGrid[_currentGrid.Rows - 1, 0].transform.position.x) / 2; var y = (_currentGrid.ToneGrid[0, 0].transform.position.y + _currentGrid.ToneGrid[0, _currentGrid.Cols - 1].transform.position.y) / 2; var destination = new Vector3(x,y, -13); Path.nodes[1] = destination; _currentPath = Path; _currentGrid.Box.enabled = false; iTween.MoveTo(Camera.main.gameObject, iTween.Hash( "path", iTweenPath.GetPath(_currentPath.pathName), "time", Time, "orientToPath", false, "delay", .4, "easeType", "easeInOutSine", "onComplete", "MoveComplete", "onCompleteTarget", gameObject, "lookTime", 0.1f, "lookahead", 0.1f)); }
void Awake () { _iTP = this.gameObject.GetComponent<iTweenPath> (); EnemiesManager.register(this); }
void Start () { playerLadderScript = GameObject.Find("Player").GetComponent<PlayerLadder>(); pathScript = GetComponent<iTweenPath>(); }
public void SetPath(iTweenPath path, float pathTime) { _path = path; _totalPathTime = pathTime; }
void Awake() { path = Camera.main.GetComponent <iTweenPath>(); _canMove = true; }
private bool FindBestPath(Player sourcePlayer, Card sourceCard, iTweenPath[] pathComponents, out iTweenPath tweenPath, out SpellPath spellPath) { tweenPath = null; spellPath = null; if (sourcePlayer == null) { return(false); } if (sourcePlayer.GetSide() == Player.Side.FRIENDLY) { if (< > f__am$cacheB == null) {
void OnEnable() { //i like bold handle labels since I'm getting old: style.fontStyle = FontStyle.Bold; style.normal.textColor = Color.white; _target = (iTweenPath)target; }
public static void addPath(iTweenPath path) { paths.Add(path.pathName.ToLower(), path); }
void Awake() { _iTP = this.gameObject.GetComponent <iTweenPath> (); EnemiesManager.register(this); }
void Awake() { m_path = GetComponent<iTweenPath>(); }
private void Start() { path = GetComponent <iTweenPath>(); }
void Obj_itween(GameObject obj, iTweenPath path, float iTime, float delay_Time) { ImageTouch.SetActive(false); fireGun.isFireGun = false; uifire.SetActive(false); // yield return new WaitForSeconds(delay_Time); transform.GetComponent<Camera>().enabled=true; Camera.main.GetComponent<Camera>().enabled = false; obj.transform.position = (Vector3)iTweenPath.GetPath(path.pathName).GetValue(0); iTween.MoveTo(obj, iTween.Hash("path", iTweenPath.GetPath(path.pathName), "time", iTime, "delay", delay_Time, "orienttopath", true, "looktime", 1f, "easetype", iTween.EaseType.linear, "looptype", iTween.LoopType.none, "oncomplete", "StopMove", "oncompletetarget", gameObject)); GameObject.Find("First96A/ZTZ96A_FirstCam/Tank_paotai").transform.localEulerAngles = new Vector3(0, 0, 0); }
public void kreirajPutokaz() { //Destroy (GameObject.Find ("putokaz2(Clone)")); if (sledeciPutokaz < brojPathova) { // comps = go.GetComponents <iTweenPath> (); iTweenPath ip = (iTweenPath)comps [sledeciPutokaz]; nodes = ip.nodes; if (nodes.Count == 2) { nodes.Insert(1, nodes[0] + 0.5f * (nodes[1] - nodes[0])); } for (int i = 0; i < nodes.Count; i++) { if (i == nodes.Count - 1) { lastOne = true; //s = GameObject.CreatePrimitive (PrimitiveType.Sphere); // nodes [i].z s = Instantiate(Resources.Load("cilj")) as GameObject; // s.renderer.material= putokazMat ; s.transform.position = new Vector3(nodes [i].x, nodes [i].y, nodes [i].z); // s.name ="cilj"; s.tag = "putokaz"; if (sledeciPutokaz == brojPathova - 1) { s.name = "cilj_kraj"; } if (smerb) { dest = new Vector3(nodes [i].x, nodes [i].y, nodes [i].z); smerb = false; } } else if (i == 0) { // s = Instantiate (Resources.Load ("putokaz1")) as GameObject ; s = Instantiate(Resources.Load("putokaz2")) as GameObject; s.transform.localPosition = new Vector3(nodes [i].x, nodes [i].y, nodes [i].z); smer = new Vector3(nodes [i + 1].x, nodes [i + 1].y, -10f); //smer = new Vector3 (-2.8f, 1.2f, 0); Quaternion rot = Quaternion.LookRotation(s.transform.position - smer, Vector3.forward); s.transform.localRotation = rot; s.transform.eulerAngles = new Vector3(0, 0, s.transform.eulerAngles.z + 90); //onlyFirst=true; } else { s = Instantiate(Resources.Load("putokaz")) as GameObject; s.transform.localPosition = new Vector3(nodes [i].x, nodes [i].y, nodes [i].z); } lastOne = false; // paths = ip.nodes ; // foreach (Vector3 node in ip.nodes ){ //s = GameObject.CreatePrimitive(PrimitiveType.Sphere); //s.transform.position = node; // s=(GameObject)Instantiate(Resources.Load("putokaz")); // s.transform.position = node; Debug.Log(ip.pathName + " " + nodes[i].ToString()); // } } sledeciPutokaz++; } }