示例#1
0
    protected override void Start()
    {
        base.Start();

        //spriteRenderer = GetComponent<SpriteRenderer>();
        animator      = GetComponent <Animator>();
        rb            = GetComponent <Rigidbody2D>();
        jumpHandler   = GetComponent <JumpHandler>();
        robotAnimator = animationRenderer.GetComponent <Animator>();

        foreach (Robot robot in (new Robot[] { attackRobot, agilityRobot, tankRobot }))
        {
            robots.Add(robot.GetRobotID(), robot);
            robot.gameObject.SetActive(false);
            robot.SetColliderProperties();
        }

        currentRobot = attackRobot;
        currentRobot.gameObject.SetActive(true);
        SetAnimatorToRobot(currentRobot);

        if (!facingRight)
        {
            invert = -1;
        }
        else
        {
            invert = 1;
        }
    }
示例#2
0
 private void Awake()
 {
     _rigidbody     = GetComponent <Rigidbody2D>();
     _jumpHandler   = GetComponent <JumpHandler>();
     _groundChecker = GetComponent <GroundChecker>();
     _flipChecker   = GetComponent <FlipChecker>();
     robotAnimator  = animationRenderer.GetComponent <Animator>();
 }