public bool ChangeStateToRescue() { State_Manager temptarget = null; foreach (GameObject go in UsefulFunctions.GetNearbyRobotWithBoxColliderArray(parent_object.transform.position, robot_local_sprite_size * 4)) { temptarget = go.GetComponent <Robot_Status>().GetStateManager(); if (temptarget == null) { ally_target = null; } else { if (temptarget.GetRobotCurrentState() == ROBOT_STATES.DEAD || temptarget.GetRobotCurrentState() == ROBOT_STATES.OUTOFENERGY) { ally_target = go; break; } else { ally_target = null; } } } if (ally_target != null && Random.Range(1, 101) < parent_object.GetComponent <Robot_Status>().GetChanceToRescue()) { SetCurrentState(ROBOT_STATES.RESCUE); return(true); } return(false); }
// Use this for initialization public virtual void Start() { state_holder = transform.parent.gameObject; main_robot = transform.root.gameObject; state_holder_stateManager = state_holder.GetComponent <State_Manager>(); robot_status = main_robot.GetComponent <Robot_Status>(); gameObject.SetActive(false); }
void Start() { managerState = GetComponentInChildren <State_Manager>(); currentState = new State_Patrol(); SB = GetComponent <SteeringBehaviours>(); CurrentHP = MaxHP; currentAmmo = maxAmmo; FindNearestHP(); }
// Use this for initialization void Start() { state_manager = GetComponentInChildren <State_Manager>(); inventory = GetComponentInChildren <Robot_Inventory>(); bank = FindObjectOfType <ItemHolder>(); chance_attack = 50f; chance_gather = 50f; chance_heal = 50f; chance_rescue = 50f; }
void Start() { StateManager = new State_Manager<Wolf_Behavior>(this); maneuver = new Maneuver(this); d_Attack = new Direct_Attack(this); attackpoint = this.transform.FindChild("AttackPoint").gameObject; blnAlive = true; nmpPath = new NavMeshPath (); nmaAgent = this.gameObject.GetComponent<NavMeshAgent> (); intHealth = 50; intDamage = 2000; blnExecBehavior = false; }
void Start() { StateManager = new State_Manager <Wolf_Behavior>(this); maneuver = new Maneuver(this); d_Attack = new Direct_Attack(this); attackpoint = this.transform.FindChild("AttackPoint").gameObject; blnAlive = true; nmpPath = new NavMeshPath(); nmaAgent = this.gameObject.GetComponent <NavMeshAgent> (); intHealth = 50; intDamage = 2000; blnExecBehavior = false; }
void Start() { position = new Vector3(); position_share = new Vector3(); rotation_share = new Quaternion(); #if UNITY_IOS //iOS doesn't connect to ros-sharp #else //HSRのTF情報とHSRの現在のステートを習得する tf = HSR_connector.GetComponent <TF_Manager>(); State_Manager = HSR_connector.GetComponent <State_Manager>(); State_Manager.State_EventHandler += (sender, e) => generate(e); #endif }