686
社区成员




这个作业属于哪个课程 | 2023年福大-软件工程实践-W班 |
---|---|
这个作业要求在哪里 | 团队作业——beta冲刺+事后诸葛亮 |
这个作业的目标 | beta冲刺Day1随笔 |
其他参考文献 | 无 |
目录
任务总量 | 已完成工作量 | 剩余任务量 |
---|---|---|
100% | 70% | 30% |
目前任务分配合理,主要开发工作在305和311身上
我们在alpha已经完成了大部分开发工作,在本次冲刺的任务较少
修正数据表,修正初始界面逻辑,增加角色
重置角色控制
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
public float runSpeed;
public float jumpSpeed;
public float doulbJumpSpeed;
public float climbSpeed;
public float restoreTime;
private Rigidbody2D myRigidbody;
private Animator myAnim;
private BoxCollider2D myFeet;
private bool isGround;
private bool canDoubleJump;
private bool isOneWayPlatform;
private bool isLadder;
private bool isClimbing;
private bool isJumping;
private bool isFalling;
private bool isDoubleJumping;
private bool isDoubleFalling;
private float playerGravity;
private PlayerInputActions controls;
private Vector2 move;
void Awake()
{
controls = new PlayerInputActions();
controls.GamePlay.Move.performed += ctx => move = ctx.ReadValue<Vector2>();
controls.GamePlay.Move.canceled += ctx => move = Vector2.zero;
controls.GamePlay.Jump.started += ctx => Jump();
}
void OnEnable()
{
controls.GamePlay.Enable();
}
void OnDisable()
{
controls.GamePlay.Disable();
}
// Start is called before the first frame update
void Start()
{
myRigidbody = GetComponent<Rigidbody2D>();
myAnim = GetComponent<Animator>();
myFeet = GetComponent<BoxCollider2D>();
playerGravity = myRigidbody.gravityScale;
}
// Update is called once per frame
void Update()
{
CheckAirStatus();
Flip();
Run();
//Jump();
Climb();
//Attack();
CheckGrounded();
CheckLadder();
SwitchAnimation();
OneWayPlatformCheck();
}
void CheckGrounded()
{
isGround = myFeet.IsTouchingLayers(LayerMask.GetMask("Ground")) ||
myFeet.IsTouchingLayers(LayerMask.GetMask("MovingPlatform")) ||
myFeet.IsTouchingLayers(LayerMask.GetMask("DestructibleLayer")) ||
myFeet.IsTouchingLayers(LayerMask.GetMask("OneWayPlatform"));
isOneWayPlatform = myFeet.IsTouchingLayers(LayerMask.GetMask("OneWayPlatform"));
}
void CheckLadder()
{
isLadder = myFeet.IsTouchingLayers(LayerMask.GetMask("Ladder"));
//Debug.Log("isLadder:" + isLadder);
}
void Flip()
{
bool plyerHasXAxisSpeed = Mathf.Abs(myRigidbody.velocity.x) > Mathf.Epsilon;
if(plyerHasXAxisSpeed)
{
if(myRigidbody.velocity.x > 0.1f)
{
transform.localRotation = Quaternion.Euler(0, 0, 0);
}
if (myRigidbody.velocity.x < -0.1f)
{
transform.localRotation = Quaternion.Euler(0, 180, 0);
}
}
}
void Run()
{
//float moveDir = Input.GetAxis("Horizontal");
//Debug.Log("moveDir = " + moveDir.ToString());
//Vector2 playerVel = new Vector2(moveDir * runSpeed, myRigidbody.velocity.y);
//myRigidbody.velocity = playerVel;
//bool plyerHasXAxisSpeed = Mathf.Abs(myRigidbody.velocity.x) > Mathf.Epsilon;
//myAnim.SetBool("Run", plyerHasXAxisSpeed);
Vector2 playerVelocity = new Vector2(move.x * runSpeed, myRigidbody.velocity.y);
myRigidbody.velocity = playerVelocity;
bool playerHasXAxisSpeed = Mathf.Abs(myRigidbody.velocity.x) > Mathf.Epsilon;
myAnim.SetBool("Run", playerHasXAxisSpeed);
}
void Jump()
{
//if (Input.GetButtonDown("Jump"))
{
if(isGround)
{
myAnim.SetBool("Jump", true);
Vector2 jumpVel = new Vector2(0.0f, jumpSpeed);
myRigidbody.velocity = Vector2.up * jumpVel;
canDoubleJump = true;
}
else
{
if(canDoubleJump)
{
myAnim.SetBool("DoubleJump", true);
Vector2 doubleJumpVel = new Vector2(0.0f, doulbJumpSpeed);
myRigidbody.velocity = Vector2.up * doubleJumpVel;
canDoubleJump = false;
}
}
}
}
void Climb()
{
float moveY = Input.GetAxis("Vertical");
if(isClimbing)
{
myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, moveY * climbSpeed);
canDoubleJump = false;
}
if (isLadder)
{
if (moveY > 0.5f || moveY < -0.5f)
{
myAnim.SetBool("Jump", false);
myAnim.SetBool("DoubleJump", false);
myAnim.SetBool("Climbing", true);
myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, moveY * climbSpeed);
myRigidbody.gravityScale = 0.0f;
}
else
{
if (isJumping || isFalling || isDoubleJumping || isDoubleFalling)
{
myAnim.SetBool("Climbing", false);
}
else
{
myAnim.SetBool("Climbing", false);
myRigidbody.velocity = new Vector2(myRigidbody.velocity.x, 0.0f);
}
}
}
else
{
myAnim.SetBool("Climbing", false);
myRigidbody.gravityScale = playerGravity;
}
if (isLadder && isGround)
{
myRigidbody.gravityScale = playerGravity;
}
//Debug.Log("myRigidbody.gravityScale:"+ myRigidbody.gravityScale);
}
//void Attack()
//{
// if(Input.GetButtonDown("Attack"))
// {
// myAnim.SetTrigger("Attack");
// }
//}
void SwitchAnimation()
{
myAnim.SetBool("Idle", false);
if (myAnim.GetBool("Jump"))
{
if(myRigidbody.velocity.y < 0.0f)
{
myAnim.SetBool("Jump", false);
myAnim.SetBool("Fall", true);
}
}
else if(isGround)
{
myAnim.SetBool("Fall", false);
myAnim.SetBool("Idle", true);
}
if (myAnim.GetBool("DoubleJump"))
{
if (myRigidbody.velocity.y < 0.0f)
{
myAnim.SetBool("DoubleJump", false);
myAnim.SetBool("DoubleFall", true);
}
}
else if (isGround)
{
myAnim.SetBool("DoubleFall", false);
myAnim.SetBool("Idle", true);
}
}
void OneWayPlatformCheck()
{
if(isGround && gameObject.layer != LayerMask.NameToLayer("Player"))
{
gameObject.layer = LayerMask.NameToLayer("Player");
}
float moveY = Input.GetAxis("Vertical");
if (isOneWayPlatform && moveY < -0.1f)
{
gameObject.layer = LayerMask.NameToLayer("OneWayPlatform");
Invoke("RestorePlayerLayer", restoreTime);
}
}
void RestorePlayerLayer()
{
if(!isGround && gameObject.layer != LayerMask.NameToLayer("Player"))
{
gameObject.layer = LayerMask.NameToLayer("Player");
}
}
void CheckAirStatus()
{
isJumping = myAnim.GetBool("Jump");
isFalling = myAnim.GetBool("Fall");
isDoubleJumping = myAnim.GetBool("DoubleJump");
isDoubleFalling = myAnim.GetBool("DoubleFall");
isClimbing = myAnim.GetBool("Climbing");
//Debug.Log("isJumping:" + isJumping);
//Debug.Log("isFalling:" + isFalling);
//Debug.Log("isDoubleJumping:" + isDoubleJumping);
//Debug.Log("isDoubleFalling:" + isDoubleFalling);
//Debug.Log("isClimbing:" + isClimbing);
}
}
Day1
学号:222000314
项目进展:熟悉了项目大致的结构,重置角色控制
遇到的困难:对角色属性设置功能不熟练
明天安排:进一步进行角色设计
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Playerinteract : MonoBehaviour
{
private Collider2D col;
private PlayerInputActions action;
private void Start()
{
action=new PlayerInputActions();
action.GamePlay.Interact.started += ctx=>DoInteraction();
}
private void OnTriggerEnter2D(Collider2D collision)
{
col = collision;
}
private void OnTriggerExit2D(Collider2D collision)
{
col = null;
}
private void DoInteraction()
{
if(col == null)
{
return;
}
Interactable interactable=col.GetComponent<Interactable>();
if(interactable == null)
{
return;
}
}
}
---
学号:222000311
项目进展:更换角色动画,重新定义攻击碰撞体,编写碰撞检测函数
遇到的困难:无
明天安排:实现敌人受击反馈
---
学号:222000311
完成:审核代码的格式规范
花费时间:1h
距离β结束:7天
存在问题:无
到明天会议安排:审核之前的代码查漏补缺
---
学号:222000422
项目进展:学习相关技术
遇到的困难:环境搭建出现冲突
明天安排:完善攻击脚本
心得体会:团队合作能提高工作效率
---
学号姓名:222000312彭季菖
项目进展:与大家讨论了拓展功能的实现,完成了分工选择,明确了任务
遇到的困难:等后端差不多就可以开工了
明天安排:复习、检验项目进度计划工作时间安排
---
学号:222000305
项目进展:
更换准备场景,优化Fade逻辑,优化摄像机控制,增加部分场景物体逻辑
遇到的困难:插件底层代码细节导致主线程被占用
明天安排:完成准备场景逻辑模拟
心得体会:面向素材编程了属于是
成果展示:
---
学号:222000306
今日进展 :用户使用调研,确定用户对象
遇到问题 :无
明天安排 协助完成部分测试
---
学号:222000420
项目进展:与队友讨论如何进行后续开发,找资源
遇到的困难:查看tibition任务表做规划
明天安排:完成任务表中内容
心得体会:组队任务需要大家努力
---
学号:222000315
完成:完善关卡场景;
花费时间:4h;
距离β结束:7天;
存在的问题:暂无;
到明天会议前安排:暂无;