public void ArriveOff() { if (On(BehaviourType.arrive)) { behaviours ^= BehaviourType.arrive; } }
public void EvadeOff() { if (On(BehaviourType.evade)) { behaviours ^= BehaviourType.evade; } }
public void WanderOff() { if (On(BehaviourType.wander)) { behaviours ^= BehaviourType.wander; } }
public static Behaviour GetBehaviour(BehaviourType type) { Behaviour behaviour; switch (type) { case BehaviourType.None: behaviour = null; break; case BehaviourType.Rotate: behaviour = new Rotate(); break; case BehaviourType.RotateOneShot: behaviour = new RotateOneShot(); break; case BehaviourType.RotateBounce: behaviour = new RotateBounce(); break; default: throw new ArgumentOutOfRangeException("type", type, null); } return(behaviour); }
public behaviour(Vector3 m, Quaternion r, BehaviourType t) { target = m; rotation = r; type = t; done = false; }
public void FleeOff() { if (On(BehaviourType.flee)) { behaviours ^= BehaviourType.flee; } }
public void OffsetPursuitOff() { if (On(BehaviourType.offset_pursuit)) { behaviours ^= BehaviourType.offset_pursuit; } }
public void AlignmentOff() { if (On(BehaviourType.allignment)) { behaviours ^= BehaviourType.allignment; } }
void OnReferenceFrameUpdated(ReferenceFrame refFrame) { if (!RunLocal || !IsCurrentController) { return; } SetDefaultPointerPosition(); /** Behaviour changes whether it's connected or standalone, and according to the reference frame * -- the change is controlled from the SceneUI script * ViewCentric BodyCentric WorldCentric * Connected Gyro RaycastExt RaycastExt * StandAlone Gyro RaycastIMU RaycastIMU */ if (refFrame == ReferenceFrame.View) { Behaviour = BehaviourType.GyroMouse; } //else if (Network.isClient) // Behaviour = BehaviourType.Camera; else { Behaviour = BehaviourType.Camera; } }
public void CohesionOff() { if (On(BehaviourType.cohesion)) { behaviours ^= BehaviourType.cohesion; } }
public void FollowPathOff() { if (On(BehaviourType.follow_path)) { behaviours ^= BehaviourType.follow_path; } }
void OnReferenceFrameUpdated(ReferenceFrame refFrame) { if (!RunLocal) { return; } SetDefaultRotation(); /** Behaviour changes whether it's connected or standalone, and according to the reference frame * -- the change is controlled from the SceneUI script * ViewCentric BodyCentric WorldCentric * Connected LockCamera UnlockCamera UnlockCamera * StandAlone LockCamera UnlockCamera UnlockCamera */ if (refFrame == ReferenceFrame.View) { Behaviour = BehaviourType.LockCamera; } else { Behaviour = BehaviourType.UnlockCamera; } }
public void InterposeOff() { if (On(BehaviourType.interpose)) { behaviours ^= BehaviourType.interpose; } }
public void Init(Transform npcTrasform, NPCController npcController, Transform viewCone) { this.viewCone = viewCone; this.npcTransform = npcTrasform; this.npcController = npcController; @type = BehaviourType.pasive; }
public void HideOff() { if (On(BehaviourType.hide)) { behaviours ^= BehaviourType.hide; } }
public void SeparationOff() { if (On(BehaviourType.separation)) { behaviours ^= BehaviourType.separation; } }
public void SetBehaviour(BehaviourType b) { switch (b) { case BehaviourType.Boids1: behaviour = new RobotBehaviourBoids(this); break; case BehaviourType.Boids2: behaviour = new RobotBehaviourBoidsAdvanced(this); break; case BehaviourType.Net: behaviour = new RobotBehaviourNetAdvanced(this); break; case BehaviourType.SoloCoop: behaviour = new RobotBehaviourSoloCooperation(this); break; case BehaviourType.MinCheating: behaviour = new RobotBehaviourSoloCheating(this); break; default: Debug.LogError("Invalid Behaviour name"); break; } }
public void PursuitOff() { if (On(BehaviourType.pursuit)) { behaviours ^= BehaviourType.pursuit; } }
//void ObstacleAvoidanceOff() { if (On(BehaviourType.obstacle_avoidance)) behaviours ^= BehaviourType.obstacle_avoidance; } public void WallAvoidanceOff() { if (On(BehaviourType.wall_avoidance)) { behaviours ^= BehaviourType.wall_avoidance; } }
public void SeekOff() { if (On(BehaviourType.seek)) { behaviours ^= BehaviourType.seek; } }
public void TriggerToDraging() { if (m_isFocused) { m_behaviourType = BehaviourType.FingerDrag; RequestToServer(); } }
public static BehaviourTypeApiModel FromBehaviourType(BehaviourType behaviourType) { var model = new BehaviourTypeApiModel(); model.BehaviourTypeId = behaviourType.BehaviourTypeId; model.Name = behaviourType.Name; return(model); }
public IResourceSystemBlock GetType(ResourceDataReader reader, params object[] parameters) { reader.Position += 8; BehaviourType type = (BehaviourType)reader.ReadUInt32(); reader.Position -= 12; switch (type) { case BehaviourType.Age: return(new BehaviourAge()); case BehaviourType.Acceleration: return(new BehaviourAcceleration()); case BehaviourType.Velocity: return(new BehaviourVelocity()); case BehaviourType.Rotation: return(new BehaviourRotation()); case BehaviourType.Size: return(new BehaviourSize()); case BehaviourType.Dampening: return(new BehaviourDampening()); case BehaviourType.MatrixWeight: return(new BehaviourMatrixWeight()); case BehaviourType.Collision: return(new BehaviourCollision()); case BehaviourType.AnimateTexture: return(new BehaviourAnimateTexture()); case BehaviourType.Colour: return(new BehaviourColour()); case BehaviourType.Sprite: return(new BehaviourSprite()); case BehaviourType.Wind: return(new BehaviourWind()); case BehaviourType.Light: return(new BehaviourLight()); case BehaviourType.Model: return(new BehaviourModel()); case BehaviourType.Decal: return(new BehaviourDecal()); case BehaviourType.ZCull: return(new BehaviourZCull()); case BehaviourType.Noise: return(new BehaviourNoise()); case BehaviourType.Attractor: return(new BehaviourAttractor()); case BehaviourType.Trail: return(new BehaviourTrail()); case BehaviourType.FogVolume: return(new BehaviourFogVolume()); case BehaviourType.River: return(new BehaviourRiver()); case BehaviourType.DecalPool: return(new BehaviourDecalPool()); case BehaviourType.Liquid: return(new BehaviourLiquid()); default: throw new Exception("Unknown behaviour type"); } }
public void Init(Transform npcTrasform, NPCController npcController, Transform viewCone) { this.viewCone = viewCone; lastFrameXPos = transform.position.x; lastFrameYPos = transform.position.y; this.npcTransform = npcTrasform; this.npcController = npcController; @type = BehaviourType.aggressive; }
public BehaviourType AddBehaviour <BehaviourType>() where BehaviourType : class, IGizmoBehaviour, new() { var newBehaviour = new BehaviourType(); AddBehaviour(newBehaviour); return(newBehaviour); }
void Register(BehaviourType type, BaseBehaviour behaviour) { if (mBehaviours.ContainsKey(type)) { return; } behaviour.mNPC = mNPC; mBehaviours.Add(type, behaviour); }
/// <inheritdoc /> public void Remove( BehaviourType type) { if (behaviours.TryGetValue(type, out var behaviour)) { behaviours.Remove(type); Object.Destroy(behaviour as Behaviour); } }
public ObstacleTemplate(PrefabName prefabName, float startAngle, BehaviourType behaviourType, Vector3 direction) { PrefabName = prefabName; StartAngle = startAngle; BehaviourType = behaviourType; Direction = direction; }
/// <summary> /// Initializes a new instance of the <see cref="NavigationMesh"/> class. /// </summary> public HumanoidNavigationMesh(Transform pMyTransform, Transform pTarget, NavMeshAgent pNavigationAgent, BehaviourType behaviour) { this._myTransform = pMyTransform; this._targetTransform = pTarget; this._lastTargetPosition = this._targetTransform.position; this._navigationAgent = pNavigationAgent; this._behaviour = behaviour; }
public Behaviour(string animName, float duration, BehaviourType type, float[] eventTiming) { AnimationName = animName; Duration = timer = duration; Type = type; if (eventTiming != null) { EventTiming = (float[])eventTiming.Clone(); } }
private void SetValue(string name, string value, string system, NamePartType type, string description, int position, BehaviourType behaviour) { Name = name; Value = value; System = system; Type = type; Description = description; Position = position; Behaviour = behaviour; }
public HumanoidStateMachine(Transform pTransform, HumanoidType pHumanoidType, BehaviourType pBehaviour, float startHealth) { this._myTransform = pTransform; this._timeToChange = TIMETOCHANGE; this._startHeath=startHealth; this._humanoidType = pHumanoidType; this._behaviour = pBehaviour; if (this._behaviour == BehaviourType.DEFAULT) this._currentState = FiniteStateMachineType.IDLE; else this._currentState = FiniteStateMachineType.PATROL; this._target = GameObject.FindGameObjectWithTag("Player").transform; this._navigationMesh = new HumanoidNavigationMesh(this._myTransform, this._target, this._myTransform.GetComponent<NavMeshAgent>(), this._behaviour); this._gunObject = this._myTransform.FindChild("Gun").gameObject; this._gun = new HumanoidGun(this._gunObject); }
/// <summary> /// Updates the destination. /// </summary> /// <param name='newBehaviour'> /// New behaviour. /// </param> public void UpdateDestination(BehaviourType newBehaviour) { Debug.DrawLine (this._targetTransform.position, this._myTransform.position, Color.green); //Avalia a nova velocidade de acordo com o comportamento do humanóide. SetNavigationVelocity (newBehaviour); if (this._lastTargetPosition != this._targetTransform.position) { float distance = Vector3.Distance(this._myTransform.position, this._targetTransform.position); if (distance > 2f) { this._navigationAgent.SetDestination(this._targetTransform.position); this._navigationAgent.stoppingDistance = this._behaviour == BehaviourType.GROUP ? Random.Range(MIN_STOPPINGDISTANCE_WHENGROUP, MAX_STOPPINGDISTANCE_WHENGROUP) : STOPPINGDISTANCETOSHOOT; } this._lastTargetPosition = this._targetTransform.position; } }
void SwitchSteering(BehaviourType newType, GameObject other = null) { Vehicle v = GetComponent<Vehicle>(); switch (newType) { case BehaviourType.PURSUIT: v.behaviourType = BehaviourType.PURSUIT; v.Steering.BehaviourType = BehaviourType.PURSUIT; v.Steering.OtherVehicle = other.GetComponent<Vehicle>(); v.other = other; v.target = null; break; case BehaviourType.EVADE: v.behaviourType = BehaviourType.EVADE; v.Steering.BehaviourType = BehaviourType.EVADE; v.Steering.OtherVehicle = other.GetComponent<Vehicle>(); v.other = other; v.target = null; break; case BehaviourType.ARRIVE: v.behaviourType = BehaviourType.ARRIVE; v.target = other.transform; v.other = null; break; case BehaviourType.WANDER: v.behaviourType = BehaviourType.WANDER; v.other = null; v.target = null; break; default: v.behaviourType = BehaviourType.None; v.other = null; v.target = null; break; } }
void SwitchColor(BehaviourType newType) { Color newColor; switch (newType) { case BehaviourType.PURSUIT: newColor = new Color(0.8f, 0.1f, 0.1f); break; case BehaviourType.EVADE: newColor = new Color(0.1f, 0.1f, 0.8f); break; case BehaviourType.None: newColor = new Color(0.8f, 0.8f, 0.8f); break; default: newColor = new Color(0.8f, 0.8f, 0.8f); break; } GetComponent<Renderer>().material.color = newColor; }
public IBlob CreateBlob( string name, int health, int damage, BehaviourType behaviourType, AttackType attackType) { if (behaviourType == BehaviourType.Aggressive && attackType == AttackType.PutridFart) { IBlob blob = new AggressivePutridFart(name, health, damage); return blob; } else if (behaviourType == BehaviourType.Aggressive && attackType == AttackType.Blobplode) { IBlob blob = new AggressiveBlobplode(name, health, damage); return blob; } else if (behaviourType == BehaviourType.Inflated && attackType == AttackType.PutridFart) { IBlob blob = new InflatedPutridFart(name, health, damage); return blob; } else if (behaviourType == BehaviourType.Inflated && attackType == AttackType.Blobplode) { IBlob blob = new InflatedBlobplode(name, health, damage); return blob; } else { throw new ArgumentException("Unknown blob type"); } }
public bool IsBehaviourOn(BehaviourType type) { return behaviours[(int)type] != null; }
/// <summary> /// Removes from the list the behaviour specified by behaviourType. If no behaviour of such type exists, /// nothing happens. /// </summary> /// <param name="behaviourType">The type of the behaviour to remove.</param> public void RemoveBehaviour(BehaviourType behaviourType) { behaviours[(int)behaviourType] = null; }
public virtual void Death() { if (m_behaviourType == BehaviourType.Death) return; m_behaviourType = BehaviourType.Death; GameObject effect = (GameObject)GameObject.Instantiate(m_prefDeathEffect, transform.position, transform.rotation); effect.transform.localScale = transform.localScale; AudioClip sfx = Resources.Load<AudioClip>("SFX/"+RefMob.prefBody+"_death"); if (sfx != null) { effect.audio.clip = sfx; effect.audio.Play(); } Const.DestroyChildrenObjects(m_weaponHolder.gameObject); Const.DestroyChildrenObjects(m_aimpoint); GameObject body = gameObject.transform.Find("Body").gameObject; body.transform.parent = null; GameObjectPool.Instance.Free(body); DestroyObject(gameObject); Const.GetSpawn().ShakeCamera(0.1f); }
public virtual void Init(RefMob refMob, int level, int evolution) { m_navAgent = GetComponent<NavMeshAgent>(); m_targeting = null; m_ingTakenDamageEffect = 0; m_pushbackSpeedOnDamage = 0; m_behaviourType = BehaviourType.ALive; m_weaponHolder = transform.Find("WeaponHolder").gameObject.GetComponent<WeaponHolder>(); m_weaponHolder.Init(); if (transform.Find("Body/WeaponPoint") != null) { m_weaponHolder.transform.position = transform.Find("Body/WeaponPoint").transform.position; } damagedTexture = Resources.Load<Texture>("ani/damage monster"); normalTexture = Resources.Load<Texture>("ani/monster"); ChangeNormalColor(); m_refMob = refMob; m_creatureProperty.init(this, m_refMob.baseCreatureProperty, level, evolution); rigidbody.mass = refMob.mass; m_navAgent.baseOffset = m_refMob.baseCreatureProperty.navMeshBaseOffset; m_aimpoint = transform.Find("Body/Aimpoint").gameObject; m_hppoint = m_aimpoint; if (transform.Find("Body/HPPoint")) { m_hppoint = transform.Find("Body/HPPoint").gameObject; } m_animator = transform.Find("Body").GetComponent<Animator>(); m_prefDamageSprite = Resources.Load<GameObject>("Pref/DamageNumberSprite"); }
/// <summary> /// Sets the navigation velocity. /// </summary> /// <param name='newBehaviour'> /// New behaviour. /// </param> private void SetNavigationVelocity(BehaviourType newBehaviour) { if (this._behaviour != newBehaviour) { this._behaviour = newBehaviour; //Debug.Log ("BEHAVIOUR: " + this._behaviour); switch (this._behaviour) { case BehaviourType.DEFAULT: this._navigationAgent.speed = SPEEDDEFAULT; this._navigationAgent.acceleration = ACCELERATIONDEFAULT; break; case BehaviourType.GROUP: this._navigationAgent.speed = SPEEDGROUP; this._navigationAgent.acceleration = ACCELERATIONGROUP; break; case BehaviourType.IMPROVED: this._navigationAgent.speed = SPEEDIMPROVED; this._navigationAgent.acceleration = ACCELERATIONIMPROVED; break; case BehaviourType.SLOW: this._navigationAgent.speed = SPEEDSLOW; this._navigationAgent.acceleration = ACCELERATIONSLOW; break; } } }
protected Blob(string name, int health, int damage, BehaviourType behaviourType, AttackType attackType) : base(name, health, damage) { this.BehaviourType = behaviourType; this.AttackType = attackType; }
private void UpdateBehaviour(float currentHealth) { float percentage = currentHealth * 100 / this._startHeath; if (percentage < 50) this._behaviour = BehaviourType.IMPROVED; else if (percentage < 20) this._behaviour = BehaviourType.SLOW; }
public void setBehaviour(BehaviourType behaviour) { this.behaviour = behaviour; }
private long resourcesTransitionTime = 0; //By default transitions are instantaneous #endregion Fields #region Constructors /** * Creates a new Item * * @param id * the id of the item */ public Item(string id) : base(id) { this.behaviour = BehaviourType.NORMAL; }
public bool On(BehaviourType type) { return (behaviourType & type) == type; }
public bool isBehaviourOn(BehaviourType b) { return (entityFlags & (int)b) == (int)b; }
// For tools public void setBehaviourInteger(int behaviour) { if (behaviour == (int)BehaviourType.ATREZZO) { this.behaviour = BehaviourType.ATREZZO; } else if (behaviour == (int)BehaviourType.NORMAL) { this.behaviour = BehaviourType.NORMAL; } else if (behaviour == (int)BehaviourType.FIRST_ACTION) { this.behaviour = BehaviourType.FIRST_ACTION; } }
public void ChangeState(BehaviourType newType, GameObject other = null) { behaviourType = newType; SwitchSteering(newType, other); SwitchColor(newType); }
/// <summary> /// Initializes a new Behaviour with the specified parameters. /// </summary> /// <param name="agent">The agent that owns this behaviour.</param> /// <param name="behaviourType">The type of this behaviour.</param> /// <param name="weight">The weight associated to this behaviour. It is used in the calculation of the /// resulting force to apply to the agent.</param> public Behaviour(GameObject agent, BehaviourType behaviourType, float weight) { this.agent = agent; type = behaviourType; this.weight = weight; }
public ButtonBehaviour(Game game, string textureName, Vector2 vector, BehaviourType buttonBehaviour) : base(game, textureName, 1, vector) { ButtonBehaviourType = buttonBehaviour; }