public void Populate(BitControl renderer, object data, int index, bool selected) { string name = ((NameModel)data).Name; Debug.Log(name); renderer.Text = name; }
// 공격하기 void AttackControl() { if (Input.GetKeyUp(KeyCode.Space) && !BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_ENERGY_CHARGE)) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.ATTACK); } }
// 가로 이동 float HorizontalMoveControl() { float moveX = 0.0f; if (Input.GetKey(KeyCode.A)) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.MOVE); moveX = -m_moveSpeed * Time.deltaTime; this.m_skletonAnimation.skeleton.flipX = false; //this.GetComponent<SpriteRenderer>().flipX = false; } if (Input.GetKey(KeyCode.D)) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.MOVE); moveX = m_moveSpeed * Time.deltaTime; this.m_skletonAnimation.skeleton.flipX = true; } return(moveX); }
void OnTriggerExit2D(Collider2D col) { MDebug.Log("Exit " + col.tag); if (m_damagePointFix != null && m_damagePointFix.Equals(col.gameObject)) { m_damagePointFix = null; } if (!string.IsNullOrEmpty(col.transform.tag)) { m_userControlName = null; } if (col.tag == "LADDER") { ShowWeapon(true); m_LadderState = false; m_rigidBody.gravityScale = 1.0f; m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.LADDER); // 사다리 m_skletonAnimation.enabled = true; this.GetComponent <MeshRenderer>().enabled = true; if (m_climb == null) { return; } if (m_climb.state.GetCurrent(0) != null) { m_climb.state.ClearTrack(0); } m_climb.gameObject.SetActive(false); } }
// :: 행성 나가기 void ObjectRoboOutDoorControlCheck() { if (BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_OUT_DOOR)) { string func = ""; switch (GameManager.Instance().SCENE_PLACE) { case GameManager.PLACE.ROBO_IN: case GameManager.PLACE.ROBO_IN_DRIVE: case GameManager.PLACE.ROBO_IN_GUN: func = "RobotOutEnd"; GameManager.PLACE place = GameManager.PLACE.PLANET1; switch (GameManager.Instance().ROBO.ROBO_PLACE_NAME) { case "PLANET1": place = GameManager.PLACE.PLANET1; break; case "PLANET2": place = GameManager.PLACE.PLANET2; break; } GameManager.Instance().ChangeScene(place, gameObject, func); break; case GameManager.PLACE.PLANET: case GameManager.PLACE.PLANET1: case GameManager.PLACE.PLANET2: m_rigidBody.velocity = new Vector2(0.0f, 0.0f); func = "RobotInEnd"; GameManager.Instance().ChangeScene(GameManager.PLACE.ROBO_IN_DRIVE, gameObject, func); break; } } }
//단순 애니메이션 작업 void NetworkAnimation() { if (m_roboState == (int)ROBO_STATE.IDLE) //BitControl.Get(m_roboState, (int)ROBO_STATE.IDLE)) { CheckAndSetAnimation(ANI_IDLE, true); // m_skletonAnimation.state.SetAnimation(0, ANI_IDLE, true); m_engineAnimator.SetInteger("play", 0); } else { if (BitControl.Get(m_roboState, (int)ROBO_STATE.MOVE)) { if (IsCurrentAnimation(ANI_IDLE)) { m_skletonAnimation.state.SetAnimation(0, ANI_MOVE, true); } m_engineAnimator.SetInteger("play", 1); } } if (BitControl.Get(m_roboState, (int)ROBO_STATE.ATTACK)) { m_skletonAnimation.state.SetAnimation(0, ANI_ATTACK, false); m_roboState = BitControl.Clear(m_roboState, (int)ROBO_STATE.ATTACK); m_roboState = BitControl.Set(m_roboState, (int)ROBO_STATE.COOLTIME); } }
// 상태값 교환으로 애니메이션 void NetworkManager.NetworkMessageEventListenrer.ReceiveNetworkMessage(NetworkManager.MessageEvent e) { if (e.msgType == NetworkManager.STATE_CHANGE) { if (GameManager.Instance().PLAYER.USER_NAME == m_movePlayerName) { return; } //상태값 뽑기 m_roboState = (int)e.msg.GetField(NetworkManager.STATE_CHANGE).i; // 공격 애니메이션을 gun 을 작동시키는 녀석이 재생할 필요가 없다고 가정하고 해보자 if (BitControl.Get(m_roboState, (int)ROBO_STATE.ATTACK) || BitControl.Get(m_roboState, (int)ROBO_STATE.COOLTIME)) { if (m_gunPlayerName == GameManager.Instance().PLAYER.USER_NAME) { m_roboState = BitControl.Clear(m_roboState, (int)ROBO_STATE.ATTACK); m_roboState = BitControl.Clear(m_roboState, (int)ROBO_STATE.COOLTIME); } } } else if (e.msgType == NetworkManager.GUN_ANGLE_CHANGE) { // 앵글 또한 보간해야함 if (GameManager.Instance().PLAYER.USER_NAME == m_gunPlayerName) { return; } m_targetAngle = e.msg.GetField(NetworkManager.GUN_ANGLE_CHANGE).f; m_syncTime_angle = 0.0f; m_delay_angle = Time.time - m_lastSyncTimeAngle; m_lastSyncTimeAngle = Time.time; } else if (e.msgType == NetworkManager.HP_UPDATE) { if (GameManager.Instance().PLAYER.USER_NAME.Equals(e.user) || !e.targetName.EndsWith("robo")) { return; } m_hp = (int)e.msg.GetField(NetworkManager.HP_UPDATE).i; } else if (e.msgType == NetworkManager.ENERGY_UPDATE) { if (GameManager.Instance().PLAYER.USER_NAME.Equals(e.user) || !e.targetName.EndsWith("robo")) { return; } m_roboEnergy = e.msg.GetField(NetworkManager.ENERGY_UPDATE).f; } else if (e.msgType.Equals(NetworkManager.ROBOT_PLACE)) { if (!string.IsNullOrEmpty(m_movePlayerName) && m_movePlayerName.Equals(e.user) || (!string.IsNullOrEmpty(m_gunPlayerName) && m_gunPlayerName.Equals(e.user))) { return; } m_controllName = e.targetName; } }
// :: 행성 나가기 void ObjectRoboOutDoorControlCheck() { if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_OUT_DOOR)) { GameObject target = null; int cameraSize = 6; // CameraManager.CAMERA_PLACE place = CameraManager.CAMERA_PLACE.ROBO_IN; string func = ""; //switch (CameraManager.Instance().PLACE) //{ // case CameraManager.CAMERA_PLACE.ROBO_IN: // target = CameraManager.Instance().m_inTheStar; // place = CameraManager.CAMERA_PLACE.STAR; // func = "RobotOutEnd"; // break; // case CameraManager.CAMERA_PLACE.STAR: // target = CameraManager.Instance().m_robotPlace; // cameraSize = 4; // place = CameraManager.CAMERA_PLACE.ROBO_IN; // this.GetComponent<Rigidbody2D>().gravityScale = 0.0f; // func = "RobotInEnd"; // break; //} //CameraManager.Instance().MoveCameraAndObject(target , cameraSize , place , gameObject , gameObject , func , false); } }
// :: 총 조종 void ObjectRoboGunControlCheck() { if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_GUN)) { if (m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE == 0) { if (m_tutoEnemy != null) { m_tutoEnemy.SetActive(true); } m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE = 2; GameManager.Instance().ChangeScene(GameManager.PLACE.TUTORIAL_ROBO); //CameraManager.Instance().MoveCamera( // m_tutoRobo , // GameSetting.CAMERA_SPACE , // CameraManager.CAMERA_PLACE.TUTORIAL_ROBO_SPACE); // m_tuto.TutorialAction_ObjectInteraction("gun_controller"); } else { m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE = 0; GameManager.Instance().ChangeScene(GameManager.PLACE.TUTORIAL_ROBO_IN); //CameraManager.Instance().MoveCamera(gameObject , GameSetting.CAMERA_ROBO , CameraManager.CAMERA_PLACE.TUTORIAL_ROBO_IN); } } }
// 가로 이동 float HorizontalMoveControl() { float moveX = 0.0f; if (Input.GetKey(KeyCode.A)) { m_curState = BitControl.Set(m_curState, (int)HERO_STATE.MOVE); moveX = -m_moveSpeed * Time.deltaTime; this.m_skletonAnimation.skeleton.flipX = false; //this.GetComponent<SpriteRenderer>().flipX = false; if (m_rigidBody.velocity.x > 0.0f) { m_rigidBody.velocity = new Vector2(0.0f, m_rigidBody.velocity.y); } } if (Input.GetKey(KeyCode.D)) { m_curState = BitControl.Set(m_curState, (int)HERO_STATE.MOVE); moveX = m_moveSpeed * Time.deltaTime; this.m_skletonAnimation.skeleton.flipX = true; if (m_rigidBody.velocity.x > 0.0f) { m_rigidBody.velocity = new Vector2(0.0f, m_rigidBody.velocity.y); } } return(moveX); }
void CompleteAnimation(TrackEntry trackEntry) { if (trackEntry.animation.name.Equals(ANI_REPAIR)) { m_curState = BitControl.Clear(m_curState, (int)HERO_STATE.ATTACK); m_skletonAnimation.state.ClearTrack(1); if (!m_isMe) { return; } if (m_damagePointFix != null) { m_damagePointFix.GetComponent <RoboDamagePoint>().DamageFix(); } else if (m_monster != null) { if (m_monster.enabled) { m_monster.Damage(1); } else { NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonHPUdate(m_monster.MONSTER_NAME, 1)); } } } }
public void Populate(BitControl listRenderer, object data, int index, bool selected) { if (data == null) { return; } listRenderer.Content.text = (selected ? "* " : "") + data; }
// :: 인벤 void ObjectRoboInvenControlCheck() { if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_INVEN)) { m_userControlName = null; m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.CONTROL_INVEN); } }
// 어택 종료시 초기화 void AttackEndCheckEvent(Spine.TrackEntry trackEntry) { if (BitControl.Get(m_roboState, (int)HeroRobo.ROBO_STATE.COOLTIME)) //trackEntry.animation.name == ANI_ATTACK) { m_roboState = BitControl.Clear(m_roboState, (int)HeroRobo.ROBO_STATE.COOLTIME); //m_effectAnimator.gameObject.SetActive(true); //m_effectAnimator.Play("Robo_attackEffect"); } }
// 어택 종료시 초기화 void AttackEndCheckEvent(Spine.TrackEntry trackEntry) { if (trackEntry.animation.name.Equals(ANI_ATTACK))//trackEntry.animation.name == ANI_ATTACK) { m_roboState = BitControl.Clear(m_roboState, (int)ROBO_STATE.COOLTIME); m_skletonAnimation.state.SetAnimation(0, ANI_IDLE, true); //m_effectAnimator.gameObject.SetActive(true); //m_effectAnimator.Play("Robo_attackEffect"); } }
// :::::::::::::::::::::::::::: // :: 힐링 존 void ObjectRoboHealControlCheck() { // 기능 구현해야함 if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_HEAL)) { m_userControlName = null; m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.CONTROL_HEAL); m_tuto.TutorialAction_Heal(100, 100); } }
// :::::::::::::::::::::::::::: // :: 힐링 존 void ObjectRoboHealControlCheck() { // 기능 구현해야함 if (BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_HEAL)) { m_userControlName = null; m_curState = BitControl.Clear(m_curState, (int)HERO_STATE.CONTROL_HEAL); HP = GameSetting.HERO_MAX_HP; } }
void ControlGun() { m_prevAngle = m_gunAngle; if (!m_skletonAnimation.skeleton.flipX) { m_armBone.transform.rotation = Quaternion.Euler(0, 0, m_gunAngle); } else { m_armBone.transform.rotation = Quaternion.Euler(0, 0, -m_gunAngle); } if (Input.GetKey(KeyCode.UpArrow)) { if (m_gunAngle - 1.0f > -360.0f) { m_gunAngle -= 1.0f; } } if (Input.GetKey(KeyCode.DownArrow)) { if (m_gunAngle + 1.0f < 360.0f) { m_gunAngle += 1.0f; } } if (ENERGY >= 2.0f && !BitControl.Get(m_roboState, (int)ROBO_STATE.COOLTIME) && Input.GetKeyUp(KeyCode.Space)) { SoundManager.Instance().PlaySound(m_laser1); m_roboState = BitControl.Set(m_roboState, (int)ROBO_STATE.ATTACK); } if (BitControl.Get(m_roboState, (int)ROBO_STATE.ATTACK) && !BitControl.Get(m_roboState, (int)ROBO_STATE.COOLTIME)) { m_skletonAnimation.state.SetAnimation(0, ANI_ATTACK, false); StateSend(); m_roboState = BitControl.Clear(m_roboState, (int)ROBO_STATE.ATTACK); m_roboState = BitControl.Set(m_roboState, (int)ROBO_STATE.COOLTIME); if (ENERGY >= 2.0f) { //if (!IsInvoking("EnergyTestUser")) // Invoke("EnergyTestUser" , 0.5f); if (m_gunPlayerName.Equals(GameManager.Instance().PLAYER.USER_NAME)) { ENERGY -= 2.0f; FireBullet(); } } } }
void InteractionEffect() { if (BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_GUN)) { PopupManager.Instance().AddInteractionPopup("WEAPON SYSTEM ONLINE"); } else { PopupManager.Instance().AddInteractionPopup("DRIVE SYSTEM ONLINE"); } }
void CompleteAnimation(TrackEntry trackEntry) { if (trackEntry.animation.name.Equals(ANI_REPAIR)) { m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.ATTACK); m_skletonAnimation.state.ClearTrack(1); if (m_damagePointFix != null) { m_damagePointFix.GetComponent <RoboDamagePoint>().DamageFix(); } } }
public void Populate(BitControl renderer, object data, int index, bool selected) { var marketItemData = data as MarketItemData; if (marketItemData == null) { return; } _itemPicture.Image = marketItemData.Picture; _nameLabel.Content.text = marketItemData.Name; _priceLabel.Content.text = marketItemData.Price; }
float VerticalMoveControl() { float moveY = 0.0f; float jump = 0.0f; if (Input.GetKey(KeyCode.W)) { if (m_LadderState) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.MOVE); m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.LADDER); moveY = m_moveSpeed * Time.deltaTime; m_rigidBody.gravityScale = 0.0f; m_rigidBody.velocity = Vector2.zero; m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.JUMP); m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.JUMP_FALL); } else if (!BitControl.Get(m_curState, (int)Hero.HERO_STATE.JUMP) && !BitControl.Get(m_curState, (int)Hero.HERO_STATE.JUMP_FALL)) { // 특정 오브젝트 밟자마자 (점프 안끝났는데) 점프하는 경우 방지 if (m_rigidBody.velocity.y <= 0.0f) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.JUMP); jump = m_jumpPower; } } } if (Input.GetKey(KeyCode.S)) { if (m_LadderState) { m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.MOVE); m_curState = BitControl.Set(m_curState, (int)Hero.HERO_STATE.LADDER); moveY = -m_moveSpeed * Time.deltaTime; m_rigidBody.gravityScale = 0.0f; m_rigidBody.velocity = Vector2.zero; m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.JUMP); m_curState = BitControl.Clear(m_curState, (int)Hero.HERO_STATE.JUMP_FALL); } else { //딱히 하는거 없음 } } return((BitControl.Get(m_curState, (int)Hero.HERO_STATE.JUMP)) ? jump : moveY); }
// 공격하기 void AttackControl() { if (Input.GetKeyUp(KeyCode.Space) && !BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_ENERGY_CHARGE)) { m_curState = BitControl.Clear(m_curState, (int)HERO_STATE.ATTACK); if (m_skletonAnimation.state.GetCurrent(1) != null) { m_skletonAnimation.state.ClearTrack(1); } m_curState = BitControl.Set(m_curState, (int)HERO_STATE.ATTACK); } }
//-----------------------------------------------------------------------------------------------------------------------// //-- 오브젝트 조작 -----------------------------------------------------------------------------------------------------// // :: 로봇 조종 void ObjectRoboDriveControlCheck() { if (BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_DRIVE)) { if (string.IsNullOrEmpty(GameManager.Instance().ROBO.MOVE_PLYAER)) { NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonOrderRobotSetting()); } else { //탈출 NetworkManager.Instance().SendOrderMessage(JSONMessageTool.ToJsonOrderRobotSetting(false)); } } }
void ObjectControl() { // 특정 컨트롤 조작시에 조작키를 눌렀을 때 if (Input.GetKeyUp(KeyCode.R)) { int state = -1; switch (m_userControlName) { case "ROBOT_HEAL": state = (int)Hero.HERO_STATE.CONTROL_HEAL; break; case "ROBOT_DRIVE": state = (int)Hero.HERO_STATE.CONTROL_DRIVE; break; case "ROBOT_INVEN": state = (int)Hero.HERO_STATE.CONTROL_INVEN; break; case "ROBOT_GUN": state = (int)Hero.HERO_STATE.CONTROL_GUN; break; case "ROBOT_OUT_DOOR": state = (int)Hero.HERO_STATE.CONTROL_OUT_DOOR; break; case "ROBOT_STATUSVIEW": break; case "ROBOT_ENERGY_CHARGE": state = (int)Hero.HERO_STATE.CONTROL_ENERGY_CHARGE; break; } // SoundManager.Instance().PlaySound(m_interaction); if (state > 0) { m_curState = BitControl.Set(m_curState, state); } // 실제 오브젝트 작동 //로봇 조종 체크 ObjectRoboDriveControlCheck(); //로봇 총 조작 체크 ObjectRoboGunControlCheck(); //행성 나가기 체크 ObjectRoboOutDoorControlCheck(); // 힐링 존 체크 ObjectRoboHealControlCheck(); // 인벤 체크 ObjectRoboInvenControlCheck(); } }
void OnTriggerStay2D(Collider2D col) { if (!m_isMe) { return; } if (!col.transform.tag.Equals("LADDER") && !string.IsNullOrEmpty(col.transform.tag)) { m_userControlName = col.transform.tag; } if (col.transform.tag == "LADDER" && (BitControl.Get(m_curState, (int)HERO_STATE.JUMP) || BitControl.Get(m_curState, (int)HERO_STATE.JUMP_FALL))) { } }
void ControlGun() { m_prevAngle = m_gunAngle; if (!m_skletonAnimation.skeleton.flipX) { m_armBone.transform.rotation = Quaternion.Euler(0, 0, m_gunAngle); } else { m_armBone.transform.rotation = Quaternion.Euler(0, 0, -m_gunAngle); } if (Input.GetKey(KeyCode.UpArrow)) { if (m_gunAngle - 1.0f > -360.0f) { m_gunAngle -= 1.0f; } } if (Input.GetKey(KeyCode.DownArrow)) { if (m_gunAngle + 1.0f < 360.0f) { m_gunAngle += 1.0f; } } if (Input.GetKeyUp(KeyCode.Space) && !BitControl.Get(m_roboState, (int)HeroRobo.ROBO_STATE.COOLTIME)) { SoundManager.Instance().PlaySound(m_laser1); m_roboState = BitControl.Set(m_roboState, (int)HeroRobo.ROBO_STATE.ATTACK); } if (BitControl.Get(m_roboState, (int)HeroRobo.ROBO_STATE.ATTACK)) { m_skletonAnimation.state.SetAnimation(0, ANI_ATTACK, false); m_roboState = BitControl.Clear(m_roboState, (int)HeroRobo.ROBO_STATE.ATTACK); m_roboState = BitControl.Set(m_roboState, (int)HeroRobo.ROBO_STATE.COOLTIME); FireBullet(); } }
// :: 에너지 충전 void ObjectRoboEnergyControlCheck() { if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_ENERGY_CHARGE)) { if (Input.GetKeyDown(KeyCode.Space)) { if (iTween.Count(m_chargePad.gameObject) <= 0) { iTween.MoveTo(m_chargePad.gameObject, iTween.Hash("y", m_chargeTopObj.transform.position.y, "oncompletetarget", gameObject, "oncomplete", "PadTweenEnd", "speed", 4.0f)); GameManager.Instance().ROBO.ENERGY = GameManager.Instance().ROBO.ENERGY + 0.5f; } else { } } } }
// :: 에너지 충전 void ObjectRoboEnergyControlCheck() { if (BitControl.Get(m_curState, (int)HERO_STATE.CONTROL_ENERGY_CHARGE)) { if (Input.GetKeyDown(KeyCode.Space)) { if (GameManager.Instance().ROBO.ENERGY < 100.0f && iTween.Count(m_chargePad.gameObject) <= 0) { iTween.MoveTo(m_chargePad.gameObject, iTween.Hash("y", m_chargeTopObj.transform.position.y, "oncompletetarget", gameObject, "oncomplete", "PadTweenEnd", "speed", 4.0f, "onupdatetarget", gameObject, "onupdate", "ChargeMoveSend")); GameManager.Instance().ROBO.ENERGY += 1.0f; NetworkManager.Instance().SendOrderMessage( JSONMessageTool.ToJsonEnergyUdate("robo", GameManager.Instance().ROBO.ENERGY)); } else { } } } }
// :: 로봇 조종 void ObjectRoboDriveControlCheck() { if (BitControl.Get(m_curState, (int)Hero.HERO_STATE.CONTROL_DRIVE)) { if (m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE == 0) { m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE = 1; GameManager.Instance().ChangeScene(GameManager.PLACE.TUTORIAL_ROBO); //CameraManager.Instance().MoveCamera( // m_tutoRobo , // GameSetting.CAMERA_SPACE , // CameraManager.CAMERA_PLACE.TUTORIAL_ROBO_SPACE); m_tuto.TutorialAction_ObjectInteraction("drive_controller"); m_tutoMoveCk = true; } else { m_tutoRobo.GetComponent <TutoRobo>().CUR_STATE = 0; GameManager.Instance().ChangeScene(GameManager.PLACE.TUTORIAL_ROBO_IN); //CameraManager.Instance().MoveCamera(gameObject , GameSetting.CAMERA_ROBO , // CameraManager.CAMERA_PLACE.TUTORIAL_ROBO_IN); } } }
private void InitBitControl(BitControl bitControl) { bitControl.Name = "bitControl"; bitControl.Editable = false; _bitControl = bitControl; }