浏览代码

Slime critter propel attack (#315)

/devlogs-3-input
GitHub 4 年前
当前提交
faf70fc8
共有 7 个文件被更改,包括 1134 次插入38 次删除
  1. 15
      UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/SlimeCritter.controller
  2. 86
      UOP1_Project/Assets/Prefabs/Characters/SlimeCritter_Base.prefab
  3. 1001
      UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/Attack.anim
  4. 8
      UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/Attack.anim.meta
  5. 8
      UOP1_Project/Assets/ProBuilder Data.meta
  6. 43
      UOP1_Project/Assets/Scripts/Characters/SlimeCritterAttackController.cs
  7. 11
      UOP1_Project/Assets/Scripts/Characters/SlimeCritterAttackController.cs.meta

15
UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/SlimeCritter.controller


m_DefaultFloat: 0
m_DefaultInt: 0
m_DefaultBool: 0
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_Controller: {fileID: 0}
m_Controller: {fileID: 9100000}
m_AnimatorLayers:
- serializedVersion: 5
m_Name: Base Layer

m_MirrorParameterActive: 0
m_CycleOffsetParameterActive: 0
m_TimeParameterActive: 0
m_Motion: {fileID: -2106478572821700557, guid: 52ff7facc4957e944815ef86a2669a4a,
type: 3}
m_Motion: {fileID: 7400000, guid: 051e79817c3456c48bf1136efa5911d7, type: 2}
m_Tag:
m_SpeedParameter:
m_MirrorParameter:

86
UOP1_Project/Assets/Prefabs/Characters/SlimeCritter_Base.prefab


_critterSO: {fileID: 11400000, guid: fd7717100e602c446847524419231170, type: 2}
_collectibleItemPrefab: {fileID: 2126586097156616357, guid: 0f60adbc96570cb4e9898a0409956f1d,
type: 3}
--- !u!114 &2038924309811281612
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8687264390989375961}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 95216bcd641df05419665f7db9aed05b, type: 3}
m_Name:
m_EditorClassIdentifier:
_playerTransform: {fileID: 11400000, guid: 35fc4039342b6ba458d0d4429e89ee74, type: 2}
_propelFactor: 1
_propelDuration: 0.2
--- !u!1001 &2135821800440209491
PrefabInstance:
m_ObjectHideFlags: 0

objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}

type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_RootOrder
value: 3
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}

objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}

objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 96998187169542726, guid: c823b09b59e206649a8779a78929fa2d,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

m_Modifications:
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}

type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}

objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
- target: {fileID: -8679921383154817045, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}

propertyPath: m_Name
value: SlimeCritter_Base
objectReference: {fileID: 0}
- target: {fileID: 1430996729439901540, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_RootBone
value:
objectReference: {fileID: 6359161719296748449}
- target: {fileID: 5866666021909216657, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
propertyPath: m_Controller

type: 3}
m_PrefabInstance: {fileID: 8380694498511901832}
m_PrefabAsset: {fileID: 0}
--- !u!4 &6359161719296748449 stripped
Transform:
m_CorrespondingSourceObject: {fileID: -6048770967118889175, guid: 63937395ff7a888419d4b8fe450d3c91,
type: 3}
m_PrefabInstance: {fileID: 8380694498511901832}
m_PrefabAsset: {fileID: 0}

1001
UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/Attack.anim
文件差异内容过多而无法显示
查看文件

8
UOP1_Project/Assets/Art/Characters/SlimeCritter/Animation/Attack.anim.meta


fileFormatVersion: 2
guid: 051e79817c3456c48bf1136efa5911d7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

8
UOP1_Project/Assets/ProBuilder Data.meta


fileFormatVersion: 2
guid: 58345f283dec33746a86a59526b7c070
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

43
UOP1_Project/Assets/Scripts/Characters/SlimeCritterAttackController.cs


using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SlimeCritterAttackController : MonoBehaviour
{
// Reference of the player transform to compute the propel target position
[SerializeField]
private TransformAnchor _playerTransform;
// Propel factor is the proportion of the distance between the critter and the player crossed by the critter during the propel animation
[SerializeField]
private float _propelFactor = 1.0f;
// Duration of the propel section of the animation.
[SerializeField]
private float _propelDuration = 0.2f;
private float _innerTime = 0.0f;
private Vector3 _propelTargetVector = default;
// When the attack starts, the position targeted by the attack is determined and is not changed afterward
public void SetAttackTarget()
{
_propelTargetVector = (_playerTransform.Transform.position - transform.position) * _propelFactor / _propelDuration;
}
// Trigger the propel movement during the attack
public void AttackPropelTrigger()
{
_innerTime = _propelDuration;
}
// Update is called once per frame
void Update()
{
if (_innerTime > 0)
{
transform.position += _propelTargetVector * Time.deltaTime;
_innerTime -= Time.deltaTime;
}
}
}

11
UOP1_Project/Assets/Scripts/Characters/SlimeCritterAttackController.cs.meta


fileFormatVersion: 2
guid: 95216bcd641df05419665f7db9aed05b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存