/// <summary> /// Deposesses without changing the player's position. /// </summary> public void OnDeposessWOPos(Vector2 pos) { if (CurrentNode != null) { if (CurrentNode.COLTYPE == (int)COLLISION_T.NO_DEPOSEESS || CurrentNode.COLTYPE == (int)COLLISION_T.DITCH || CurrentNode.COLTYPE == (int)COLLISION_T.FALLING || CurrentNode.COLTYPE == (int)COLLISION_T.FALLING_ON_LAND || CurrentNode.COLTYPE == (int)COLLISION_T.WATER_TILE || CurrentNode.COLTYPE == (int)COLLISION_T.WALL) { o_popup pop = s_leveledit.LevEd.SpawnObject <o_popup>("thought", transform); pop.parent = this; pop.timer = 1.6f; return; } } o_plcharacter pl = s_levelloader.LevEd.player.GetComponent <o_plcharacter>(); pl.transform.position = pos; pl.gameObject.SetActive(true); transform.SetParent(GameObject.Find("Entities").transform); gameObject.layer = 13; AI = true; //s_leveledit.LevEd.ChangeCharacterPossesData(name, false); pl.CHARACTER_STATE = CHARACTER_STATES.STATE_IDLE; MagnumFoudation.s_camera.SetPlayer(pl); pl.host = null; pl.control = true; pl.SpriteObj.GetComponent <SpriteRenderer>().color = Color.white; if (respawnOnDeposess) { StartCoroutine(Unconsious()); } }
new void Start() { AI = true; only_land = true; base.Start(); respawnOnDeposess = false; pl = GameObject.Find("Player").GetComponent <o_plcharacter>(); Initialize(); }
void Awake() { cell_x = 20; cell_y = 10; gui = GetComponent <s_gui>(); play = GameObject.Find("Player").GetComponent <o_plcharacter>(); buttons.Add(new gui_button(new Vector2Int(4, 6), ChangeCOlour, Color.red)); buttons.Add(new gui_button(new Vector2Int(12, 3), ChangeCOlour, Color.magenta)); buttons.Add(new gui_button(new Vector2Int(9, 5), ChangeCOlour, Color.blue)); }
new void Start() { target = GameObject.Find("Player").GetComponent <o_plcharacter>(); pl = target.GetComponent <o_plcharacter>(); terminalspd = 60f; AI = true; control = true; CONTACT_TYPE = ON_CONTACT.IMMOBILIZE; Initialize(); SetAttackObject(); base.Start(); }
new void Update() { if (isbullet) { SetAnimation("orb", true); transform.Translate(Vector2.up * 7 * 60 * Time.deltaTime); Collider2D c = IfTouchingGetCol <PDII_character>(collision); if (c != null) { if (c != parent) { ch = c.GetComponent <PDII_character>(); if (ch == null) { return; } if (ch != parent) { switch (BULLET_TYPE) { case BULLET_T.POSSES: if (ch.isControllable) { o_plcharacter pl = null; //parent.GetComponent<SpriteRenderer>().color = Color.clear; if (parent.GetComponent <o_plcharacter>() != null) { pl = parent.GetComponent <o_plcharacter>(); } else { pl = s_leveledit.LevEd.player.GetComponent <o_plcharacter>(); } pl.host = ch; pl.host.AI = true; pl.SpriteObj.GetComponent <SpriteRenderer>().color = Color.clear; pl.control = false; pl.rbody2d.velocity = Vector2.zero; pl.gameObject.SetActive(false); s_soundmanager.sound.PlaySound(ref possesSound, false); OnImpact(ch); } break; case BULLET_T.DEPOSSES: break; case BULLET_T.KILL: ch.DespawnObject(); OnImpact(ch); break; } } if (parent.GetTargets().Find(x => x == c.GetComponent <o_character>()) != null) { } } } /* * Collider2D c2 = IfTouchingGetCol(collision, "o_collidableobject"); * if (c2 != null) * { * if (c2 != parent) * { * o_collidableobject ch = c2.GetComponent<o_collidableobject>(); * if (ch == null) * return; * if (ch.collision_type != COLLISION_T.DITCH) * { * //OnImpact(); * } * } * } */ if (timer < 0) { DespawnObject(); } else { timer -= Time.deltaTime; } } }