private void OnClickHarvest(AiController aiController, SmartObject smartObject) { smartObject.activeAction = this; switch (((ResourceNode)((Node)smartObject).nodeData).resourceSettings.resourceType) { case ResourceNode.ResourceSettings.ResourceType.Bush: smartObject.animationTrigger = "GatherBush"; break; case ResourceNode.ResourceSettings.ResourceType.Stone: smartObject.animationTrigger = "GatherStone"; break; case ResourceNode.ResourceSettings.ResourceType.Wood: smartObject.animationTrigger = "GatherWood"; break; case ResourceNode.ResourceSettings.ResourceType.Variety: break; } smartObject.actionLength = Mathf.Infinity; aiController.StartAction(smartObject, true); }
private void OnCliCkPracticeShooting(AiController aiController, SmartObject smartObject) { smartObject.activeAction = this; smartObject.animationTrigger = "Shoot"; //might need a ref for diff types of inspect animations later on smartObject.actionLength = aiController.GetRuntimeAnimationClipInfo(smartObject.animationTrigger).length; //get length of animation to be played aiController._animationWaitTime = animationLengthModifier; aiController.StartAction(smartObject, true); //commence the action based on given data }
private void OnClickInspect(AiController aiController, SmartObject smartObject) { smartObject.activeAction = this; smartObject.animationTrigger = "Inspect"; //might need a ref for diff types of inspect animations later on Debug.Log(aiController.GetRuntimeAnimationClipInfo(smartObject.animationTrigger).length); smartObject.actionLength = aiController.GetRuntimeAnimationClipInfo(smartObject.animationTrigger).length; //get length of animation to be played aiController.StartAction(smartObject, false); //commence the action based on given data }
//should put in draft mode if not already private void OnClickAttack(AiController aiController, SmartObject smartObject) { //cache, maybe var activeWeapon = aiController.equipment.activeWeapon; smartObject.activeAction = this; //might need a ref for diff types of inspect animations later on smartObject.animationTrigger = activeWeapon.animationAttackTrigger; smartObject.stoppingDistance = activeWeapon.attackRange; //set length of action, in this case infinity until target is dead or action canceled smartObject.actionLength = activeWeapon.attackSpeed; //allows a wait time between logic //aiController._animationWaitTime = _activeWeapon.attackSpeed; //commence the action based on given data aiController.StartAction(smartObject, true); //EventRelay.OnAttackInitiated(aiController); }